Conditions | 3 |
Paths | 3 |
Total Lines | 16 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
20 | 3 | public function process(ServerRequestInterface $request, RequestHandlerInterface $requestHandler): ResponseInterface |
|
21 | { |
||
22 | 3 | $controller = $request->getAttribute('controller'); |
|
23 | |||
24 | 3 | if ($controller instanceof RequestValidatorInterface) { |
|
25 | // Execute the request-validator from the controller |
||
26 | try { |
||
27 | 2 | $controller->validateRequest($request); |
|
28 | 1 | } catch (ValidationFailedException $exception) { |
|
29 | // Hand of to error-handler on failure |
||
30 | 1 | return ($this->errorHandler)($request, $exception); |
|
31 | } |
||
32 | } |
||
33 | |||
34 | // Filtered and validated (if applicable), let's continue on |
||
35 | 2 | return $requestHandler->handle($request); |
|
36 | } |
||
38 |