Commit 8663be10ca3190d446eb12ea6c366d7dde81c4c2

Authored by Mihail
1 parent a3b2aa93

simplification convert to int and float methods of converter

Showing 1 changed file with 2 additions and 11 deletions   Show diff stats
@@ -23,12 +23,7 @@ class Converter implements ConverterInterface @@ -23,12 +23,7 @@ class Converter implements ConverterInterface
23 if ($value == '') { 23 if ($value == '') {
24 $value = 0; 24 $value = 0;
25 } 25 }
26 - $value = trim(str_replace(",", ".", $value));  
27 - $value = preg_replace("/[^0-9.]+/", "", strtoupper($value));  
28 26
29 - if ($value == '') {  
30 - return '';  
31 - }  
32 $value = round((float)$value, 2); 27 $value = round((float)$value, 2);
33 28
34 return $value; 29 return $value;
@@ -39,12 +34,8 @@ class Converter implements ConverterInterface @@ -39,12 +34,8 @@ class Converter implements ConverterInterface
39 if ($value == '') { 34 if ($value == '') {
40 $value = 0; 35 $value = 0;
41 } 36 }
42 - $value = trim(str_replace(",", ".", $value));  
43 - $value = preg_replace("/[^0-9.]+/", "", strtoupper($value));  
44 - if ($value == '') {  
45 - return '';  
46 - }  
47 - $value = round((int)$value, 2); 37 +
  38 + $value = (int)$value;
48 39
49 return $value; 40 return $value;
50 } 41 }