Conditions | 2 |
Paths | 2 |
Total Lines | 12 |
Code Lines | 5 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
27 | 9 | public function __construct( |
|
28 | Status $status = null, |
||
29 | iterable $observers = [], |
||
30 | float $ratio = 0.01, |
||
31 | int $precision = 2 |
||
32 | ) { |
||
33 | 9 | parent::__construct($status, $observers); |
|
34 | 9 | if ($precision < 0) { |
|
35 | 1 | throw new InvalidArgumentException('Precision must be an positive integer'); |
|
36 | } |
||
37 | 8 | $this->precision = $precision; |
|
38 | 8 | $this->ratio = max(round($ratio, $this->precision), 10 ** (-$this->precision)); |
|
39 | } |
||
59 |