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