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