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() |
|
58 | |||
59 | /** |
||
60 | * @return int |
||
61 | */ |
||
62 | 33 | public function getStatusCode() |
|
66 | |||
67 | /** |
||
68 | * @return array |
||
69 | */ |
||
70 | 30 | public function getData() |
|
74 | |||
75 | /** |
||
76 | * @return bool |
||
77 | */ |
||
78 | 51 | public function isError() |
|
82 | |||
83 | /** |
||
84 | * @param $key |
||
85 | * @param null $default |
||
86 | * @return array|mixed|null |
||
87 | */ |
||
88 | 36 | public function get($key, $default = null) |
|
101 | |||
102 | /** |
||
103 | * @param $array |
||
104 | * @param $key |
||
105 | * @return bool |
||
106 | */ |
||
107 | 36 | public function exists($array, $key) |
|
117 | } |
||
118 |