Conditions | 3 |
Paths | 3 |
Total Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3.0175 |
Changes | 0 |
1 | <?php declare(strict_types = 1); |
||
22 | 4 | public function handle(ServerRequestInterface $request): ResponseInterface |
|
23 | { |
||
24 | 4 | if ($this->stack->count() === 0) { |
|
25 | 2 | throw new \RuntimeException('No more middleware\'s to call on.'); |
|
26 | } |
||
27 | 4 | if ($this->called) { |
|
28 | throw new \RuntimeException('Already processed, cannot be ran twice.'); |
||
29 | } |
||
30 | |||
31 | /** @var MiddlewareInterface $next */ |
||
32 | 4 | $next = $this->stack->pop(); |
|
33 | 4 | $this->called = true; |
|
34 | |||
35 | 4 | return $next->process($request, new self($this->stack)); |
|
36 | } |
||
37 | } |
||
38 |