1 | <?php |
||
13 | class ErrorController extends AbstractController |
||
14 | { |
||
15 | /** |
||
16 | * @var XkcdRepository |
||
17 | */ |
||
18 | private $xkcdRepository; |
||
19 | |||
20 | /** |
||
21 | * ErrorController constructor. |
||
22 | * |
||
23 | * @param XkcdRepository $xkcdRepository |
||
24 | */ |
||
25 | public function __construct(XkcdRepository $xkcdRepository) |
||
29 | |||
30 | /** |
||
31 | * Handling 404 Not found. |
||
32 | * |
||
33 | * @param Request $request |
||
34 | * @param Response $response |
||
35 | * |
||
36 | * @return Response |
||
37 | */ |
||
38 | public function notFound(Request $request, Response $response): Response |
||
42 | |||
43 | /** |
||
44 | * Handling 500 Internal server error. |
||
45 | * |
||
46 | * @param Request $request |
||
47 | * @param Response $response |
||
48 | * @param Throwable $exception |
||
49 | * |
||
50 | * @return Response |
||
51 | */ |
||
52 | public function error(Request $request, Response $response, Throwable $exception): Response |
||
56 | |||
57 | /** |
||
58 | * Takes care of all common things to these error pages, such as image from xkcd. |
||
59 | * |
||
60 | * @param Response $response |
||
61 | * @param int $error |
||
62 | * |
||
63 | * @return Response |
||
64 | */ |
||
65 | private function render(Response $response, int $error): Response |
||
73 | } |
||
74 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.