Conditions | 6 |
Paths | 5 |
Total Lines | 32 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
19 | private function filterOneValue($value) |
||
20 | { |
||
21 | if(! is_string($value)) |
||
22 | { |
||
23 | return $value; |
||
24 | } |
||
25 | |||
26 | $value = trim($value); |
||
27 | |||
28 | $knowValues = array( |
||
29 | 'true' => true, |
||
30 | 'false' => false, |
||
31 | 'null' => null |
||
32 | ); |
||
33 | |||
34 | if(array_key_exists(strtolower($value), $knowValues)) |
||
35 | { |
||
36 | return $knowValues[strtolower($value)]; |
||
37 | } |
||
38 | |||
39 | if(is_numeric($value)) |
||
40 | { |
||
41 | if(stripos($value, '.') !== false && floatval($value) == $value) |
||
42 | { |
||
43 | return floatval($value); |
||
44 | } |
||
45 | |||
46 | return intval($value); |
||
47 | } |
||
48 | |||
49 | return $value; |
||
50 | } |
||
51 | |||
71 | } |