Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Psr17Factory.php

function Psr17Factory::createServerRequestFromGlobals

File

vendor/php-http/discovery/src/Psr17Factory.php, line 101

Class

Psr17Factory
A generic PSR-17 implementation.

Namespace

Http\Discovery

Code

public function createServerRequestFromGlobals(?array $server = null, ?array $get = null, ?array $post = null, ?array $cookie = null, ?array $files = null, ?StreamInterface $body = null) : ServerRequestInterface {
    $server = $server ?? $_SERVER;
    $request = $this->createServerRequest($server['REQUEST_METHOD'] ?? 'GET', $this->createUriFromGlobals($server), $server);
    return $this->buildServerRequestFromGlobals($request, $server, $files ?? $_FILES)
        ->withQueryParams($get ?? $_GET)
        ->withParsedBody($post ?? $_POST)
        ->withCookieParams($cookie ?? $_COOKIE)
        ->withBody($body ?? $this->createStreamFromFile('php://input', 'r+'));
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal