public function createRequestFromSuperglobals(array $server): IHttpRequestMessage
    {
        $method = $server['REQUEST_METHOD'] ?? 'GET';

        // Permit the overriding of the request method for POST requests
        if ($method === 'POST' && isset($server['X-HTTP-METHOD-OVERRIDE'])) {
            $method = $server['X-HTTP-METHOD-OVERRIDE'];
        }

        $uri = $this->createUriFromSuperglobals($server);
        $headers = $this->createHeadersFromSuperglobals($server);
        $body = new StreamBody(new Stream(fopen('php://input', 'rb')));
        $properties = $this->createProperties($server);

        return new Request($method, $uri, $headers, $body, $properties);
    }
public function createRequestFromSuperglobals(array $server): IHttpRequestMessage
    {
        $method = $server['REQUEST_METHOD'] ?? 'GET';

        // Permit the overriding of the request method for POST requests
        if ($method === 'POST' && isset($server['X-HTTP-METHOD-OVERRIDE'])) {
            $method = $server['X-HTTP-METHOD-OVERRIDE'];
        }

        $uri = $this->createUriFromSuperglobals($server);
        $headers = $this->createHeadersFromSuperglobals($server);
        $body = new StreamBody(new Stream(fopen('php://input', 'rb')));
        $properties = $this->createProperties($server);

        return new Request($method, $uri, $headers, $body, $properties);
    }
public function createRequestFromSuperglobals ( array $ server ) : IHttpRequestMessage { $ method = $ server [ 'REQUEST_METHOD' ] ?? 'GET' ; // Permit the overriding of the request method for POST requests if ( $ method === 'POST' && isset ( $ server [ 'X-HTTP-METHOD-OVERRIDE' ] ) ) { $ method = $ server [ 'X-HTTP-METHOD-OVERRIDE' ] ; } $ uri = $ this -> createUriFromSuperglobals ( $ server ) ; $ headers = $ this -> createHeadersFromSuperglobals ( $ server ) ; $ body = new StreamBody ( new Stream ( fopen ( 'php://input' , 'rb' ) ) ) ; $ properties = $ this -> createProperties ( $ server ) ; return new Request ( $ method , $ uri , $ headers , $ body , $ properties ) ; }
Creates a request message from PHP superglobals

@param array $server The server superglobal
@return IHttpRequestMessage The created request message
@throws InvalidArgumentException Thrown if any of the headers were in an invalid format
@throws RuntimeException Thrown if any of the headers' hash keys could not be calculated
Creates a request message from PHP superglobals