Total Complexity | 14 |
Total Lines | 52 |
Duplicated Lines | 0 % |
Coverage | 75% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
22 | class DefaultGetMapper implements FieldGetMapper |
||
23 | { |
||
24 | public static function getStringValue($value): ?string |
||
25 | { |
||
26 | return $value; |
||
27 | } |
||
28 | |||
29 | |||
30 | 16 | public static function getBooleanValue($value): bool |
|
33 | } |
||
34 | |||
35 | 19 | public static function getDecimalValue($value): ?float |
|
36 | { |
||
37 | 19 | return floatval($value); |
|
38 | } |
||
39 | |||
40 | 64 | public static function getIntegerValue($value): ?int |
|
41 | { |
||
42 | 64 | return intval($value); |
|
43 | } |
||
44 | |||
45 | public static function getDateValue($value) |
||
46 | { |
||
47 | return $value; |
||
48 | } |
||
49 | |||
50 | 33 | public static function getTimestampValue($value): ?int |
|
51 | { |
||
52 | 33 | if ($value && is_string($value) && $value != '0000-00-00 00:00:00') { |
|
53 | 33 | return strtotime($value); |
|
54 | 4 | } elseif (is_integer($value)) { |
|
55 | 4 | return $value; |
|
56 | } |
||
57 | return null; |
||
58 | } |
||
59 | 16 | public static function getSerializedValue($value) |
|
65 | } |
||
66 | } |
||
67 | |||
68 | 16 | public static function getListValue($value, ?string $delimiter = ','): array |
|
69 | { |
||
70 | 16 | if (is_array($value)) { |
|
76 |