| Conditions | 3 |
| Paths | 3 |
| Total Lines | 18 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 23 | private function createExecutionChain(array $middlewareList) |
||
| 24 | { |
||
| 25 | $lastCallable = function ($command) { |
||
| 26 | // the final callable is a no-op |
||
| 27 | }; |
||
| 28 | |||
| 29 | while ($middleware = array_pop($middlewareList)) { |
||
| 30 | if (! $middleware instanceof Middleware) { |
||
| 31 | throw InvalidMiddlewareException::forMiddleware($middleware); |
||
| 32 | } |
||
| 33 | |||
| 34 | $lastCallable = function ($command) use ($middleware, $lastCallable) { |
||
| 35 | return $middleware->execute($command, $lastCallable); |
||
| 36 | }; |
||
| 37 | } |
||
| 38 | |||
| 39 | return $lastCallable; |
||
| 40 | } |
||
| 41 | } |
||
| 42 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: