Conditions | 1 |
Paths | 1 |
Total Lines | 19 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 1 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
24 | 2 | public function __invoke(): Closure |
|
25 | { |
||
26 | /** |
||
27 | * @param callable(T, TKey, iterable<TKey, T>): bool ...$callbacks |
||
28 | * |
||
29 | * @return Closure(iterable<TKey, T>): Generator<int, iterable<TKey, T>> |
||
30 | */ |
||
31 | 2 | return static fn (callable ...$callbacks): Closure => |
|
32 | /** |
||
33 | * @param iterable<TKey, T> $iterable |
||
34 | * |
||
35 | * @return Generator<int, iterable<TKey, T>> |
||
36 | */ |
||
37 | 2 | static function (iterable $iterable) use ($callbacks): Generator { |
|
38 | 2 | $iteratorAggregate = (new CachingIteratorAggregate((new IterableIteratorAggregate($iterable))->getIterator())); |
|
39 | |||
40 | 2 | yield new ClosureIteratorAggregate((new Filter())()(...$callbacks), [$iteratorAggregate]); |
|
41 | |||
42 | 2 | yield new ClosureIteratorAggregate((new Reject())()(...$callbacks), [$iteratorAggregate]); |
|
43 | 2 | }; |
|
46 |