Conditions | 2 |
Paths | 1 |
Total Lines | 17 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
29 | 3 | public static function of(): Closure |
|
30 | { |
||
31 | return |
||
32 | /** |
||
33 | * @param callable(U, T, TKey, iterable<TKey, T>): U $callable |
||
34 | */ |
||
35 | 3 | static fn (callable $callable): Closure => |
|
36 | /** |
||
37 | * @param U $accumulator |
||
38 | */ |
||
39 | 3 | static fn ($accumulator): Closure => |
|
40 | /** |
||
41 | * @param iterable<TKey, T> $iterable |
||
42 | */ |
||
43 | 3 | static function (iterable $iterable) use ($callable, $accumulator): Generator { |
|
44 | 3 | foreach ($iterable as $key => $item) { |
|
45 | 3 | yield $key => $accumulator = $callable($accumulator, $item, $key, $iterable); |
|
46 | } |
||
50 |