Conditions | 3 |
Paths | 3 |
Total Lines | 16 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 3.0123 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
32 | 6 | protected function getNormalizedValue(string $value) |
|
33 | { |
||
34 | 6 | if (!is_numeric($value)) { |
|
35 | return 0; |
||
36 | } |
||
37 | |||
38 | 6 | $value = trim($value); |
|
39 | 6 | $value = ltrim($value, '0'); |
|
40 | |||
41 | 6 | $numberValue = json_decode($value); |
|
42 | |||
43 | 6 | if ($this->decimals !== null) { |
|
44 | 1 | $numberValue = round($numberValue, $this->decimals); |
|
45 | } |
||
46 | |||
47 | 6 | return $numberValue; |
|
48 | } |
||
50 |