| Conditions | 4 |
| Paths | 4 |
| Total Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 28 | 7 | public function __invoke(ServerRequestInterface $request) |
|
| 29 | { |
||
| 30 | 7 | if (empty($this->middlewares)) { |
|
| 31 | 2 | return null; |
|
| 32 | } |
||
| 33 | |||
| 34 | 6 | $middleware = array_shift($this->middlewares); |
|
| 35 | 6 | $exceptionHandler = array_shift($this->exceptionHandlers); |
|
| 36 | |||
| 37 | try { |
||
| 38 | 6 | $response = $middleware($request, $this); |
|
| 39 | 2 | } catch (\Throwable $exception) { |
|
| 40 | 2 | if ($exceptionHandler === null) { |
|
| 41 | 1 | throw $exception; |
|
| 42 | } |
||
| 43 | |||
| 44 | 1 | $response = $exceptionHandler($exception); |
|
| 45 | } |
||
| 46 | |||
| 47 | 5 | return $response; |
|
| 48 | } |
||
| 49 | } |
||
| 50 |