1 | <?php |
||
13 | class RawResponse |
||
14 | { |
||
15 | /** |
||
16 | * @var array The response headers in the form of an associative array. |
||
17 | */ |
||
18 | protected $headers; |
||
19 | |||
20 | /** |
||
21 | * @var string The raw response body. |
||
22 | */ |
||
23 | protected $body; |
||
24 | |||
25 | /** |
||
26 | * @var int The HTTP status response code. |
||
27 | */ |
||
28 | protected $httpResponseCode; |
||
29 | |||
30 | /** |
||
31 | * Creates a new RawResponse entity. |
||
32 | * |
||
33 | * @param string|array $headers The headers as a raw string or array. |
||
34 | * @param string $body The raw response body. |
||
35 | * @param int $httpStatusCode The HTTP response code (if sending headers as parsed array). |
||
36 | */ |
||
37 | public function __construct($headers, $body, $httpStatusCode = null) |
||
51 | |||
52 | /** |
||
53 | * Return the response headers. |
||
54 | * |
||
55 | * @return array |
||
56 | */ |
||
57 | public function getHeaders() |
||
61 | |||
62 | /** |
||
63 | * Return the body of the response. |
||
64 | * |
||
65 | * @return string |
||
66 | */ |
||
67 | public function getBody() |
||
71 | |||
72 | /** |
||
73 | * Return the HTTP response code. |
||
74 | * |
||
75 | * @return int |
||
76 | */ |
||
77 | public function getHttpResponseCode() |
||
81 | |||
82 | /** |
||
83 | * Sets the HTTP response code from a raw header. |
||
84 | * |
||
85 | * @param string $rawResponseHeader |
||
86 | */ |
||
87 | public function setHttpResponseCodeFromHeader($rawResponseHeader) |
||
92 | |||
93 | /** |
||
94 | * Parse the raw headers and set as an array. |
||
95 | * |
||
96 | * @param string $rawHeaders The raw headers from the response. |
||
97 | */ |
||
98 | protected function setHeadersFromString($rawHeaders) |
||
119 | } |
||
120 |