WordPress\AiClientDependencies\Nyholm\Psr7

ServerRequest::__constructpublicWP 1.0

Метод класса: ServerRequest{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$ServerRequest = new ServerRequest();
$ServerRequest->__construct( $method, $uri, $headers, $body, $version, $serverParams );
$method(строка) (обязательный)
HTTP method.
$uri(строка|UriInterface) (обязательный)
URI.
$headers(массив)
Request headers.
По умолчанию: []
$body(строка|resource|StreamInterface|null)
Request body.
По умолчанию: null
$version(строка)
Protocol version.
По умолчанию: '1.1'
$serverParams(массив)
Typically the $_SERVER superglobal.
По умолчанию: []

Код ServerRequest::__construct() WP 7.0.4

public function __construct(string $method, $uri, array $headers = [], $body = null, string $version = '1.1', array $serverParams = [])
{
    $this->serverParams = $serverParams;
    if (!$uri instanceof UriInterface) {
        $uri = new Uri($uri);
    }
    $this->method = $method;
    $this->uri = $uri;
    $this->setHeaders($headers);
    $this->protocol = $version;
    \parse_str($uri->getQuery(), $this->queryParams);
    if (!$this->hasHeader('Host')) {
        $this->updateHostFromUri();
    }
    // If we got no body, defer initialization of the stream until ServerRequest::getBody()
    if ('' !== $body && null !== $body) {
        $this->stream = Stream::create($body);
    }
}