r69117 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r69116‎ | r69117 | r69118 >
Date:23:35, 6 July 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Added docs
Modified paths:
  • /trunk/extensions/Maps/Includes/Maps_CoordinateParser.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Maps/Includes/Maps_CoordinateParser.php
@@ -21,6 +21,7 @@
2222 * TODO: it migt be a lot nicer to return the releveant segments from the regexes instead of manually parsing them out.
2323 *
2424 * @ingroup Maps
 25+ * @since 0.6
2526 *
2627 * @author Jeroen De Dauw
2728 */
@@ -37,6 +38,8 @@
3839 * If they are, they will be parsed to a set of non-directional floats, that
3940 * will be stored in an array with keys 'lat' and 'lon'.
4041 *
 42+ * @since 0.6
 43+ *
4144 * @param string $coordinates The coordinates to be parsed.
4245 *
4346 * @return array or false
@@ -87,6 +90,8 @@
8891 * Returns the type of the provided coordinates, or flase if they are invalid.
8992 * You can use this as validation function, but be sure to use ===, since 0 can be returned.
9093 *
 94+ * @since 0.6
 95+ *
9196 * @param string $coordinates
9297 *
9398 * @return Integer or false
@@ -113,6 +118,8 @@
114119 /**
115120 * Returns a boolean indicating if the provided value is a valid set of coordinate.
116121 *
 122+ * @since 0.6
 123+ *
117124 * @param string $coordsOrAddress
118125 *
119126 * @return boolean
@@ -134,6 +141,8 @@
135142 * they will be parsed to the given notation, which defaults to
136143 * non-directional floats
137144 *
 145+ * @since 0.6
 146+ *
138147 * @param array $coordinates The set of coordinates that needs to be formatted. Either an associative
139148 * array with lat and lon keys, or a numbered aray with lat on index 0, and lon on index 1.
140149 * @param coordinate type $targetFormat The notation to which they should be formatted. Defaults to floats.
@@ -153,6 +162,8 @@
154163 * they will be parsed to the given notation, which defaults to
155164 * non-directional floats
156165 *
 166+ * @since 0.6.2
 167+ *
157168 * @param array $coordinates The set of coordinates that needs to be formatted. Either an associative
158169 * array with lat and lon keys, or a numbered aray with lat on index 0, and lon on index 1.
159170 * @param coordinate type $targetFormat The notation to which they should be formatted. Defaults to floats.
@@ -176,6 +187,8 @@
177188 /**
178189 * Returns a normalized version of the provided coordinates.
179190 *
 191+ * @since 0.6
 192+ *
180193 * @param string $coordinates
181194 *
182195 * @return string The normalized version of the provided coordinates.
@@ -196,6 +209,8 @@
197210 /**
198211 * Returns a string with control characters and characters with ascii values above 126 removed.
199212 *
 213+ * @since 0.6.3
 214+ *
200215 * @param string $string Yeah, it's a string, seriously!
201216 *
202217 * @return string
@@ -217,6 +232,8 @@
218233 /**
219234 * Formats a single non-directional float coordinate in the given notation.
220235 *
 236+ * @since 0.6
 237+ *
221238 * @param string $coordinate The coordinate to be formatted.
222239 * @param coordinate type $targetFormat The notation to which they should be formatted.
223240 *
@@ -258,6 +275,8 @@
259276 /**
260277 * Parses a coordinate that's in the provided notation to float representatation.
261278 *
 279+ * @since 0.6
 280+ *
262281 * @param string $coordinate The coordinate to be parsed.
263282 * @param coordinate type $coordType The notation the coordinate is currently in.
264283 *
@@ -281,6 +300,8 @@
282301 /**
283302 * returns whether the coordinates are in float representataion.
284303 *
 304+ * @since 0.6
 305+ *
285306 * @param string $coordinates
286307 *
287308 * @return boolean
@@ -294,6 +315,8 @@
295316 /**
296317 * returns whether the coordinates are in DMS representataion.
297318 *
 319+ * @since 0.6
 320+ *
298321 * @param string $coordinates
299322 *
300323 * @return boolean
@@ -309,6 +332,8 @@
310333 /**
311334 * returns whether the coordinates are in Decimal Degree representataion.
312335 *
 336+ * @since 0.6
 337+ *
313338 * @param string $coordinates
314339 *
315340 * @return boolean
@@ -322,6 +347,8 @@
323348 /**
324349 * returns whether the coordinates are in Decimal Minute representataion.
325350 *
 351+ * @since 0.6
 352+ *
326353 * @param string $coordinates
327354 *
328355 * @return boolean
@@ -335,7 +362,11 @@
336363 /**
337364 * Turn i18n labels into English ones, for both validation and ease of handling.
338365 *
 366+ * @since 0.6
 367+ *
339368 * @param string $coordinates
 369+ *
 370+ * @return string
340371 */
341372 private static function handleI18nLabels( $coordinates ) {
342373 self::initializeDirectionLabels();
@@ -344,6 +375,8 @@
345376
346377 /**
347378 * Initialize the cache for internationalized direction labels if not done yet.
 379+ *
 380+ * @since 0.6
348381 */
349382 protected static function initializeDirectionLabels() {
350383 if ( !self::$mI18nDirections ) {
@@ -360,6 +393,8 @@
361394 /**
362395 * Turns directional notation (N/E/S/W) of a coordinate set into non-directional notation (+/-).
363396 *
 397+ * @since 0.6
 398+ *
364399 * @param array $coordinates
365400 *
366401 * @return array
@@ -374,6 +409,8 @@
375410 /**
376411 * Turns directional notation (N/E/S/W) of a single coordinate into non-directional notation (+/-).
377412 *
 413+ * @since 0.6
 414+ *
378415 * @param string $coordinate
379416 *
380417 * @return string
@@ -398,6 +435,8 @@
399436 /**
400437 * Turns non-directional notation in directional notation when needed.
401438 *
 439+ * @since 0.6
 440+ *
402441 * @param array $coordinates The coordinates set to possibly make directional. Needs to be non-directional!
403442 *
404443 * @return array
@@ -416,6 +455,8 @@
417456 /**
418457 * Turns non-directional notation in directional notation.
419458 *
 459+ * @since 0.6
 460+ *
420461 * @param string $coordinate The coordinate to make directional. Needs to be non-directional!
421462 * @param boolean $isLat Should be true for latitudes and false for longitudes.
422463 *
@@ -439,6 +480,8 @@
440481 /**
441482 * Takes a set of coordinates in DMS representataion, and returns them in float representataion.
442483 *
 484+ * @since 0.6
 485+ *
443486 * @param string $coordinate
444487 *
445488 * @return string
@@ -469,6 +512,8 @@
470513 /**
471514 * Takes a set of coordinates in Decimal Degree representataion, and returns them in float representataion.
472515 *
 516+ * @since 0.6
 517+ *
473518 * @param string $coordinate
474519 *
475520 * @return string
@@ -480,6 +525,8 @@
481526 /**
482527 * Takes a set of coordinates in Decimal Minute representataion, and returns them in float representataion.
483528 *
 529+ * @since 0.6
 530+ *
484531 * @param string $coordinate
485532 *
486533 * @return string
@@ -498,6 +545,13 @@
499546 return $coordinate;
500547 }
501548
 549+ /**
 550+ * Gets a regex group that allows only the supported seperators.
 551+ *
 552+ * @since 0.6.2
 553+ *
 554+ * @return string
 555+ */
502556 protected static function getSeparatorsRegex() {
503557 if ( !self::$mSeparatorsRegex ) self::$mSeparatorsRegex = '(' . implode( '|', self::$mSeparators ) . ')';
504558 return self::$mSeparatorsRegex;
@@ -506,6 +560,8 @@
507561 /**
508562 * Parse a string containing coordinates and return the same value in the specified notation.
509563 *
 564+ * @since 0.6
 565+ *
510566 * @param string $coordinates
511567 * @param $targetFormat
512568 * @param boolean $directional

Status & tagging log