| Conditions | 3 |
| Paths | 3 |
| Total Lines | 14 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 35 | 232 | public static function create(Handler $handler, array $middlewares) : Handler |
|
| 36 | { |
||
| 37 | 232 | if (!$middlewares) { |
|
|
|
|||
| 38 | 232 | return $handler; |
|
| 39 | } |
||
| 40 | |||
| 41 | 8 | $middleware = \end($middlewares); |
|
| 42 | |||
| 43 | 8 | while ($middleware) { |
|
| 44 | 8 | $handler = new self($middleware, $handler); |
|
| 45 | 8 | $middleware = \prev($middlewares); |
|
| 46 | } |
||
| 47 | |||
| 48 | 8 | return $handler; |
|
| 49 | } |
||
| 66 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)or! empty(...)instead.