Total Complexity | 5 |
Total Lines | 38 |
Duplicated Lines | 0 % |
Coverage | 78.56% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | class NumberNormalizer extends AbstractNormalizer |
||
11 | { |
||
12 | private ?int $decimals = null; |
||
13 | |||
14 | /** |
||
15 | * Sets the amount of decimal places to round to. Defaults to null which performs no rounding. |
||
16 | */ |
||
17 | 1 | public function setDecimals(?int $decimals = null): self |
|
18 | { |
||
19 | 1 | $this->decimals = $decimals; |
|
20 | |||
21 | 1 | return $this; |
|
22 | } |
||
23 | |||
24 | public function getDecimals(): ?int |
||
25 | { |
||
26 | return $this->decimals; |
||
27 | } |
||
28 | |||
29 | /** |
||
30 | * @return float|int |
||
31 | */ |
||
32 | 6 | protected function getNormalizedValue(string $value) |
|
48 | } |
||
49 | } |
||
50 |