| 1 | <?php |
||
| 19 | class ApiController extends Controller |
||
| 20 | { |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @var int |
||
| 24 | */ |
||
| 25 | protected $statusCode = 200; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @return mixed |
||
| 29 | */ |
||
| 30 | public function getStatusCode() |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @param mixed $statusCode |
||
| 37 | * return $this |
||
| 38 | */ |
||
| 39 | public function setStatusCode($statusCode) |
||
| 45 | |||
| 46 | /** |
||
| 47 | * @param string $message |
||
| 48 | * @return mixed |
||
| 49 | */ |
||
| 50 | public function respondNotFound($message = 'Not Found!') |
||
| 54 | |||
| 55 | |||
| 56 | /** |
||
| 57 | * @param string $message |
||
| 58 | * @return mixed |
||
| 59 | */ |
||
| 60 | public function respondInternalError($message = 'Internal Error') |
||
| 64 | |||
| 65 | /** |
||
| 66 | * @param $data |
||
| 67 | * @param array $headers |
||
| 68 | * @return mixed |
||
| 69 | */ |
||
| 70 | public function respond($data, $headers = []) |
||
| 74 | |||
| 75 | /** |
||
| 76 | * @param $message |
||
| 77 | * @return mixed |
||
| 78 | */ |
||
| 79 | public function respondWithError($message) |
||
| 91 | |||
| 92 | /** |
||
| 93 | * @return mixed |
||
| 94 | */ |
||
| 95 | protected function respondCreated($message) |
||
| 102 | |||
| 103 | } |