Index: trunk/extensions/Validator/includes/Parameter.php |
— | — | @@ -91,7 +91,7 @@ |
92 | 92 | * |
93 | 93 | * @var array |
94 | 94 | */ |
95 | | - protected $aliases; |
| 95 | + protected $aliases = array(); |
96 | 96 | |
97 | 97 | /** |
98 | 98 | * List of criteria the parameter value needs to hold against. |
— | — | @@ -233,15 +233,11 @@ |
234 | 234 | |
235 | 235 | $types[$name] = $definition['output-types'][$i]; |
236 | 236 | } |
237 | | - |
238 | | - $parameter->outputTypes = $types; |
239 | 237 | } |
240 | 238 | elseif ( array_key_exists( 'output-type', $definition ) ) { |
241 | 239 | if ( ! is_array( $definition['output-type'] ) ) { |
242 | 240 | $definition['output-type'] = array( $definition['output-type'] ); |
243 | 241 | } |
244 | | - |
245 | | - $parameter->outputTypes = array( $definition['output-type'] ); |
246 | 242 | } |
247 | 243 | |
248 | 244 | if ( array_key_exists( 'tolower', $definition ) ) { |
— | — | @@ -297,14 +293,27 @@ |
298 | 294 | } |
299 | 295 | |
300 | 296 | /** |
| 297 | + * Adds one or more aliases for the parameter name. |
| 298 | + * |
| 299 | + * @since 0.4 |
| 300 | + * |
| 301 | + * @param mixed $aliases string or array of string |
| 302 | + */ |
| 303 | + public function addAliases() { |
| 304 | + $args = func_get_args(); |
| 305 | + $this->aliases = array_merge( $this->aliases, is_array( $args[0] ) ? $args[0] : $args ); |
| 306 | + } |
| 307 | + |
| 308 | + /** |
301 | 309 | * Adds one or more ParameterCriterion. |
302 | 310 | * |
303 | 311 | * @since 0.4 |
304 | 312 | * |
305 | 313 | * @param mixed $criteria ParameterCriterion or array of ParameterCriterion |
306 | 314 | */ |
307 | | - public function addCriteria( $criteria ) { |
308 | | - $this->criteria = array_merge( $this->criteria, (array)$criteria ); |
| 315 | + public function addCriteria() { |
| 316 | + $args = func_get_args(); |
| 317 | + $this->criteria = array_merge( $this->criteria, is_array( $args[0] ) ? $args[0] : $args ); |
309 | 318 | } |
310 | 319 | |
311 | 320 | /** |
— | — | @@ -312,10 +321,11 @@ |
313 | 322 | * |
314 | 323 | * @since 0.4 |
315 | 324 | * |
316 | | - * @param mixed $criteria ParameterManipulation or array of ParameterManipulation |
| 325 | + * @param mixed $manipulations ParameterManipulation or array of ParameterManipulation |
317 | 326 | */ |
318 | 327 | public function addManipulations( $manipulations ) { |
319 | | - $this->manipulations = array_merge( $this->manipulations, (array)$manipulations ); |
| 328 | + $args = func_get_args(); |
| 329 | + $this->manipulations = array_merge( $this->manipulations, is_array( $args[0] ) ? $args[0] : $args ); |
320 | 330 | } |
321 | 331 | |
322 | 332 | /** |