| 1 | <?php |
||
| 13 | class ApiController extends Controller |
||
| 14 | { |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @var int |
||
| 18 | */ |
||
| 19 | protected $statusCode = 200; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @return mixed |
||
| 23 | */ |
||
| 24 | public function getStatusCode() |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @param mixed $statusCode |
||
| 31 | * return $this |
||
| 32 | */ |
||
| 33 | public function setStatusCode($statusCode) |
||
| 39 | |||
| 40 | /** |
||
| 41 | * @param string $message |
||
| 42 | * @return mixed |
||
| 43 | */ |
||
| 44 | public function respondNotFound($message = 'Not Found!') |
||
| 48 | |||
| 49 | |||
| 50 | /** |
||
| 51 | * @param string $message |
||
| 52 | * @return mixed |
||
| 53 | */ |
||
| 54 | public function respondInternalError($message = 'Internal Error') |
||
| 58 | |||
| 59 | /** |
||
| 60 | * @param $data |
||
| 61 | * @param array $headers |
||
| 62 | * @return mixed |
||
| 63 | */ |
||
| 64 | public function respond($data, $headers = []) |
||
| 68 | |||
| 69 | /** |
||
| 70 | * @param $message |
||
| 71 | * @return mixed |
||
| 72 | */ |
||
| 73 | public function respondWithError($message) |
||
| 85 | |||
| 86 | /** |
||
| 87 | * @return mixed |
||
| 88 | */ |
||
| 89 | protected function respondCreated($message) |
||
| 96 | |||
| 97 | } |