Conditions | 3 |
Paths | 4 |
Total Lines | 12 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 3 |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
30 | 5 | public function handle(ParsedRoute $route) |
|
31 | { |
||
32 | 5 | $segments = explode("::", $route->controller()); |
|
33 | 5 | $controller = $segments[0]; |
|
34 | 5 | $action = count($segments) > 1 ? $segments[1] : "index"; |
|
35 | 5 | if (method_exists($controller, $action)) { |
|
36 | 4 | $params = [$this->request, new Response(), $route->params()]; |
|
37 | 4 | return call_user_func_array([new $controller(), $action], $params); |
|
38 | } else { |
||
39 | 1 | throw new RuntimeException("No method {$action} in controller {$segments[0]}"); |
|
40 | } |
||
41 | } |
||
42 | } |
||
43 |