| [ 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\Factory; 5 6 use WordPress\AiClientDependencies\Http\Message\MessageFactory; 7 use WordPress\AiClientDependencies\Http\Message\StreamFactory; 8 use WordPress\AiClientDependencies\Http\Message\UriFactory; 9 use WordPress\AiClientDependencies\Nyholm\Psr7\Request; 10 use WordPress\AiClientDependencies\Nyholm\Psr7\Response; 11 use WordPress\AiClientDependencies\Nyholm\Psr7\Stream; 12 use WordPress\AiClientDependencies\Nyholm\Psr7\Uri; 13 use WordPress\AiClientDependencies\Psr\Http\Message\RequestInterface; 14 use WordPress\AiClientDependencies\Psr\Http\Message\ResponseInterface; 15 use WordPress\AiClientDependencies\Psr\Http\Message\StreamInterface; 16 use WordPress\AiClientDependencies\Psr\Http\Message\UriInterface; 17 if (!\interface_exists(MessageFactory::class)) { 18 throw new \LogicException('You cannot use "Nyholm\Psr7\Factory\HttplugFactory" as the "php-http/message-factory" package is not installed. Try running "composer require php-http/message-factory". Note that this package is deprecated, use "psr/http-factory" instead'); 19 } 20 @\trigger_error('Class "Nyholm\Psr7\Factory\HttplugFactory" is deprecated since version 1.8, use "Nyholm\Psr7\Factory\Psr17Factory" instead.', \E_USER_DEPRECATED); 21 /** 22 * @author Tobias Nyholm <tobias.nyholm@gmail.com> 23 * @author Martijn van der Ven <martijn@vanderven.se> 24 * 25 * @final This class should never be extended. See https://github.com/Nyholm/psr7/blob/master/doc/final.md 26 * 27 * @deprecated since version 1.8, use Psr17Factory instead 28 */ 29 class HttplugFactory implements MessageFactory, StreamFactory, UriFactory 30 { 31 public function createRequest($method, $uri, array $headers = [], $body = null, $protocolVersion = '1.1'): RequestInterface 32 { 33 return new Request($method, $uri, $headers, $body, $protocolVersion); 34 } 35 public function createResponse($statusCode = 200, $reasonPhrase = null, array $headers = [], $body = null, $version = '1.1'): ResponseInterface 36 { 37 return new Response((int) $statusCode, $headers, $body, $version, $reasonPhrase); 38 } 39 public function createStream($body = null): StreamInterface 40 { 41 return Stream::create($body ?? ''); 42 } 43 public function createUri($uri = ''): UriInterface 44 { 45 if ($uri instanceof UriInterface) { 46 return $uri; 47 } 48 return new Uri($uri); 49 } 50 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Sat Jun 13 09:38:55 2026 | Cross-referenced by PHPXref |