r66600 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r66599‎ | r66600 | r66601 >
Date:02:42, 18 May 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Changes for 0.6 - added docs
Modified paths:
  • /trunk/extensions/Maps/Maps_Mapper.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Maps/Maps_Mapper.php
@@ -13,9 +13,12 @@
1414 }
1515
1616 final class MapsMapper {
 17+
 18+ /**
 19+ * Initialization function. Needs to be called before parameters using Maps defined validation
 20+ * or formatting functions are handled.
 21+ */
1722 public static function initialize() {
18 - global $egMapsSizeRestrictions, $egMapsMapWidth, $egMapsMapHeight;
19 -
2023 Validator::addValidationFunction( 'is_map_dimension', array( __CLASS__, 'isMapDimension' ) );
2124 Validator::addValidationFunction( 'is_location', array( __CLASS__, 'isLocation' ) );
2225 Validator::addValidationFunction( 'are_locations', array( __CLASS__, 'areLocations' ) );
@@ -25,6 +28,15 @@
2629 Validator::addOutputFormat( 'coordinateSets', array( __CLASS__, 'formatLocations' ) );
2730 }
2831
 32+ /**
 33+ * Returns if the value is a location.
 34+ *
 35+ * @param string $location
 36+ * @param string $name The name of the parameter.
 37+ * @param array $parameters Array containing data about the so far handled parameters.
 38+ *
 39+ * @return boolean
 40+ */
2941 public static function isLocation( $location, $name, array $parameters ) {
3042 if ( self::geocoderIsAvailable() ) {
3143 return MapsGeocoder::isLocation( $location );
@@ -33,6 +45,15 @@
3446 }
3547 }
3648
 49+ /**
 50+ * Returns if the values are a locations.
 51+ *
 52+ * @param string $locations
 53+ * @param string $name The name of the parameter.
 54+ * @param array $parameters Array containing data about the so far handled parameters.
 55+ *
 56+ * @return boolean
 57+ */
3758 public static function areLocations( $locations, $name, array $parameters ) {
3859 $locations = (array)$locations;
3960 foreach ( $locations as $location ) {
@@ -43,6 +64,13 @@
4465 return true;
4566 }
4667
 68+ /**
 69+ * Formats a location to a coordinate set in a certain representation.
 70+ *
 71+ * @param string $locations
 72+ * @param string $name The name of the parameter.
 73+ * @param array $parameters Array containing data about the so far handled parameters.
 74+ */
4775 public static function formatLocation( &$location, $name, array $parameters ) {
4876 if ( self::geocoderIsAvailable() ) {
4977 $location = MapsGeocoder::attemptToGeocodeToString( $location );
@@ -51,6 +79,13 @@
5280 }
5381 }
5482
 83+ /**
 84+ * Formats a set of locations to coordinate sets in a certain representation.
 85+ *
 86+ * @param string $locations
 87+ * @param string $name The name of the parameter.
 88+ * @param array $parameters Array containing data about the so far handled parameters.
 89+ */
5590 public static function formatLocations( &$locations, $name, array $parameters ) {
5691 $locations = (array)$locations;
5792 foreach ( $locations as &$location ) {
@@ -280,4 +315,4 @@
281316 ),
282317 );
283318 }
284 -}
 319+}
\ No newline at end of file

Status & tagging log