1 | <?php |
||
15 | class Tools { |
||
16 | |||
17 | /** |
||
18 | * Returns TRUE if filter exists or FALSE otherwise. |
||
19 | * |
||
20 | * @param string $filterName Name of the filter field. |
||
21 | * @return bool |
||
22 | */ |
||
23 | public static function isFilterExists($filterName) { |
||
26 | |||
27 | /** |
||
28 | * Returns global filter value if exists. |
||
29 | * |
||
30 | * @global array $_FILTER Global filters array. |
||
31 | * @param string $filterName Name of the filter field. |
||
32 | * @param mixed $defaultValue Default value if value doesn't exist. |
||
33 | * |
||
34 | * @return mixed |
||
35 | */ |
||
36 | public static function getFilterValue($filterName, $defaultValue = null) { |
||
41 | |||
42 | /** |
||
43 | * Checks if value is an integer or integer string. |
||
44 | * |
||
45 | * @param mixed $value Data. |
||
46 | * @return bool Returns TRUE if $input is a integer, FALSE otherwise. |
||
47 | */ |
||
48 | public static function isInteger($value) { |
||
60 | |||
61 | /** |
||
62 | * Check data for double. |
||
63 | * |
||
64 | * @param mixed $value Data. |
||
65 | * @return bool Returns TRUE if $input is a double value, FALSE otherwise. |
||
66 | */ |
||
67 | public static function isDouble($value) { |
||
70 | |||
71 | /** |
||
72 | * Check data for float. |
||
73 | * |
||
74 | * @param mixed $value Data. |
||
75 | * @return bool Returns TRUE if $input is a float value, FALSE otherwise. |
||
76 | */ |
||
77 | public static function isFloat($value) { |
||
80 | |||
81 | /** |
||
82 | * Verify if some string is string representation of some double value. |
||
83 | * Decimal point may be `.` and `,`. |
||
84 | * |
||
85 | * @param string $value |
||
86 | * @return bool |
||
87 | */ |
||
88 | public static function isDoubleString($value) { |
||
102 | |||
103 | /** |
||
104 | * Convert string representation of some double value to double. |
||
105 | * |
||
106 | * @param string $value |
||
107 | * @return float |
||
108 | */ |
||
109 | public static function toDouble($value) { |
||
112 | |||
113 | /** |
||
114 | * Convert string representation of some double value to float. |
||
115 | * |
||
116 | * @param string $value |
||
117 | * @return float |
||
118 | */ |
||
119 | public static function toFloat($value) { |
||
122 | |||
123 | /** |
||
124 | * Finds whether a variable is a number or a numeric string. |
||
125 | * |
||
126 | * @param mixed $value The variable being evaluated. |
||
127 | * |
||
128 | * @return bool Returns TRUE if $input is a number or a numeric string, |
||
129 | * FALSE otherwise. |
||
130 | */ |
||
131 | public static function isNumeric($value) { |
||
134 | |||
135 | /** |
||
136 | * Find whether a variable is a boolean value. |
||
137 | * |
||
138 | * @param mixed $value The variable being evaluated. |
||
139 | * |
||
140 | * @return bool bool Returns TRUE if $input is a number or a numeric string, |
||
141 | * FALSE otherwise. |
||
142 | */ |
||
143 | public static function isBoolean($value) { |
||
146 | |||
147 | /** |
||
148 | * Find whether a variable is a string value. |
||
149 | * |
||
150 | * @param mixed $value The variable being evaluated. |
||
151 | * |
||
152 | * @return bool bool Returns TRUE if $input is a number or a numeric string, |
||
153 | * FALSE otherwise. |
||
154 | */ |
||
155 | public static function isString($value) { |
||
158 | |||
159 | /** |
||
160 | * Find whether a variable is an object. |
||
161 | * |
||
162 | * @param mixed $object The variable being evaluated. |
||
163 | * |
||
164 | * @return bool Returns TRUE if $object is an object, FALSE otherwise. |
||
165 | */ |
||
166 | public static function isObject(&$object) { |
||
173 | |||
174 | /** |
||
175 | * Find whether a $object is an instance of class $className. |
||
176 | * |
||
177 | * @param mixed $object The object(variable) being evaluated. |
||
178 | * @param string $className The name of the class. |
||
179 | * |
||
180 | * @return bool |
||
181 | */ |
||
182 | public static function isInstanceOf(&$object, $className) { |
||
189 | |||
190 | } |
||
191 |
This check looks for calls to
isset(...)
orempty()
on variables that are yet undefined. These calls will always produce the same result and can be removed.This is most likely caused by the renaming of a variable or the removal of a function/method parameter.