r74293 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r74292‎ | r74293 | r74294 >
Date:11:26, 5 October 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Changes for 0.4 - now passing along the Parameter object to manipulations
Modified paths:
  • /trunk/extensions/Validator/Validator.php (modified) (history)
  • /trunk/extensions/Validator/includes/ItemParameterManipulation.php (modified) (history)
  • /trunk/extensions/Validator/includes/Validator.php (modified) (history)
  • /trunk/extensions/Validator/includes/manipulations/ParamManipulationBoolean.php (modified) (history)
  • /trunk/extensions/Validator/includes/manipulations/ParamManipulationBoolstr.php (modified) (history)
  • /trunk/extensions/Validator/includes/manipulations/ParamManipulationFloat.php (modified) (history)
  • /trunk/extensions/Validator/includes/manipulations/ParamManipulationInteger.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Validator/includes/manipulations/ParamManipulationInteger.php
@@ -27,7 +27,7 @@
2828 *
2929 * @since 0.4
3030 */
31 - public function doManipulation( &$value, array &$parameters ) {
 31+ public function doManipulation( &$value, Parameter $parameter, array &$parameters ) {
3232 $value = (int)$value;
3333 }
3434
Index: trunk/extensions/Validator/includes/manipulations/ParamManipulationBoolean.php
@@ -27,7 +27,7 @@
2828 *
2929 * @since 0.4
3030 */
31 - public function doManipulation( &$value, array &$parameters ) {
 31+ public function doManipulation( &$value, Parameter $parameter, array &$parameters ) {
3232 $value = in_array( $value, array( 'yes', 'on' ) );
3333 }
3434
Index: trunk/extensions/Validator/includes/manipulations/ParamManipulationBoolstr.php
@@ -27,7 +27,7 @@
2828 *
2929 * @since 0.4
3030 */
31 - public function doManipulation( &$value, array &$parameters ) {
 31+ public function doManipulation( &$value, Parameter $parameter, array &$parameters ) {
3232 $value = $value ? 'true' : 'false';
3333 }
3434
Index: trunk/extensions/Validator/includes/manipulations/ParamManipulationFloat.php
@@ -27,7 +27,7 @@
2828 *
2929 * @since 0.4
3030 */
31 - public function doManipulation( &$value, array &$parameters ) {
 31+ public function doManipulation( &$value, Parameter $parameter, array &$parameters ) {
3232 $value = (float)$value;
3333 }
3434
Index: trunk/extensions/Validator/includes/ItemParameterManipulation.php
@@ -19,13 +19,14 @@
2020 * Manipulate an actual value.
2121 *
2222 * @param string $value
 23+ * @param Parameter $parameter
2324 * @param array $parameters
2425 *
2526 * @since 0.4
2627 *
2728 * @return mixed
2829 */
29 - protected abstract function doManipulation( &$value, array &$parameters );
 30+ protected abstract function doManipulation( &$value, Parameter $parameter, array &$parameters );
3031
3132 /**
3233 * Constructor.
@@ -42,6 +43,7 @@
4344 public function isForLists() {
4445 return false;
4546 }
 47+
4648 /**
4749 * Validate a parameter against the criterion.
4850 *
@@ -54,12 +56,12 @@
5557 if ( is_array( $parameter->getValue() ) ) {
5658 $value = &$parameter->getValue();
5759 foreach ( $value as &$item ) {
58 - $this->doManipulation( $item, $parameters );
 60+ $this->doManipulation( $item, $parameter, $parameters );
5961 }
6062 }
6163 else {
62 - $this->doManipulation( $parameter->getValue(), $parameters );
 64+ $this->doManipulation( $parameter->getValue(), $parameter, $parameters );
6365 }
64 - }
 66+ }
6567
6668 }
\ No newline at end of file
Index: trunk/extensions/Validator/includes/Validator.php
@@ -302,7 +302,7 @@
303303 $dependencies = array();
304304
305305 foreach ( $this->paramsTohandle as $paramName ) {
306 - $dependencies[$paramName] = array();//$this->parameters[$paramName]->getDependencies();
 306+ $dependencies[$paramName] = array(); //$this->parameters[$paramName]->getDependencies();
307307 }
308308
309309 $sorter = new TopologicalSort( $dependencies, true );
Index: trunk/extensions/Validator/Validator.php
@@ -24,7 +24,7 @@
2525 die( 'Not an entry point.' );
2626 }
2727
28 -define( 'Validator_VERSION', '0.4 alpha-6' );
 28+define( 'Validator_VERSION', '0.4 alpha-7' );
2929
3030 // Register the internationalization file.
3131 $wgExtensionMessagesFiles['Validator'] = dirname( __FILE__ ) . '/Validator.i18n.php';

Status & tagging log