jetfirephp /
routing
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | use JetFire\Routing\RouteCollection; |
||
| 4 | |||
| 5 | require __DIR__.'/Autoload.php'; |
||
| 6 | |||
| 7 | $autoload = new Autoload(); |
||
| 8 | $autoload->addNamespace('JetFire\Routing',[ |
||
| 9 | __DIR__.'/src/Routing', |
||
| 10 | __DIR__.'/', |
||
| 11 | ]); |
||
| 12 | $autoload->addClass('Normal1Controller',__DIR__.'/Block1/Normal1Controller.php'); |
||
| 13 | $autoload->register(); |
||
| 14 | |||
| 15 | |||
| 16 | // Create RouteCollection instance |
||
| 17 | $collection = new RouteCollection(); |
||
| 18 | $collection->addRoutes(__DIR__.'/Block1/routes.php',['view_dir'=>__DIR__.'/Block1/Views','prefix'=>'block']); |
||
| 19 | $router = new \JetFire\Routing\Router($collection); |
||
| 20 | $matcher = new \JetFire\Routing\Matcher\ArrayMatcher($router); |
||
| 21 | |||
| 22 | $router->addMatcher($matcher); |
||
|
0 ignored issues
–
show
|
|||
| 23 | $router->setResponses([ |
||
| 24 | // you can use a closure to handle error |
||
| 25 | '404' => function(){ |
||
| 26 | return '404'; |
||
| 27 | }, |
||
| 28 | '405' => function(){ |
||
| 29 | return '405'; |
||
| 30 | } |
||
| 31 | ]); |
||
| 32 | // Run it! |
||
| 33 | $router->run(); |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: