PluginProbe ʕ •ᴥ•ʔ
ShareThis Dashboard for Google Analytics / 3.3.0
ShareThis Dashboard for Google Analytics v3.3.0
3.3.2 trunk 1.0.7 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.1 2.1.2 2.1.3 2.1.4 2.1.5 2.2.5 2.3.5 2.3.6 2.3.7 2.3.8 2.4.0 2.4.1 2.5.0 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 3.0.0 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.3.0 3.3.1
googleanalytics / lib / analytics-admin / vendor / guzzlehttp / psr7 / src / HttpFactory.php
googleanalytics / lib / analytics-admin / vendor / guzzlehttp / psr7 / src Last commit date
Exception 3 years ago AppendStream.php 3 years ago BufferStream.php 3 years ago CachingStream.php 3 years ago DroppingStream.php 3 years ago FnStream.php 3 years ago Header.php 3 years ago HttpFactory.php 3 years ago InflateStream.php 3 years ago LazyOpenStream.php 3 years ago LimitStream.php 3 years ago Message.php 3 years ago MessageTrait.php 3 years ago MimeType.php 3 years ago MultipartStream.php 3 years ago NoSeekStream.php 3 years ago PumpStream.php 3 years ago Query.php 3 years ago Request.php 3 years ago Response.php 3 years ago Rfc7230.php 3 years ago ServerRequest.php 3 years ago Stream.php 3 years ago StreamDecoratorTrait.php 3 years ago StreamWrapper.php 3 years ago UploadedFile.php 3 years ago Uri.php 3 years ago UriComparator.php 3 years ago UriNormalizer.php 3 years ago UriResolver.php 3 years ago Utils.php 3 years ago
HttpFactory.php
101 lines
1 <?php
2
3 declare(strict_types=1);
4
5 namespace GuzzleHttp\Psr7;
6
7 use Psr\Http\Message\RequestFactoryInterface;
8 use Psr\Http\Message\RequestInterface;
9 use Psr\Http\Message\ResponseFactoryInterface;
10 use Psr\Http\Message\ResponseInterface;
11 use Psr\Http\Message\ServerRequestFactoryInterface;
12 use Psr\Http\Message\ServerRequestInterface;
13 use Psr\Http\Message\StreamFactoryInterface;
14 use Psr\Http\Message\StreamInterface;
15 use Psr\Http\Message\UploadedFileFactoryInterface;
16 use Psr\Http\Message\UploadedFileInterface;
17 use Psr\Http\Message\UriFactoryInterface;
18 use 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
27 RequestFactoryInterface,
28 ResponseFactoryInterface,
29 ServerRequestFactoryInterface,
30 StreamFactoryInterface,
31 UploadedFileFactoryInterface,
32 UriFactoryInterface
33 {
34 public function createUploadedFile(
35 StreamInterface $stream,
36 int $size = null,
37 int $error = \UPLOAD_ERR_OK,
38 string $clientFilename = null,
39 string $clientMediaType = null
40 ): UploadedFileInterface {
41 if ($size === null) {
42 $size = $stream->getSize();
43 }
44
45 return new UploadedFile($stream, $size, $error, $clientFilename, $clientMediaType);
46 }
47
48 public function createStream(string $content = ''): StreamInterface
49 {
50 return Utils::streamFor($content);
51 }
52
53 public function createStreamFromFile(string $file, string $mode = 'r'): StreamInterface
54 {
55 try {
56 $resource = Utils::tryFopen($file, $mode);
57 } catch (\RuntimeException $e) {
58 if ('' === $mode || false === \in_array($mode[0], ['r', 'w', 'a', 'x', 'c'], true)) {
59 throw new \InvalidArgumentException(sprintf('Invalid file opening mode "%s"', $mode), 0, $e);
60 }
61
62 throw $e;
63 }
64
65 return Utils::streamFor($resource);
66 }
67
68 public function createStreamFromResource($resource): StreamInterface
69 {
70 return Utils::streamFor($resource);
71 }
72
73 public function createServerRequest(string $method, $uri, array $serverParams = []): ServerRequestInterface
74 {
75 if (empty($method)) {
76 if (!empty($serverParams['REQUEST_METHOD'])) {
77 $method = $serverParams['REQUEST_METHOD'];
78 } else {
79 throw new \InvalidArgumentException('Cannot determine HTTP method');
80 }
81 }
82
83 return new ServerRequest($method, $uri, [], null, '1.1', $serverParams);
84 }
85
86 public function createResponse(int $code = 200, string $reasonPhrase = ''): ResponseInterface
87 {
88 return new Response($code, [], null, '1.1', $reasonPhrase);
89 }
90
91 public function createRequest(string $method, $uri): RequestInterface
92 {
93 return new Request($method, $uri);
94 }
95
96 public function createUri(string $uri = ''): UriInterface
97 {
98 return new Uri($uri);
99 }
100 }
101