PluginProbe
WCPOS – Point of Sale (POS) plugin for WooCommerce / 1.10.20
WCPOS – Point of Sale (POS) plugin for WooCommerce v1.10.20
1.10.20 1.10.19 1.10.18 1.10.17 1.10.16 1.10.15 1.10.13 1.10.14 1.10.12 1.10.11 1.10.10 1.10.9 1.10.8 untagged-3d9b7ccddc54df87c672 1.10.7 1.10.6 1.10.5 1.10.3 1.10.4 1.10.2 1.10.1 1.10.0 1.9.17 1.9.15 1.9.16 All 164 releases
woocommerce-pos / vendor_prefixed / sentry / sentry / src / Util / Http.php

Http.php in WCPOS – Point of Sale (POS) plugin for WooCommerce 1.10.20, at vendor_prefixed/sentry/sentry/src/Util/Http.php

46 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare (strict_types=1);
4 namespace WCPOS\Vendor\Sentry\Util;
5
6 use WCPOS\Vendor\Sentry\Client;
7 use WCPOS\Vendor\Sentry\Dsn;
8 /**
9 * @internal
10 */
11 final class Http
12 {
13 public static function getSentryAuthHeader(Dsn $dsn, string $sdkIdentifier, string $sdkVersion) : string
14 {
15 $authHeader = ['sentry_version=' . Client::PROTOCOL_VERSION, 'sentry_client=' . $sdkIdentifier . '/' . $sdkVersion, 'sentry_key=' . $dsn->getPublicKey()];
16 return 'Sentry ' . \implode(', ', $authHeader);
17 }
18 /**
19 * @return string[]
20 */
21 public static function getRequestHeaders(Dsn $dsn, string $sdkIdentifier, string $sdkVersion) : array
22 {
23 return ['Content-Type: application/x-sentry-envelope', 'X-Sentry-Auth: ' . self::getSentryAuthHeader($dsn, $sdkIdentifier, $sdkVersion)];
24 }
25 /**
26 * @param string[][] $headers
27 *
28 * @param-out string[][] $headers
29 */
30 public static function parseResponseHeaders(string $headerLine, array &$headers) : int
31 {
32 if (\strpos($headerLine, ':') === \false) {
33 return \strlen($headerLine);
34 }
35 [$name, $value] = \explode(':', \trim($headerLine), 2);
36 $name = \trim($name);
37 $value = \trim($value);
38 if (isset($headers[$name])) {
39 $headers[$name][] = $value;
40 } else {
41 $headers[$name] = (array) $value;
42 }
43 return \strlen($headerLine);
44 }
45 }
46