| Conditions | 3 |
| Paths | 2 |
| Total Lines | 29 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 14 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 19 | public function getCallable(Route $route, array $vars) |
||
| 20 | { |
||
| 21 | 12 | return function (ServerRequestInterface $request, ResponseInterface $response, callable $next) use ($route, $vars) { |
|
| 22 | $response = call_user_func_array($route->getCallable(), [$request, $response, $vars]); |
||
| 23 | |||
| 24 | 12 | if (! $response instanceof ResponseInterface) { |
|
| 25 | throw new RuntimeException( |
||
| 26 | 12 | 'Route callables must return an instance of (Psr\Http\Message\ResponseInterface)' |
|
| 27 | ); |
||
| 28 | 9 | } |
|
| 29 | 3 | ||
| 30 | return $next($request, $response); |
||
| 31 | 3 | }; |
|
| 32 | } |
||
| 33 | |||
| 34 | 6 | /** |
|
| 35 | 12 | * {@inheritdoc} |
|
| 36 | */ |
||
| 37 | 12 | public function getNotFoundDecorator(NotFoundException $exception) |
|
| 38 | { |
||
| 39 | throw $exception; |
||
| 40 | 12 | } |
|
| 41 | |||
| 42 | 12 | /** |
|
| 43 | 3 | * {@inheritdoc} |
|
| 44 | 12 | */ |
|
| 45 | public function getMethodNotAllowedDecorator(MethodNotAllowedException $exception) |
||
| 46 | 12 | { |
|
| 47 | throw $exception; |
||
| 48 | } |
||
| 58 |