| Conditions | 2 |
| Paths | 2 |
| Total Lines | 13 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | 3 | public function handleRequest(RequestInterface $request): ResponseInterface |
|
| 19 | { |
||
| 20 | 3 | $attributes = $this->router->route($request); |
|
| 21 | 3 | $controller = $attributes['controller'].'Controller'; |
|
| 22 | 3 | $action = $attributes['action'].'Action'; |
|
| 23 | |||
| 24 | 3 | $namespace = '\\App\\Controller\\'; |
|
| 25 | 3 | if (!class_exists($namespace.$controller)) { |
|
| 26 | 3 | $namespace = '\\Lib\\Controller\\'; |
|
| 27 | } |
||
| 28 | 3 | $response = ($namespace.$controller)::create()->$action($request, ...$attributes['params']); |
|
| 29 | |||
| 30 | 3 | return $response; |
|
| 31 | } |
||
| 33 |