| Conditions | 3 |
| Paths | 4 |
| Total Lines | 12 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | 4 | public function handle(ParsedRoute $route) |
|
| 16 | { |
||
| 17 | 4 | $segments = explode("::", $route->controller()); |
|
| 18 | 4 | $controller = $segments[0]; |
|
| 19 | 4 | $action = count($segments) > 1 ? $segments[1] : "index"; |
|
| 20 | 4 | if (method_exists($controller, $action)) { |
|
| 21 | 3 | $params = [$route->params()]; |
|
| 22 | 3 | return call_user_func_array([new $controller, $action], $params); |
|
| 23 | } else { |
||
| 24 | 1 | throw new RuntimeException("No method {$action} in controller {$segments[0]}"); |
|
| 25 | } |
||
| 26 | } |
||
| 27 | } |
||
| 28 |