| 1 | <?php |
||
| 11 | class ApiController extends Controller |
||
| 12 | { |
||
| 13 | |||
| 14 | /** |
||
| 15 | * @var int |
||
| 16 | */ |
||
| 17 | protected $statusCode = 200; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @return mixed |
||
| 21 | */ |
||
| 22 | public function getStatusCode() |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @param mixed $statusCode |
||
| 29 | * return $this |
||
| 30 | */ |
||
| 31 | public function setStatusCode($statusCode) |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @param string $message |
||
| 40 | * @return mixed |
||
| 41 | */ |
||
| 42 | public function respondNotFound($message = 'Not Found!') |
||
| 46 | |||
| 47 | |||
| 48 | /** |
||
| 49 | * @param string $message |
||
| 50 | * @return mixed |
||
| 51 | */ |
||
| 52 | public function respondInternalError($message = 'Internal Error') |
||
| 56 | |||
| 57 | /** |
||
| 58 | * @param $data |
||
| 59 | * @param array $headers |
||
| 60 | * @return mixed |
||
| 61 | */ |
||
| 62 | public function respond($data, $headers = []) |
||
| 66 | |||
| 67 | /** |
||
| 68 | * @param $message |
||
| 69 | * @return mixed |
||
| 70 | */ |
||
| 71 | public function respondWithError($message) |
||
| 83 | |||
| 84 | /** |
||
| 85 | * @return mixed |
||
| 86 | */ |
||
| 87 | protected function respondCreated($message) |
||
| 94 | |||
| 95 | } |
||
| 96 |