WordPress\AiClientDependencies\Nyholm\Psr7
Request::__construct
Метод класса: Request{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$Request = new Request(); $Request->__construct( $method, $uri, $headers, $body, $version );
- $method(строка) (обязательный)
- HTTP method.
- $uri(строка|UriInterface) (обязательный)
- URI.
- $headers(массив)
- Request headers.
По умолчанию:[] - $body(строка|resource|StreamInterface|null)
- Request body.
По умолчанию:null - $version(строка)
- Protocol version.
По умолчанию:'1.1'
Код Request::__construct() Request:: construct WP 7.0.4
public function __construct(string $method, $uri, array $headers = [], $body = null, string $version = '1.1')
{
if (!$uri instanceof UriInterface) {
$uri = new Uri($uri);
}
$this->method = $method;
$this->uri = $uri;
$this->setHeaders($headers);
$this->protocol = $version;
if (!$this->hasHeader('Host')) {
$this->updateHostFromUri();
}
// If we got no body, defer initialization of the stream until Request::getBody()
if ('' !== $body && null !== $body) {
$this->stream = Stream::create($body);
}
}