PluginProbe
WCPOS – Point of Sale (POS) plugin for WooCommerce / 1.10.19
WCPOS – Point of Sale (POS) plugin for WooCommerce v1.10.19
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 1.9.14 All 163 releases
woocommerce-pos / vendor_prefixed / sentry / sentry / src / HttpClient / Response.php

Response.php in WCPOS – Point of Sale (POS) plugin for WooCommerce 1.10.19, at vendor_prefixed/sentry/sentry/src/HttpClient/Response.php

76 lines 1.7 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\HttpClient;
5
6 final class Response
7 {
8 /**
9 * @var int The HTTP status code
10 */
11 private $statusCode;
12 /**
13 * @var string[]
14 */
15 private $headerNames = [];
16 /**
17 * @var string[][]
18 */
19 private $headers;
20 /**
21 * @var string The cURL error and error message
22 */
23 private $error;
24 /**
25 * @param string[][] $headers
26 */
27 public function __construct(int $statusCode, array $headers, string $error)
28 {
29 $this->statusCode = $statusCode;
30 $this->headers = $headers;
31 $this->error = $error;
32 foreach ($headers as $name => $value) {
33 $this->headerNames[\strtolower($name)] = $name;
34 }
35 }
36 public function getStatusCode() : int
37 {
38 return $this->statusCode;
39 }
40 public function isSuccess() : bool
41 {
42 return $this->statusCode >= 200 && $this->statusCode <= 299;
43 }
44 public function hasHeader(string $name) : bool
45 {
46 return isset($this->headerNames[\strtolower($name)]);
47 }
48 /**
49 * @return string[]
50 */
51 public function getHeader(string $header) : array
52 {
53 if (!$this->hasHeader($header)) {
54 return [];
55 }
56 $header = $this->headerNames[\strtolower($header)];
57 return $this->headers[$header];
58 }
59 public function getHeaderLine(string $name) : string
60 {
61 $value = $this->getHeader($name);
62 if (empty($value)) {
63 return '';
64 }
65 return \implode(',', $value);
66 }
67 public function getError() : string
68 {
69 return $this->error;
70 }
71 public function hasError() : bool
72 {
73 return $this->error !== '';
74 }
75 }
76