@@ -45,10 +45,6 @@ public function __construct( ?ParserOptions $options = null ) {
45
45
46
46
/**
47
47
* @see LatLongParserBase::getParsedCoordinate
48
- *
49
- * @param string $coordinateSegment
50
- *
51
- * @return float
52
48
*/
53
49
protected function getParsedCoordinate ( string $ coordinateSegment ): float {
54
50
$ coordinateSegment = $ this ->resolveDirection ( $ coordinateSegment );
@@ -73,14 +69,14 @@ protected function areValidCoordinates( array $normalizedCoordinateSegments ): b
73
69
$ match = false ;
74
70
75
71
foreach ( $ normalizedCoordinateSegments as $ i => $ segment ) {
76
- $ direction = '( '
77
- . $ this ->getOption ( self ::OPT_NORTH_SYMBOL ) . '| '
78
- . $ this ->getOption ( self ::OPT_SOUTH_SYMBOL ) . ') ' ;
79
-
80
72
if ( $ i === 1 ) {
81
73
$ direction = '( '
82
74
. $ this ->getOption ( self ::OPT_EAST_SYMBOL ) . '| '
83
75
. $ this ->getOption ( self ::OPT_WEST_SYMBOL ) . ') ' ;
76
+ } else {
77
+ $ direction = '( '
78
+ . $ this ->getOption ( self ::OPT_NORTH_SYMBOL ) . '| '
79
+ . $ this ->getOption ( self ::OPT_SOUTH_SYMBOL ) . ') ' ;
84
80
}
85
81
86
82
$ match = preg_match (
@@ -90,10 +86,12 @@ protected function areValidCoordinates( array $normalizedCoordinateSegments ): b
90
86
91
87
if ( $ directional ) {
92
88
// 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
94
90
// checking for directionality is the only check needed for longitude.
95
91
break ;
96
- } elseif ( $ match ) {
92
+ }
93
+
94
+ if ( $ match ) {
97
95
// Latitude is directional, no need to check for non-directionality.
98
96
$ directional = true ;
99
97
continue ;
@@ -139,9 +137,7 @@ protected function getNormalizedNotation( string $coordinates ): string {
139
137
$ this ->getOption ( self ::OPT_DEGREE_SYMBOL ), $ coordinates
140
138
);
141
139
142
- $ coordinates = $ this ->removeInvalidChars ( $ coordinates );
143
-
144
- return $ coordinates ;
140
+ return $ this ->removeInvalidChars ( $ coordinates );
145
141
}
146
142
147
143
/**
@@ -160,10 +156,6 @@ protected function removeInvalidChars( string $string ): string {
160
156
161
157
/**
162
158
* Converts a coordinate segment to float representation.
163
- *
164
- * @param string $coordinateSegment
165
- *
166
- * @return float
167
159
*/
168
160
protected function parseCoordinate ( string $ coordinateSegment ): float {
169
161
return (float )str_replace (
@@ -186,7 +178,7 @@ protected function splitString( string $normalizedCoordinateString ): array {
186
178
$ normalizedCoordinateSegments = explode ( $ separator , $ normalizedCoordinateString );
187
179
188
180
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
190
182
// splitting after the first direction character or degree symbol:
191
183
$ delimiters = $ this ->defaultDelimiters ;
192
184
0 commit comments