PluginProbe ʕ •ᴥ•ʔ
ShareThis Dashboard for Google Analytics / 3.2.1
ShareThis Dashboard for Google Analytics v3.2.1
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 / guzzle / src / Handler / HeaderProcessor.php
googleanalytics / lib / analytics-admin / vendor / guzzlehttp / guzzle / src / Handler Last commit date
CurlFactory.php 3 years ago CurlFactoryInterface.php 3 years ago CurlHandler.php 3 years ago CurlMultiHandler.php 2 years ago EasyHandle.php 3 years ago HeaderProcessor.php 3 years ago MockHandler.php 3 years ago Proxy.php 3 years ago StreamHandler.php 3 years ago
HeaderProcessor.php
43 lines
1 <?php
2
3 namespace GuzzleHttp\Handler;
4
5 use GuzzleHttp\Utils;
6
7 /**
8 * @internal
9 */
10 final class HeaderProcessor
11 {
12 /**
13 * Returns the HTTP version, status code, reason phrase, and headers.
14 *
15 * @param string[] $headers
16 *
17 * @throws \RuntimeException
18 *
19 * @return array{0:string, 1:int, 2:?string, 3:array}
20 */
21 public static function parseHeaders(array $headers): array
22 {
23 if ($headers === []) {
24 throw new \RuntimeException('Expected a non-empty array of header data');
25 }
26
27 $parts = \explode(' ', \array_shift($headers), 3);
28 $version = \explode('/', $parts[0])[1] ?? null;
29
30 if ($version === null) {
31 throw new \RuntimeException('HTTP version missing from header data');
32 }
33
34 $status = $parts[1] ?? null;
35
36 if ($status === null) {
37 throw new \RuntimeException('HTTP status code missing from header data');
38 }
39
40 return [$version, (int) $status, $parts[2] ?? null, Utils::headersFromLines($headers)];
41 }
42 }
43