Total Complexity | 5 |
Total Lines | 36 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
25 | trait Mailcode_Traits_Commands_IfNumber |
||
26 | { |
||
27 | use Mailcode_Traits_Commands_Validation_Variable; |
||
28 | use Mailcode_Traits_Commands_Validation_Value; |
||
29 | |||
30 | protected function getValidations() : array |
||
31 | { |
||
32 | return array( |
||
33 | 'variable', |
||
34 | 'value', |
||
35 | 'numeric_value' |
||
36 | ); |
||
37 | } |
||
38 | |||
39 | public function getNumber() : float |
||
40 | { |
||
41 | return floatval($this->getRawNumber()); |
||
42 | } |
||
43 | |||
44 | protected function getRawNumber() : string |
||
45 | { |
||
46 | return str_replace(array(',', ' '), array('.', ''), trim($this->getValue(), '"')); |
||
47 | } |
||
48 | |||
49 | protected function validateSyntax_numeric_value(): void |
||
61 | ); |
||
62 | } |
||
63 | } |
||
64 | } |
||
65 |