http://www.mediawiki.org/wiki/Special:Code/MediaWiki/69117
Revision: 69117 Author: jeroendedauw Date: 2010-07-06 23:35:35 +0000 (Tue, 06 Jul 2010) Log Message: ----------- Added docs Modified Paths: -------------- trunk/extensions/Maps/Includes/Maps_CoordinateParser.php Modified: trunk/extensions/Maps/Includes/Maps_CoordinateParser.php =================================================================== --- trunk/extensions/Maps/Includes/Maps_CoordinateParser.php 2010-07-06 21:37:40 UTC (rev 69116) +++ trunk/extensions/Maps/Includes/Maps_CoordinateParser.php 2010-07-06 23:35:35 UTC (rev 69117) @@ -21,6 +21,7 @@ * TODO: it migt be a lot nicer to return the releveant segments from the regexes instead of manually parsing them out. * * @ingroup Maps + * @since 0.6 * * @author Jeroen De Dauw */ @@ -37,6 +38,8 @@ * If they are, they will be parsed to a set of non-directional floats, that * will be stored in an array with keys 'lat' and 'lon'. * + * @since 0.6 + * * @param string $coordinates The coordinates to be parsed. * * @return array or false @@ -87,6 +90,8 @@ * Returns the type of the provided coordinates, or flase if they are invalid. * You can use this as validation function, but be sure to use ===, since 0 can be returned. * + * @since 0.6 + * * @param string $coordinates * * @return Integer or false @@ -113,6 +118,8 @@ /** * Returns a boolean indicating if the provided value is a valid set of coordinate. * + * @since 0.6 + * * @param string $coordsOrAddress * * @return boolean @@ -134,6 +141,8 @@ * they will be parsed to the given notation, which defaults to * non-directional floats * + * @since 0.6 + * * @param array $coordinates The set of coordinates that needs to be formatted. Either an associative * array with lat and lon keys, or a numbered aray with lat on index 0, and lon on index 1. * @param coordinate type $targetFormat The notation to which they should be formatted. Defaults to floats. @@ -153,6 +162,8 @@ * they will be parsed to the given notation, which defaults to * non-directional floats * + * @since 0.6.2 + * * @param array $coordinates The set of coordinates that needs to be formatted. Either an associative * array with lat and lon keys, or a numbered aray with lat on index 0, and lon on index 1. * @param coordinate type $targetFormat The notation to which they should be formatted. Defaults to floats. @@ -176,6 +187,8 @@ /** * Returns a normalized version of the provided coordinates. * + * @since 0.6 + * * @param string $coordinates * * @return string The normalized version of the provided coordinates. @@ -196,6 +209,8 @@ /** * Returns a string with control characters and characters with ascii values above 126 removed. * + * @since 0.6.3 + * * @param string $string Yeah, it's a string, seriously! * * @return string @@ -217,6 +232,8 @@ /** * Formats a single non-directional float coordinate in the given notation. * + * @since 0.6 + * * @param string $coordinate The coordinate to be formatted. * @param coordinate type $targetFormat The notation to which they should be formatted. * @@ -258,6 +275,8 @@ /** * Parses a coordinate that's in the provided notation to float representatation. * + * @since 0.6 + * * @param string $coordinate The coordinate to be parsed. * @param coordinate type $coordType The notation the coordinate is currently in. * @@ -281,6 +300,8 @@ /** * returns whether the coordinates are in float representataion. * + * @since 0.6 + * * @param string $coordinates * * @return boolean @@ -294,6 +315,8 @@ /** * returns whether the coordinates are in DMS representataion. * + * @since 0.6 + * * @param string $coordinates * * @return boolean @@ -309,6 +332,8 @@ /** * returns whether the coordinates are in Decimal Degree representataion. * + * @since 0.6 + * * @param string $coordinates * * @return boolean @@ -322,6 +347,8 @@ /** * returns whether the coordinates are in Decimal Minute representataion. * + * @since 0.6 + * * @param string $coordinates * * @return boolean @@ -335,7 +362,11 @@ /** * Turn i18n labels into English ones, for both validation and ease of handling. * + * @since 0.6 + * * @param string $coordinates + * + * @return string */ private static function handleI18nLabels( $coordinates ) { self::initializeDirectionLabels(); @@ -344,6 +375,8 @@ /** * Initialize the cache for internationalized direction labels if not done yet. + * + * @since 0.6 */ protected static function initializeDirectionLabels() { if ( !self::$mI18nDirections ) { @@ -360,6 +393,8 @@ /** * Turns directional notation (N/E/S/W) of a coordinate set into non-directional notation (+/-). * + * @since 0.6 + * * @param array $coordinates * * @return array @@ -374,6 +409,8 @@ /** * Turns directional notation (N/E/S/W) of a single coordinate into non-directional notation (+/-). * + * @since 0.6 + * * @param string $coordinate * * @return string @@ -398,6 +435,8 @@ /** * Turns non-directional notation in directional notation when needed. * + * @since 0.6 + * * @param array $coordinates The coordinates set to possibly make directional. Needs to be non-directional! * * @return array @@ -416,6 +455,8 @@ /** * Turns non-directional notation in directional notation. * + * @since 0.6 + * * @param string $coordinate The coordinate to make directional. Needs to be non-directional! * @param boolean $isLat Should be true for latitudes and false for longitudes. * @@ -439,6 +480,8 @@ /** * Takes a set of coordinates in DMS representataion, and returns them in float representataion. * + * @since 0.6 + * * @param string $coordinate * * @return string @@ -469,6 +512,8 @@ /** * Takes a set of coordinates in Decimal Degree representataion, and returns them in float representataion. * + * @since 0.6 + * * @param string $coordinate * * @return string @@ -480,6 +525,8 @@ /** * Takes a set of coordinates in Decimal Minute representataion, and returns them in float representataion. * + * @since 0.6 + * * @param string $coordinate * * @return string @@ -498,6 +545,13 @@ return $coordinate; } + /** + * Gets a regex group that allows only the supported seperators. + * + * @since 0.6.2 + * + * @return string + */ protected static function getSeparatorsRegex() { if ( !self::$mSeparatorsRegex ) self::$mSeparatorsRegex = '(' . implode( '|', self::$mSeparators ) . ')'; return self::$mSeparatorsRegex; @@ -506,6 +560,8 @@ /** * Parse a string containing coordinates and return the same value in the specified notation. * + * @since 0.6 + * * @param string $coordinates * @param $targetFormat * @param boolean $directional _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs