| Conditions | 3 |
| Paths | 2 |
| Total Lines | 21 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 19 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | 50 | public function normalize(mixed $options, mixed $value): string |
|
| 8 | { |
||
| 9 | 50 | $preform = \strval( |
|
| 10 | 50 | \preg_replace( |
|
| 11 | 50 | '/[^0-9,.-]/', |
|
| 12 | 50 | '', |
|
| 13 | 50 | \strval($value), |
|
| 14 | 50 | ), |
|
| 15 | 50 | ); |
|
| 16 | 50 | if ($this->nullable && empty(\strlen($preform))) { |
|
| 17 | 1 | return ''; |
|
| 18 | } |
||
| 19 | 50 | return \str_replace( |
|
| 20 | 50 | ',', |
|
| 21 | 50 | '.', |
|
| 22 | 50 | \strval( |
|
| 23 | 50 | \floatval( |
|
| 24 | 50 | \str_replace( |
|
| 25 | 50 | ',', |
|
| 26 | 50 | '.', |
|
| 27 | 50 | $preform, |
|
| 28 | 50 | ), |
|
| 34 |