r73711 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73710‎ | r73711 | r73712 >
Date:04:40, 25 September 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Follow up to r73708
Modified paths:
  • /trunk/extensions/Validator/includes/Parameter.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Validator/includes/Parameter.php
@@ -91,7 +91,7 @@
9292 *
9393 * @var array
9494 */
95 - protected $aliases;
 95+ protected $aliases = array();
9696
9797 /**
9898 * List of criteria the parameter value needs to hold against.
@@ -233,15 +233,11 @@
234234
235235 $types[$name] = $definition['output-types'][$i];
236236 }
237 -
238 - $parameter->outputTypes = $types;
239237 }
240238 elseif ( array_key_exists( 'output-type', $definition ) ) {
241239 if ( ! is_array( $definition['output-type'] ) ) {
242240 $definition['output-type'] = array( $definition['output-type'] );
243241 }
244 -
245 - $parameter->outputTypes = array( $definition['output-type'] );
246242 }
247243
248244 if ( array_key_exists( 'tolower', $definition ) ) {
@@ -297,14 +293,27 @@
298294 }
299295
300296 /**
 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+ /**
301309 * Adds one or more ParameterCriterion.
302310 *
303311 * @since 0.4
304312 *
305313 * @param mixed $criteria ParameterCriterion or array of ParameterCriterion
306314 */
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 );
309318 }
310319
311320 /**
@@ -312,10 +321,11 @@
313322 *
314323 * @since 0.4
315324 *
316 - * @param mixed $criteria ParameterManipulation or array of ParameterManipulation
 325+ * @param mixed $manipulations ParameterManipulation or array of ParameterManipulation
317326 */
318327 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 );
320330 }
321331
322332 /**

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r73708Addded distance criterionjeroendedauw03:47, 25 September 2010

Status & tagging log