Conditions | 1 |
Paths | 1 |
Total Lines | 13 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 1 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
21 | 2 | public function __invoke(): Closure |
|
22 | { |
||
23 | 2 | return |
|
24 | /** |
||
25 | * @return Closure(iterable<TKey, T>): Generator<TKey, T> |
||
26 | */ |
||
27 | 2 | static function (float $probability): Closure { |
|
28 | 2 | $filter = (new Filter())()( |
|
29 | 2 | static fn (): bool => (random_int(0, mt_getrandmax()) / mt_getrandmax()) < $probability |
|
30 | 2 | ); |
|
31 | |||
32 | // Point free style. |
||
33 | 2 | return $filter; |
|
34 | 2 | }; |
|
37 |