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