Conditions | 4 |
Paths | 6 |
Total Lines | 22 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php declare(strict_types = 1); |
||
23 | public function execute(ServerRequestInterface $request) : ResponseInterface |
||
24 | { |
||
25 | $controller = $request->getAttribute('controller'); |
||
26 | |||
27 | if ($controller instanceof RequestFilterInterface) { |
||
28 | // Execute the request-filter from the controller |
||
29 | $request = $controller->filterRequest($request); |
||
30 | } |
||
31 | |||
32 | if ($controller instanceof RequestValidatorInterface) { |
||
33 | // Execute the request-validator from the controller |
||
34 | try { |
||
35 | $controller->validateRequest($request); |
||
36 | } catch (ValidationFailedException $exception) { |
||
37 | // Hand of to error-handler on failure |
||
38 | return ($this->errorHandler)($request, $exception); |
||
39 | } |
||
40 | } |
||
41 | |||
42 | // Filtered and validated (if applicable), let's continue on |
||
43 | return $this->application->execute($request); |
||
44 | } |
||
45 | } |
||
46 |