| 1 | <?php |
||
| 7 | class Response implements JsonSerializable |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * @var int |
||
| 11 | */ |
||
| 12 | protected $statusCode = 200; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * @var array|null |
||
| 16 | */ |
||
| 17 | protected $data = false; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @var string |
||
| 21 | */ |
||
| 22 | protected $statusText = 'success'; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @param int $statusCode |
||
| 26 | * @return $this |
||
| 27 | */ |
||
| 28 | public function withStatusCode($statusCode) |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @param mixed $data |
||
| 37 | * @return $this |
||
| 38 | */ |
||
| 39 | public function withData($data) |
||
| 45 | |||
| 46 | /** |
||
| 47 | * @return bool |
||
| 48 | */ |
||
| 49 | public function hasData() |
||
| 53 | |||
| 54 | /** |
||
| 55 | * @return int |
||
| 56 | */ |
||
| 57 | public function getStatusCode() |
||
| 61 | |||
| 62 | /** |
||
| 63 | * @return string |
||
| 64 | */ |
||
| 65 | public function getStatusText() |
||
| 69 | |||
| 70 | /** |
||
| 71 | * @return array |
||
| 72 | */ |
||
| 73 | protected function getResponseData() |
||
| 77 | |||
| 78 | /** |
||
| 79 | * @return array |
||
| 80 | */ |
||
| 81 | public function toArray() |
||
| 93 | |||
| 94 | /** |
||
| 95 | * @return array |
||
| 96 | */ |
||
| 97 | public function jsonSerialize() |
||
| 101 | |||
| 102 | /** |
||
| 103 | * @param mixed $data |
||
| 104 | * @return mixed |
||
| 105 | */ |
||
| 106 | public function toJSendData($data) |
||
| 110 | } |
||
| 111 |