| @@ -45,22 +45,31 @@ | ||
| 45 | 45 | */ |
| 46 | 46 | private $missing_licenses; |
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | + * The response headers, keyed by lower-cased header name. | |
| 50 | + * | |
| 51 | + * @var array<string, string|array<string>> | |
| 52 | + */ | |
| 53 | + private $headers; | |
| 54 | + | |
| 55 | + /** | |
| 49 | 56 | * Response constructor. |
| 50 | 57 | * |
| 51 | - * @param string $body The response body. | |
| 52 | - * @param int $response_code The response code. | |
| 53 | - * @param string $message The response message. | |
| 54 | - * @param string $error_code The error code. | |
| 55 | - * @param array<string> $missing_licenses The missing licenses. | |
| 58 | + * @param string $body The response body. | |
| 59 | + * @param int $response_code The response code. | |
| 60 | + * @param string $message The response message. | |
| 61 | + * @param string $error_code The error code. | |
| 62 | + * @param array<string> $missing_licenses The missing licenses. | |
| 63 | + * @param array<string, string|array<string>> $headers The response headers, keyed by lower-cased header name. | |
| 56 | 64 | */ |
| 57 | - public function __construct( string $body, int $response_code, string $message, string $error_code = '', $missing_licenses = [] ) { | |
| 65 | + public function __construct( string $body, int $response_code, string $message, string $error_code = '', $missing_licenses = [], array $headers = [] ) { | |
| 58 | 66 | $this->body = $body; |
| 59 | 67 | $this->response_code = $response_code; |
| 60 | 68 | $this->message = $message; |
| 61 | 69 | $this->error_code = $error_code; |
| 62 | 70 | $this->missing_licenses = $missing_licenses; |
| 71 | + $this->headers = $headers; | |
| 63 | 72 | } |
| 64 | 73 | |
| 65 | 74 | /** |
| 66 | 75 | * Gets the response body. |
| @@ -104,6 +113,15 @@ | ||
| 104 | 113 | * @return array<string> The missing licenses. |
| 105 | 114 | */ |
| 106 | 115 | public function get_missing_licenses(): array { |
| 107 | 116 | return $this->missing_licenses; |
| 117 | + } | |
| 118 | + | |
| 119 | + /** | |
| 120 | + * Gets the response headers, keyed by lower-cased header name. | |
| 121 | + * | |
| 122 | + * @return array<string, string|array<string>> The response headers. | |
| 123 | + */ | |
| 124 | + public function get_headers(): array { | |
| 125 | + return $this->headers; | |
| 108 | 126 | } |
| 109 | 127 | } |