1 | <?php |
||
8 | class Response |
||
9 | { |
||
10 | /** |
||
11 | * HTTP status code of request. |
||
12 | * |
||
13 | * @var int |
||
14 | */ |
||
15 | protected $status_code; |
||
16 | |||
17 | /** |
||
18 | * The headers sent during the request. |
||
19 | * |
||
20 | * @var string |
||
21 | */ |
||
22 | protected $sent_headers; |
||
23 | |||
24 | /** |
||
25 | * The headers received during the request. |
||
26 | * |
||
27 | * @var string|bool |
||
28 | */ |
||
29 | protected $received_headers; |
||
30 | |||
31 | /** |
||
32 | * Response body of last request. |
||
33 | * |
||
34 | * @var mixed |
||
35 | */ |
||
36 | protected $response_data; |
||
37 | |||
38 | /** |
||
39 | * Response constructor. |
||
40 | * |
||
41 | * @param int $status_code |
||
42 | * @param string $sent_headers |
||
43 | * @param string|bool $received_headers |
||
44 | * @param mixed $response_data |
||
45 | */ |
||
46 | public function __construct($status_code, $sent_headers, $received_headers, $response_data) |
||
53 | |||
54 | /** |
||
55 | * @param bool $keep_authorization_value |
||
56 | * |
||
57 | * @return array |
||
58 | */ |
||
59 | public function asRaw($keep_authorization_value = false) |
||
84 | |||
85 | /** |
||
86 | * asArray. |
||
87 | * |
||
88 | * Returns the response body as an array |
||
89 | * |
||
90 | * @return array |
||
91 | */ |
||
92 | public function asArray() |
||
100 | |||
101 | /** |
||
102 | * asObject. |
||
103 | * |
||
104 | * Returns the response body as an array |
||
105 | * |
||
106 | * @return \stdClass |
||
107 | */ |
||
108 | public function asObject() |
||
116 | |||
117 | /** |
||
118 | * httpStatus. |
||
119 | * |
||
120 | * Returns the http_status code |
||
121 | * |
||
122 | * @return int |
||
123 | */ |
||
124 | public function httpStatus() |
||
128 | |||
129 | /** |
||
130 | * isSuccess. |
||
131 | * |
||
132 | * Checks if the http status code indicates a succesful or an error response. |
||
133 | * |
||
134 | * @return bool |
||
135 | */ |
||
136 | public function isSuccess() |
||
144 | } |
||
145 |