1 | <?php |
||
5 | class ValueFormatter |
||
6 | { |
||
7 | /** |
||
8 | * Evaluates if the given value is to be treated as empty. |
||
9 | * |
||
10 | * @param mixed $value |
||
11 | * |
||
12 | * @return bool |
||
13 | */ |
||
14 | 3 | public function isValueEmpty($value) |
|
18 | |||
19 | /** |
||
20 | * Get $value if not empty, $defaultValue otherwise. |
||
21 | * |
||
22 | * @param mixed $value |
||
23 | * @param mixed|null $defaultValue |
||
24 | * |
||
25 | * @return mixed|null |
||
26 | */ |
||
27 | 2 | public function getValue($value, $defaultValue = null) |
|
35 | |||
36 | /** |
||
37 | * Get formatted value base on type and format. |
||
38 | * |
||
39 | * @param string $type |
||
40 | * @param string $format |
||
41 | * @param mixed $value |
||
42 | * @param mixed|null $defaultValue |
||
43 | * |
||
44 | * @return mixed |
||
45 | */ |
||
46 | 1 | public function format($type, $format, $value, $defaultValue = null) |
|
56 | |||
57 | /** |
||
58 | * Format Integer. |
||
59 | * |
||
60 | * @param mixed $value |
||
61 | * @param mixed|null $format |
||
62 | * |
||
63 | * @return int |
||
64 | */ |
||
65 | 1 | private function formatInteger($value, $format = null) |
|
69 | |||
70 | /** |
||
71 | * Format Float. |
||
72 | * |
||
73 | * @param mixed $value |
||
74 | * @param mixed|null $format |
||
75 | * |
||
76 | * @return float |
||
77 | */ |
||
78 | 1 | private function formatFloat($value, $format = null) |
|
82 | |||
83 | /** |
||
84 | * Format String. |
||
85 | * |
||
86 | * @param mixed $value |
||
87 | * @param mixed|null $format |
||
88 | * |
||
89 | * @return string |
||
90 | */ |
||
91 | 1 | private function formatString($value, $format = null) |
|
95 | |||
96 | /** |
||
97 | * Format Boolean. |
||
98 | * |
||
99 | * @param mixed $value |
||
100 | * @param mixed|null $format |
||
101 | * |
||
102 | * @return bool |
||
103 | */ |
||
104 | 1 | private function formatBoolean($value, $format = null) |
|
108 | |||
109 | /** |
||
110 | * Format Number. |
||
111 | * |
||
112 | * @param mixed $value |
||
113 | * @param mixed|null $format |
||
114 | * |
||
115 | * @return string |
||
116 | */ |
||
117 | 1 | private function formatNumber($value, $format = null) |
|
130 | |||
131 | /** |
||
132 | * Format Datetime. |
||
133 | * |
||
134 | * @param mixed $value |
||
135 | * @param mixed|null $format |
||
136 | * |
||
137 | * @return \DateTime|string |
||
138 | */ |
||
139 | 1 | private function formatDatetime($value, $format = null) |
|
155 | } |
||
156 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.