Conditions | 2 |
Paths | 1 |
Total Lines | 9 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
22 | 5 | public static function reverseSequence($length): Iterator |
|
23 | { |
||
24 | 5 | $current = $length - 1; |
|
25 | return new CallbackIterator(static function () use (& $current) { |
||
26 | 5 | if ($current === -1) { |
|
27 | 3 | return (new IterateResult())->setAsRunOut(); |
|
28 | } |
||
29 | |||
30 | 5 | return (new IterateResult())->setValue($current--); |
|
31 | 5 | }); |
|
34 |