Conditions | 3 |
Paths | 2 |
Total Lines | 17 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
21 | 2 | public function process(ServerRequestInterface $request, RequestHandlerInterface $requestHandler): ResponseInterface |
|
22 | { |
||
23 | 2 | $routeMatch = $this->router->parseRequest($request); |
|
24 | |||
25 | 2 | if ($routeMatch->isMatch()) { |
|
26 | // Register Controller to the request object |
||
27 | 1 | $request = $request->withAttribute('controller', $routeMatch->getController()); |
|
28 | |||
29 | // Add all routing attributes to request |
||
30 | 1 | foreach ($routeMatch->getAttributes() as $key => $value) { |
|
31 | 1 | $request = $request->withAttribute($key, $value); |
|
32 | } |
||
33 | } else { |
||
34 | 1 | $request = $request->withAttribute('controller', $this->fallbackController); |
|
35 | } |
||
36 | |||
37 | 2 | return $requestHandler->handle($request); |
|
38 | } |
||
40 |