| 1 | <?php |
||
| 10 | class HttpResponse implements IHttpResponse |
||
| 11 | { |
||
| 12 | /** @var int The http response status code */ |
||
| 13 | private $httpStatus; |
||
| 14 | |||
| 15 | /** @var string The response body */ |
||
| 16 | private $body; |
||
| 17 | |||
| 18 | /** @var array The response headers */ |
||
| 19 | private $headers = []; |
||
| 20 | |||
| 21 | 3 | public function __construct(array $data = []) |
|
| 29 | |||
| 30 | /** |
||
| 31 | * Get the HttpResponse status. |
||
| 32 | * |
||
| 33 | * @return mixed |
||
| 34 | */ |
||
| 35 | 3 | public function getHttpStatus() |
|
| 39 | |||
| 40 | /** |
||
| 41 | * Get the request body. |
||
| 42 | * |
||
| 43 | * @return string |
||
| 44 | */ |
||
| 45 | 3 | public function getBody() |
|
| 49 | |||
| 50 | /** |
||
| 51 | * Get the request body as json, if is json compatible. |
||
| 52 | * |
||
| 53 | * @return string |
||
| 54 | */ |
||
| 55 | public function json() |
||
| 64 | |||
| 65 | /** |
||
| 66 | * The the response headers. |
||
| 67 | * |
||
| 68 | * @return array |
||
| 69 | */ |
||
| 70 | public function getHeaders() |
||
| 74 | } |
||
| 75 |