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