| 1 | <?php |
||
| 8 | class ApiController extends Controller |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * @var int |
||
| 12 | */ |
||
| 13 | protected $statusCode = 200; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * @return mixed |
||
| 17 | */ |
||
| 18 | public function getStatusCode() |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @param mixed $statusCode |
||
| 25 | * return $this |
||
| 26 | */ |
||
| 27 | public function setStatusCode($statusCode) |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @param string $message |
||
| 36 | * |
||
| 37 | * @return mixed |
||
| 38 | */ |
||
| 39 | public function respondNotFound($message) |
||
| 43 | |||
| 44 | /** |
||
| 45 | * @param string $message |
||
| 46 | * |
||
| 47 | * @return mixed |
||
| 48 | */ |
||
| 49 | public function respondInternalError($message = 'Internal Error') |
||
| 53 | |||
| 54 | /** |
||
| 55 | * @param $data |
||
| 56 | * @param array $headers |
||
| 57 | * |
||
| 58 | * @return mixed |
||
| 59 | */ |
||
| 60 | public function respond($data, $headers = []) |
||
| 64 | |||
| 65 | /** |
||
| 66 | * @param $message |
||
| 67 | * |
||
| 68 | * @return mixed |
||
| 69 | */ |
||
| 70 | public function respondWithError($message) |
||
| 79 | |||
| 80 | /** |
||
| 81 | * @return mixed |
||
| 82 | */ |
||
| 83 | protected function respondCreated($message) |
||
| 90 | } |
||
| 91 |