Conditions | 3 |
Paths | 3 |
Total Lines | 13 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3.0175 |
Changes | 0 |
1 | <?php |
||
28 | 61 | private function createExecutionChain($middlewareList) |
|
29 | { |
||
30 | $lastCallable = function () {}; // Last callable is a NO-OP |
||
31 | 61 | while ($middleware = array_pop($middlewareList)) { |
|
32 | 61 | if (! $middleware instanceof ErrorHandlerMiddlewareInterface) { |
|
33 | throw InvalidErrorHandlerMiddlewareException::forMiddleware($middleware); |
||
34 | } |
||
35 | 61 | $lastCallable = function ($error, ExecutionContext $executionContext) use ($middleware, $lastCallable) { |
|
36 | 19 | return $middleware->execute($error, $executionContext, $lastCallable); |
|
37 | 61 | }; |
|
38 | } |
||
39 | 61 | return $lastCallable; |
|
40 | } |
||
41 | } |
||
42 |