| Total Complexity | 12 |
| Total Lines | 81 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 6 | class JsonResponse implements ResponseInterface |
||
| 7 | { |
||
| 8 | /** |
||
| 9 | * @var array |
||
| 10 | */ |
||
| 11 | private $decoded; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * @var PsrResponse |
||
| 15 | */ |
||
| 16 | private $response; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @param PsrResponse $response |
||
| 20 | */ |
||
| 21 | public function __construct(PsrResponse $response) |
||
| 22 | { |
||
| 23 | $this->response = $response; |
||
| 24 | } |
||
| 25 | |||
| 26 | /** |
||
| 27 | * @return PsrResponse |
||
| 28 | */ |
||
| 29 | public function getHttpResponse() |
||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Access elements of the JSON response using dot notation |
||
| 36 | * @param null $item |
||
|
|
|||
| 37 | * @param null $default |
||
| 38 | * @return mixed |
||
| 39 | */ |
||
| 40 | public function get($item = null, $default = null) |
||
| 61 | } |
||
| 62 | |||
| 63 | /** |
||
| 64 | * @return bool |
||
| 65 | */ |
||
| 66 | public function successful() |
||
| 67 | { |
||
| 68 | return preg_match('/^2[\d]{2,}/', $this->getHttpResponse()->getStatusCode()); |
||
| 69 | } |
||
| 70 | |||
| 71 | /** |
||
| 72 | * @return array |
||
| 73 | */ |
||
| 74 | private function getDecodedJson() |
||
| 87 | } |
||
| 88 | } |
||
| 89 | } |
||
| 90 |