| Conditions | 3 |
| Paths | 1 |
| Total Lines | 29 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | 2 | public function __invoke(): Closure |
|
| 22 | { |
||
| 23 | 2 | return |
|
| 24 | /** |
||
| 25 | * @return Closure(T): Closure(iterable<TKey, T>): Generator<int|TKey, T> |
||
| 26 | */ |
||
| 27 | 2 | static fn (int $size): Closure => |
|
| 28 | /** |
||
| 29 | * @param T $padValue |
||
| 30 | * |
||
| 31 | * @return Closure(iterable<TKey, T>): Generator<int|TKey, T> |
||
| 32 | */ |
||
| 33 | 2 | static fn (mixed $padValue): Closure => |
|
| 34 | /** |
||
| 35 | * @param iterable<TKey, T> $iterable |
||
| 36 | * |
||
| 37 | * @return Generator<int|TKey, T> |
||
| 38 | */ |
||
| 39 | 2 | static function (iterable $iterable) use ($size, $padValue): Generator { |
|
| 40 | 2 | $y = 0; |
|
| 41 | |||
| 42 | 2 | foreach ($iterable as $key => $value) { |
|
| 43 | 2 | ++$y; |
|
| 44 | |||
| 45 | 2 | yield $key => $value; |
|
| 46 | } |
||
| 47 | |||
| 48 | 2 | while ($y++ < $size) { |
|
| 49 | 2 | yield $padValue; |
|
| 50 | } |
||
| 54 |