Conditions | 3 |
Paths | 3 |
Total Lines | 14 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php declare(strict_types=1); |
||
20 | 4 | public function handle(AuthorizationRequestInterface $request): AuthorizationResponseInterface |
|
21 | { |
||
22 | 4 | if ($this->queue->count() === 0) { |
|
23 | 1 | throw new \RuntimeException('No more handlers to call on.'); |
|
24 | } |
||
25 | 3 | if ($this->called) { |
|
26 | 1 | throw new \RuntimeException('Already processed, cannot be ran twice.'); |
|
27 | } |
||
28 | |||
29 | /** @var AuthorizationMiddlewareInterface $next */ |
||
30 | 3 | $next = $this->queue->dequeue(); |
|
31 | 3 | $this->called = true; |
|
32 | |||
33 | 3 | return $next->process($request, new self($this->queue)); |
|
34 | } |
||
36 |