Index: trunk/extensions/Validator/Validator.class.php |
— | — | @@ -69,8 +69,8 @@ |
70 | 70 | private static $mValidationFunctions = array( |
71 | 71 | 'in_array' => array( 'ValidatorFunctions', 'in_array' ), |
72 | 72 | 'in_range' => array( 'ValidatorFunctions', 'in_range' ), |
73 | | - 'is_numeric' => 'is_numeric', |
74 | | - 'is_float' => 'is_float', |
| 73 | + 'is_numeric' => array( 'ValidatorFunctions', 'is_numeric' ), |
| 74 | + 'is_float' => array( 'ValidatorFunctions', 'is_float' ), |
75 | 75 | 'is_integer' => array( 'ValidatorFunctions', 'is_integer' ), |
76 | 76 | 'not_empty' => array( 'ValidatorFunctions', 'not_empty' ), |
77 | 77 | 'has_length' => array( 'ValidatorFunctions', 'has_length' ), |
Index: trunk/extensions/Validator/Validator_Functions.php |
— | — | @@ -26,8 +26,9 @@ |
27 | 27 | * Returns whether the provided value, which must be a number, is within a certain range. Upper bound included. |
28 | 28 | * |
29 | 29 | * @param $value |
30 | | - * @param $lower |
31 | | - * @param $upper |
| 30 | + * @param array $metaData |
| 31 | + * @param mixed $lower |
| 32 | + * @param mixed $upper |
32 | 33 | * |
33 | 34 | * @return boolean |
34 | 35 | */ |
— | — | @@ -43,6 +44,7 @@ |
44 | 45 | * Returns whether the string value is not empty. Not empty is defined as having at least one character after trimming. |
45 | 46 | * |
46 | 47 | * @param $value |
| 48 | + * @param array $metaData |
47 | 49 | * |
48 | 50 | * @return boolean |
49 | 51 | */ |
— | — | @@ -54,6 +56,7 @@ |
55 | 57 | * Returns whether the string value is not empty. Not empty is defined as having at least one character after trimming. |
56 | 58 | * |
57 | 59 | * @param $value |
| 60 | + * @param array $metaData |
58 | 61 | * |
59 | 62 | * @return boolean |
60 | 63 | */ |
— | — | @@ -68,6 +71,7 @@ |
69 | 72 | * Returns whether a variable is an integer or an integer string. Uses the native PHP function. |
70 | 73 | * |
71 | 74 | * @param $value |
| 75 | + * @param array $metaData |
72 | 76 | * |
73 | 77 | * @return boolean |
74 | 78 | */ |
— | — | @@ -79,8 +83,9 @@ |
80 | 84 | * Returns whether the length of the value is within a certain range. Upper bound included. |
81 | 85 | * |
82 | 86 | * @param string $value |
83 | | - * @param $lower |
84 | | - * @param $upper |
| 87 | + * @param array $metaData |
| 88 | + * @param mixed $lower |
| 89 | + * @param mixed $upper |
85 | 90 | * |
86 | 91 | * @return boolean |
87 | 92 | */ |
— | — | @@ -92,8 +97,9 @@ |
93 | 98 | * Returns whether the amount of items in the list is within a certain range. Upper bound included. |
94 | 99 | * |
95 | 100 | * @param array $values |
96 | | - * @param $lower |
97 | | - * @param $upper |
| 101 | + * @param array $metaData |
| 102 | + * @param mixed $lower |
| 103 | + * @param mixed $upper |
98 | 104 | * |
99 | 105 | * @return boolean |
100 | 106 | */ |
— | — | @@ -105,6 +111,7 @@ |
106 | 112 | * Returns whether the list of values does not have any duplicates. |
107 | 113 | * |
108 | 114 | * @param array $values |
| 115 | + * @param array $metaData |
109 | 116 | * |
110 | 117 | * @return boolean |
111 | 118 | */ |
— | — | @@ -116,6 +123,7 @@ |
117 | 124 | * Returns the result of preg_match. |
118 | 125 | * |
119 | 126 | * @param string $value |
| 127 | + * @param array $metaData |
120 | 128 | * @param string $pattern |
121 | 129 | * |
122 | 130 | * @return boolean |
— | — | @@ -123,4 +131,28 @@ |
124 | 132 | public static function regex( $value, array $metaData, $pattern ) { |
125 | 133 | return (bool)preg_match( $pattern, $value ); |
126 | 134 | } |
| 135 | + |
| 136 | + /** |
| 137 | + * Wrapper for the native is_numeric function. |
| 138 | + * |
| 139 | + * @param $value |
| 140 | + * @param array $metaData |
| 141 | + * |
| 142 | + * @return boolean |
| 143 | + */ |
| 144 | + public static function is_numeric( $value, array $metaData ) { |
| 145 | + return is_numeric( $value ); |
| 146 | + } |
| 147 | + |
| 148 | + /** |
| 149 | + * Wrapper for the native is_float function. |
| 150 | + * |
| 151 | + * @param $value |
| 152 | + * @param array $metaData |
| 153 | + * |
| 154 | + * @return boolean |
| 155 | + */ |
| 156 | + public static function is_float( $value, array $metaData ) { |
| 157 | + return is_float( $value ); |
| 158 | + } |
127 | 159 | } |