PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / 2.4.6
Booking for Appointments and Events Calendar – Amelia v2.4.6
2.4.7 2.4.6 2.4.5 2.4.4 2.4.3 2.4.2 2.4.1 2.4 trunk 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.28 1.2.29 1.2.3 1.2.30 1.2.31 1.2.32 1.2.33 1.2.34 1.2.35 1.2.36 1.2.37 1.2.38 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.1.3 2.2 2.2.1 2.3
ameliabooking / vendor / guzzlehttp / psr7 / src / HttpFactory.php
ameliabooking / vendor / guzzlehttp / psr7 / src Last commit date
Exception 7 months ago AppendStream.php 7 months ago BufferStream.php 7 months ago CachingStream.php 7 months ago DroppingStream.php 7 months ago FnStream.php 7 months ago Header.php 7 months ago HttpFactory.php 7 months ago InflateStream.php 7 months ago LazyOpenStream.php 7 months ago LimitStream.php 7 months ago Message.php 7 months ago MessageTrait.php 7 months ago MimeType.php 7 months ago MultipartStream.php 7 months ago NoSeekStream.php 7 months ago PumpStream.php 7 months ago Query.php 7 months ago Request.php 7 months ago Response.php 7 months ago Rfc7230.php 7 months ago ServerRequest.php 7 months ago Stream.php 7 months ago StreamDecoratorTrait.php 7 months ago StreamWrapper.php 7 months ago UploadedFile.php 7 months ago Uri.php 7 months ago UriComparator.php 7 months ago UriNormalizer.php 7 months ago UriResolver.php 7 months ago Utils.php 7 months ago
HttpFactory.php
95 lines
1 <?php
2
3 declare(strict_types=1);
4
5 namespace AmeliaVendor\GuzzleHttp\Psr7;
6
7 use AmeliaVendor\Psr\Http\Message\RequestFactoryInterface;
8 use AmeliaVendor\Psr\Http\Message\RequestInterface;
9 use AmeliaVendor\Psr\Http\Message\ResponseFactoryInterface;
10 use AmeliaVendor\Psr\Http\Message\ResponseInterface;
11 use AmeliaVendor\Psr\Http\Message\ServerRequestFactoryInterface;
12 use AmeliaVendor\Psr\Http\Message\ServerRequestInterface;
13 use AmeliaVendor\Psr\Http\Message\StreamFactoryInterface;
14 use AmeliaVendor\Psr\Http\Message\StreamInterface;
15 use AmeliaVendor\Psr\Http\Message\UploadedFileFactoryInterface;
16 use AmeliaVendor\Psr\Http\Message\UploadedFileInterface;
17 use AmeliaVendor\Psr\Http\Message\UriFactoryInterface;
18 use AmeliaVendor\Psr\Http\Message\UriInterface;
19
20 /**
21 * Implements all of the PSR-17 interfaces.
22 *
23 * Note: in consuming code it is recommended to require the implemented interfaces
24 * and inject the instance of this class multiple times.
25 */
26 final class HttpFactory implements RequestFactoryInterface, ResponseFactoryInterface, ServerRequestFactoryInterface, StreamFactoryInterface, UploadedFileFactoryInterface, UriFactoryInterface
27 {
28 public function createUploadedFile(
29 StreamInterface $stream,
30 ?int $size = null,
31 int $error = \UPLOAD_ERR_OK,
32 ?string $clientFilename = null,
33 ?string $clientMediaType = null
34 ): UploadedFileInterface {
35 if ($size === null) {
36 $size = $stream->getSize();
37 }
38
39 return new UploadedFile($stream, $size, $error, $clientFilename, $clientMediaType);
40 }
41
42 public function createStream(string $content = ''): StreamInterface
43 {
44 return Utils::streamFor($content);
45 }
46
47 public function createStreamFromFile(string $file, string $mode = 'r'): StreamInterface
48 {
49 try {
50 $resource = Utils::tryFopen($file, $mode);
51 } catch (\RuntimeException $e) {
52 if ('' === $mode || false === \in_array($mode[0], ['r', 'w', 'a', 'x', 'c'], true)) {
53 throw new \InvalidArgumentException(sprintf('Invalid file opening mode "%s"', $mode), 0, $e);
54 }
55
56 throw $e;
57 }
58
59 return Utils::streamFor($resource);
60 }
61
62 public function createStreamFromResource($resource): StreamInterface
63 {
64 return Utils::streamFor($resource);
65 }
66
67 public function createServerRequest(string $method, $uri, array $serverParams = []): ServerRequestInterface
68 {
69 if (empty($method)) {
70 if (!empty($serverParams['REQUEST_METHOD'])) {
71 $method = $serverParams['REQUEST_METHOD'];
72 } else {
73 throw new \InvalidArgumentException('Cannot determine HTTP method');
74 }
75 }
76
77 return new ServerRequest($method, $uri, [], null, '1.1', $serverParams);
78 }
79
80 public function createResponse(int $code = 200, string $reasonPhrase = ''): ResponseInterface
81 {
82 return new Response($code, [], null, '1.1', $reasonPhrase);
83 }
84
85 public function createRequest(string $method, $uri): RequestInterface
86 {
87 return new Request($method, $uri);
88 }
89
90 public function createUri(string $uri = ''): UriInterface
91 {
92 return new Uri($uri);
93 }
94 }
95