Conditions | 2 |
Paths | 1 |
Total Lines | 28 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 2 |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
23 | 216 | public function __invoke(): Closure |
|
24 | { |
||
25 | 216 | return |
|
26 | /** |
||
27 | * @param callable(T, TKey, iterable<TKey, T>): bool ...$callbacks |
||
28 | * |
||
29 | * @return Closure(iterable<TKey, T>): Generator<TKey, T> |
||
30 | */ |
||
31 | 216 | static fn (callable ...$callbacks): Closure => |
|
32 | /** |
||
33 | * @param iterable<TKey, T> $iterable |
||
34 | * |
||
35 | * @return Generator<TKey, T> |
||
36 | */ |
||
37 | 216 | static function (iterable $iterable) use ($callbacks): Generator { |
|
38 | 216 | $defaultCallback = |
|
39 | /** |
||
40 | * @param T $value |
||
41 | * |
||
42 | * @return T |
||
43 | */ |
||
44 | 216 | static fn (mixed $value): mixed => $value; |
|
45 | |||
46 | 216 | $callback = [] === $callbacks ? |
|
47 | 2 | $defaultCallback : |
|
48 | 214 | CallbacksArrayReducer::or()($callbacks); |
|
49 | |||
50 | 216 | yield from new FilterIterableAggregate($iterable, $callback); |
|
51 | 216 | }; |
|
54 |