bakaphp /
phalcon-api
| 1 | <?php |
||
|
0 ignored issues
–
show
Coding Style
introduced
by
Loading history...
|
|||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace Gewaer\Middleware; |
||
| 6 | |||
| 7 | use Gewaer\Http\Response; |
||
| 8 | use Gewaer\Traits\ResponseTrait; |
||
| 9 | use Phalcon\Mvc\Micro; |
||
| 10 | use Phalcon\Mvc\Micro\MiddlewareInterface; |
||
| 11 | use Phalcon\Mvc\User\Plugin; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * Class NotFoundMiddleware |
||
| 15 | * |
||
| 16 | * @package Gewaer\Middleware |
||
| 17 | * |
||
| 18 | * @property Micro $application |
||
| 19 | * @property Response $response |
||
| 20 | */ |
||
| 21 | class NotFoundMiddleware extends Plugin implements MiddlewareInterface |
||
| 22 | {
|
||
| 23 | use ResponseTrait; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * Checks if the resource was found |
||
| 27 | */ |
||
| 28 | public function beforeNotFound() |
||
| 29 | {
|
||
| 30 | $apiResponse = new Response(); |
||
| 31 | $this->halt( |
||
| 32 | $this->application, |
||
| 33 | Response::NOT_FOUND, |
||
| 34 | $apiResponse->getHttpCodeDescription($apiResponse::NOT_FOUND) |
||
| 35 | ); |
||
| 36 | |||
| 37 | return false; |
||
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * Call me |
||
| 42 | * |
||
| 43 | * @param Micro $api |
||
| 44 | * |
||
| 45 | * @return bool |
||
| 46 | */ |
||
| 47 | public function call(Micro $api) |
||
| 48 | {
|
||
| 49 | return true; |
||
| 50 | } |
||
| 51 | } |
||
| 52 |