| 1 | <?php |
||
| 10 | abstract class BaseController |
||
| 11 | { |
||
| 12 | protected $logger; |
||
| 13 | |||
| 14 | protected $database; |
||
| 15 | |||
| 16 | protected $request; |
||
| 17 | |||
| 18 | protected $response; |
||
| 19 | |||
| 20 | protected $args; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @param Request $request |
||
| 24 | * @param Response $response |
||
| 25 | * @param array $args |
||
| 26 | */ |
||
| 27 | protected function setParams($request, $response, $args) |
||
| 34 | |||
| 35 | /** |
||
| 36 | * Send response with json as standard format. |
||
| 37 | * |
||
| 38 | * @param string $status |
||
| 39 | * @param mixed $message |
||
| 40 | * @param int $code |
||
| 41 | * @return array $response |
||
| 42 | */ |
||
| 43 | protected function jsonResponse($status, $message, $code) |
||
| 54 | |||
| 55 | /** |
||
| 56 | * Log each request. |
||
| 57 | */ |
||
| 58 | protected function logRequest() |
||
| 70 | |||
| 71 | /** |
||
| 72 | * Log each response. |
||
| 73 | * |
||
| 74 | * @param array $response |
||
| 75 | */ |
||
| 76 | protected function logResponse($response) |
||
| 84 | } |
||
| 85 |