@@ -45,10 +45,6 @@ public function __construct( ?ParserOptions $options = null ) {
4545
4646 /**
4747 * @see LatLongParserBase::getParsedCoordinate
48- *
49- * @param string $coordinateSegment
50- *
51- * @return float
5248 */
5349 protected function getParsedCoordinate ( string $ coordinateSegment ): float {
5450 $ coordinateSegment = $ this ->resolveDirection ( $ coordinateSegment );
@@ -73,14 +69,14 @@ protected function areValidCoordinates( array $normalizedCoordinateSegments ): b
7369 $ match = false ;
7470
7571 foreach ( $ normalizedCoordinateSegments as $ i => $ segment ) {
76- $ direction = '( '
77- . $ this ->getOption ( self ::OPT_NORTH_SYMBOL ) . '| '
78- . $ this ->getOption ( self ::OPT_SOUTH_SYMBOL ) . ') ' ;
79-
8072 if ( $ i === 1 ) {
8173 $ direction = '( '
8274 . $ this ->getOption ( self ::OPT_EAST_SYMBOL ) . '| '
8375 . $ this ->getOption ( self ::OPT_WEST_SYMBOL ) . ') ' ;
76+ } else {
77+ $ direction = '( '
78+ . $ this ->getOption ( self ::OPT_NORTH_SYMBOL ) . '| '
79+ . $ this ->getOption ( self ::OPT_SOUTH_SYMBOL ) . ') ' ;
8480 }
8581
8682 $ match = preg_match (
@@ -90,10 +86,12 @@ protected function areValidCoordinates( array $normalizedCoordinateSegments ): b
9086
9187 if ( $ directional ) {
9288 // Directionality is only set after parsing latitude: When the latitude is
93- // is directional, the longitude needs to be as well. Therefore we break here since
89+ // directional, the longitude needs to be as well. Therefore, we break here since
9490 // checking for directionality is the only check needed for longitude.
9591 break ;
96- } elseif ( $ match ) {
92+ }
93+
94+ if ( $ match ) {
9795 // Latitude is directional, no need to check for non-directionality.
9896 $ directional = true ;
9997 continue ;
@@ -139,9 +137,7 @@ protected function getNormalizedNotation( string $coordinates ): string {
139137 $ this ->getOption ( self ::OPT_DEGREE_SYMBOL ), $ coordinates
140138 );
141139
142- $ coordinates = $ this ->removeInvalidChars ( $ coordinates );
143-
144- return $ coordinates ;
140+ return $ this ->removeInvalidChars ( $ coordinates );
145141 }
146142
147143 /**
@@ -160,10 +156,6 @@ protected function removeInvalidChars( string $string ): string {
160156
161157 /**
162158 * Converts a coordinate segment to float representation.
163- *
164- * @param string $coordinateSegment
165- *
166- * @return float
167159 */
168160 protected function parseCoordinate ( string $ coordinateSegment ): float {
169161 return (float )str_replace (
@@ -186,7 +178,7 @@ protected function splitString( string $normalizedCoordinateString ): array {
186178 $ normalizedCoordinateSegments = explode ( $ separator , $ normalizedCoordinateString );
187179
188180 if ( count ( $ normalizedCoordinateSegments ) !== 2 ) {
189- // Separator not present within the string, trying to figure out the segments by
181+ // Separator is not present within the string, trying to figure out the segments by
190182 // splitting after the first direction character or degree symbol:
191183 $ delimiters = $ this ->defaultDelimiters ;
192184
0 commit comments