| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 <?php 2 3 declare (strict_types=1); 4 namespace WordPress\AiClientDependencies\Nyholm\Psr7; 5 6 use WordPress\AiClientDependencies\Psr\Http\Message\RequestInterface; 7 use WordPress\AiClientDependencies\Psr\Http\Message\StreamInterface; 8 use WordPress\AiClientDependencies\Psr\Http\Message\UriInterface; 9 /** 10 * @author Tobias Nyholm <tobias.nyholm@gmail.com> 11 * @author Martijn van der Ven <martijn@vanderven.se> 12 * 13 * @final This class should never be extended. See https://github.com/Nyholm/psr7/blob/master/doc/final.md 14 */ 15 class Request implements RequestInterface 16 { 17 use MessageTrait; 18 use RequestTrait; 19 /** 20 * @param string $method HTTP method 21 * @param string|UriInterface $uri URI 22 * @param array $headers Request headers 23 * @param string|resource|StreamInterface|null $body Request body 24 * @param string $version Protocol version 25 */ 26 public function __construct(string $method, $uri, array $headers = [], $body = null, string $version = '1.1') 27 { 28 if (!$uri instanceof UriInterface) { 29 $uri = new Uri($uri); 30 } 31 $this->method = $method; 32 $this->uri = $uri; 33 $this->setHeaders($headers); 34 $this->protocol = $version; 35 if (!$this->hasHeader('Host')) { 36 $this->updateHostFromUri(); 37 } 38 // If we got no body, defer initialization of the stream until Request::getBody() 39 if ('' !== $body && null !== $body) { 40 $this->stream = Stream::create($body); 41 } 42 } 43 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Sat Jun 13 09:38:55 2026 | Cross-referenced by PHPXref |