r73786 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73785‎ | r73786 | r73787 >
Date:18:12, 26 September 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Changes for 0.4 - fixed small issues
Modified paths:
  • /trunk/extensions/Validator/includes/ListParameter.php (modified) (history)
  • /trunk/extensions/Validator/includes/Parameter.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Validator/includes/ListParameter.php
@@ -112,12 +112,12 @@
113113 */
114114 protected function cleanValue() {
115115 $this->value = explode( $this->delimiter, $this->originalValue );
116 -
 116+
117117 if ( $this->lowerCaseValue ) {
118118 foreach ( $this->value as &$item ) {
119119 $item = strtolower( $item );
120120 }
121 - }
 121+ }
122122 }
123123
124124 /**
@@ -129,7 +129,7 @@
130130 $success = parent::doValidation();
131131
132132 if ( !$success && count( $this->value ) == 0 ) {
133 - $this->value = (array)$this->default;
 133+ $this->value = is_array( $this->default ) ? $this->default : array( $this->default );
134134 }
135135
136136 return $success;
@@ -196,4 +196,13 @@
197197 return !in_array( $item, $this->tempInvalidList );
198198 }
199199
 200+ /**
 201+ * @see Parameter::setDefault
 202+ *
 203+ * @since 0.4
 204+ */
 205+ public function setDefault( $default ) {
 206+ $this->default = is_array( $default ) ? $default : array( $default );
 207+ }
 208+
200209 }
\ No newline at end of file
Index: trunk/extensions/Validator/includes/Parameter.php
@@ -430,8 +430,6 @@
431431 }
432432 }
433433 else {
434 - $this->value = $this->originalValue;
435 -
436434 $success = $this->validateCriteria();
437435 }
438436

Status & tagging log