| Conditions | 3 |
| Paths | 3 |
| Total Lines | 19 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 33 | 5 | public function handle(ServerRequestInterface $request) : ResponseInterface |
|
| 34 | { |
||
| 35 | 5 | $handler = clone $this; |
|
| 36 | |||
| 37 | 5 | if (null === key($handler->middlewares)) { |
|
| 38 | 2 | return $this->responseFactory->createResponse(); |
|
| 39 | } |
||
| 40 | |||
| 41 | 4 | $middleware = current($handler->middlewares); |
|
| 42 | 4 | next($handler->middlewares); |
|
| 43 | |||
| 44 | 4 | $response = $middleware->process($request, $handler); |
|
| 45 | |||
| 46 | 4 | if (!$response instanceof ResponseInterface) { |
|
| 47 | 1 | throw InvalidMiddlewareResponseException::forMiddleware($middleware); |
|
| 48 | } |
||
| 49 | |||
| 50 | 3 | return $response; |
|
| 51 | } |
||
| 52 | } |
||
| 53 |