| Conditions | 3 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php declare(strict_types=1); |
||
| 36 | 17 | public function handle(ServerRequestInterface $request) : ResponseInterface |
|
| 37 | { |
||
| 38 | 17 | if ($this->middlewareStack === null) { |
|
| 39 | 1 | throw new \LogicException('Next handler already called'); |
|
| 40 | } |
||
| 41 | |||
| 42 | 17 | if (empty($this->middlewareStack)) { |
|
| 43 | 15 | return $this->handler->handle($request); |
|
| 44 | } |
||
| 45 | |||
| 46 | 6 | $middleware = array_shift($this->middlewareStack); |
|
| 47 | 6 | $next = clone $this; |
|
| 48 | 6 | $this->middlewareStack = null; |
|
| 49 | |||
| 50 | 6 | return $middleware->process($request, $next); |
|
| 51 | } |
||
| 53 |