PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 27.9
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v27.9
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
wordpress-seo / vendor_prefixed / guzzlehttp / guzzle / src / Handler / HeaderProcessor.php

HeaderProcessor.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 27.9, at vendor_prefixed/guzzlehttp/guzzle/src/Handler/HeaderProcessor.php

37 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace YoastSEO_Vendor\GuzzleHttp\Handler;
4
5 use YoastSEO_Vendor\GuzzleHttp\Utils;
6 /**
7 * @internal
8 */
9 final class HeaderProcessor
10 {
11 /**
12 * Returns the HTTP version, status code, reason phrase, and headers.
13 *
14 * @param string[] $headers
15 *
16 * @return array{0:string, 1:int, 2:?string, 3:array}
17 *
18 * @throws \RuntimeException
19 */
20 public static function parseHeaders(array $headers) : array
21 {
22 if ($headers === []) {
23 throw new \RuntimeException('Expected a non-empty array of header data');
24 }
25 $parts = \explode(' ', \array_shift($headers), 3);
26 $version = \explode('/', $parts[0])[1] ?? null;
27 if ($version === null) {
28 throw new \RuntimeException('HTTP version missing from header data');
29 }
30 $status = $parts[1] ?? null;
31 if ($status === null) {
32 throw new \RuntimeException('HTTP status code missing from header data');
33 }
34 return [$version, (int) $status, $parts[2] ?? null, \YoastSEO_Vendor\GuzzleHttp\Utils::headersFromLines($headers)];
35 }
36 }
37