1 | <?php |
||
7 | class Response |
||
8 | { |
||
9 | /** |
||
10 | * @var int |
||
11 | */ |
||
12 | private $statusCode = 0; |
||
13 | |||
14 | /** |
||
15 | * @var array |
||
16 | */ |
||
17 | private $data = []; |
||
18 | |||
19 | /** |
||
20 | * Response constructor. |
||
21 | * @param int $statusCode |
||
22 | * @param string $json |
||
23 | */ |
||
24 | 66 | public function __construct($statusCode, $json = '{}') |
|
29 | |||
30 | /** |
||
31 | * @return null|string |
||
32 | */ |
||
33 | 24 | public function getError() |
|
46 | |||
47 | /** |
||
48 | * @param array $cause |
||
49 | * @return array |
||
50 | */ |
||
51 | 6 | private function parseCauses(array $cause) |
|
71 | |||
72 | /** |
||
73 | * @return int |
||
74 | */ |
||
75 | 33 | public function getStatusCode() |
|
79 | |||
80 | /** |
||
81 | * @return array |
||
82 | */ |
||
83 | 30 | public function getData() |
|
87 | |||
88 | /** |
||
89 | * @return bool |
||
90 | */ |
||
91 | 51 | public function isError() |
|
95 | |||
96 | /** |
||
97 | * @param $key |
||
98 | * @param null $default |
||
99 | * @return array|mixed|null |
||
100 | */ |
||
101 | 36 | public function get($key, $default = null) |
|
114 | |||
115 | /** |
||
116 | * @param $array |
||
117 | * @param $key |
||
118 | * @return bool |
||
119 | */ |
||
120 | 36 | public function exists($array, $key) |
|
130 | } |
||
131 |