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