Conditions | 1 |
Paths | 1 |
Total Lines | 9 |
Code Lines | 4 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 1 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
33 | 1 | public function on(iterable $collection): Closure |
|
34 | { |
||
35 | 1 | $probability = $this->probability; |
|
36 | |||
37 | $callback = static function ($item) use ($probability): bool { |
||
|
|||
38 | 1 | return (mt_rand() / mt_getrandmax()) < $probability; |
|
39 | 1 | }; |
|
40 | |||
41 | 1 | return (new Filter($callback))->on($collection); |
|
42 | } |
||
44 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.