| 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 |
||
| 27 | 6 | protected function getNormalizedValue(string $value) |
|
| 28 | { |
||
| 29 | 6 | if (!is_numeric($value)) { |
|
| 30 | return 0; |
||
| 31 | } |
||
| 32 | |||
| 33 | 6 | $value = trim($value); |
|
| 34 | 6 | $value = ltrim($value, '0'); |
|
| 35 | |||
| 36 | 6 | $numberValue = json_decode($value); |
|
| 37 | |||
| 38 | 6 | if ($this->scale !== null) { |
|
| 39 | 1 | $numberValue = round($numberValue, $this->scale); |
|
| 40 | } |
||
| 41 | |||
| 42 | 6 | return $numberValue; |
|
| 43 | } |
||
| 45 |