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