Conditions | 3 |
Paths | 3 |
Total Lines | 17 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
30 | public function handle(ServerRequestInterface $request): ResponseInterface |
||
31 | { |
||
32 | if (null === $this->queue) { |
||
33 | throw new MiddlewareAlreadyCalledException(); |
||
34 | } |
||
35 | |||
36 | if ($this->queue->isEmpty()) { |
||
37 | return $this->handler->handle($request); |
||
38 | } |
||
39 | |||
40 | /** @var MiddlewareInterface $middleware */ |
||
41 | $middleware = $this->queue->dequeue(); |
||
42 | |||
43 | $next = clone $this; |
||
44 | $this->queue = null; |
||
45 | |||
46 | return $middleware->process($request, $next); |
||
47 | } |
||
48 | } |