Conditions | 2 |
Paths | 2 |
Total Lines | 34 |
Code Lines | 21 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
28 | public function catchAll(...$args) : object |
||
|
|||
29 | { |
||
30 | $pages = [ |
||
31 | "403" => [ |
||
32 | "403: Forbidden", |
||
33 | "You are not permitted to do this." |
||
34 | ], |
||
35 | "404" => [ |
||
36 | "404: Not Found", |
||
37 | "The page you are looking for is not here." |
||
38 | ], |
||
39 | "500" => [ |
||
40 | "500: Internal Server Error", |
||
41 | "An unexpected condition was encountered." |
||
42 | ], |
||
43 | ]; |
||
44 | |||
45 | $path = $this->di->get("router")->getMatchedPath(); |
||
46 | if (!array_key_exists($path, $pages)) { |
||
47 | throw new NotFoundException("Internal route for '$path' is not found."); |
||
48 | } |
||
49 | |||
50 | $page = $this->di->get("page"); |
||
51 | $page->add( |
||
52 | "anax/v2/error/default", |
||
53 | [ |
||
54 | "header" => $pages[$path][0], |
||
55 | "text" => $pages[$path][1], |
||
56 | ] |
||
57 | ); |
||
58 | |||
59 | return $page->render([ |
||
60 | "title" => $pages[$path][0] |
||
61 | ], $path); |
||
62 | } |
||
64 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.