Conditions | 4 |
Paths | 4 |
Total Lines | 8 |
Code Lines | 4 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
19 | 2 | public function __construct(private readonly float $weight, ?RandomizerInterface $randomizer = null, private readonly mixed $default = null) |
|
20 | { |
||
21 | 2 | if ($randomizer === null) { |
|
22 | 2 | $this->randomizer = new Randomizer(); |
|
23 | } |
||
24 | |||
25 | 2 | if ($this->weight < 0 || $this->weight > 1) { |
|
26 | 1 | throw new \InvalidArgumentException('Weight should be a float between 0 and 1'); |
|
27 | } |
||
39 |