Conditions | 3 |
Paths | 1 |
Total Lines | 22 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 9 |
CRAP Score | 3 |
Changes | 3 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
22 | 4 | public function __invoke(): Closure |
|
23 | { |
||
24 | 4 | return |
|
25 | /** |
||
26 | * @param callable(T, TKey, iterable<TKey, T>): bool ...$callbacks |
||
27 | * |
||
28 | * @return Closure(iterable<TKey, T>): Generator<TKey, T> |
||
29 | */ |
||
30 | 4 | static fn (callable ...$callbacks): Closure => |
|
31 | /** |
||
32 | * @param iterable<TKey, T> $iterable |
||
33 | * |
||
34 | * @return Generator<TKey, T> |
||
35 | */ |
||
36 | 4 | static function (iterable $iterable) use ($callbacks): Generator { |
|
37 | 4 | $callback = CallbacksArrayReducer::or()($callbacks); |
|
38 | |||
39 | 4 | foreach ($iterable as $key => $current) { |
|
40 | 4 | yield $key => $current; |
|
41 | |||
42 | 4 | if ($callback($current, $key, $iterable)) { |
|
43 | 4 | break; |
|
44 | } |
||
49 |