@@ -544,7 +544,7 @@ |
||
544 | 544 | { |
545 | 545 | /** @noinspection PhpUnusedParameterInspection */ |
546 | 546 | set_error_handler( |
547 | - function ($errNO, $errStr, $errFile, $errLine, $errContext) { |
|
547 | + function($errNO, $errStr, $errFile, $errLine, $errContext) { |
|
548 | 548 | if (isset($errContext['http_response_header'])) { |
549 | 549 | foreach ($errContext['http_response_header'] as $line) { |
550 | 550 | if (strpos($line, 'Error: ') > -1) { |
@@ -189,8 +189,7 @@ |
||
189 | 189 | return new Point($coordinates[0], $coordinates[1]); |
190 | 190 | case 3: |
191 | 191 | return $this->hasZ ? |
192 | - new Point($coordinates[0], $coordinates[1], $coordinates[2]) : |
|
193 | - new Point($coordinates[0], $coordinates[1], null, $coordinates[2]); |
|
192 | + new Point($coordinates[0], $coordinates[1], $coordinates[2]) : new Point($coordinates[0], $coordinates[1], null, $coordinates[2]); |
|
194 | 193 | case 4: |
195 | 194 | return new Point($coordinates[0], $coordinates[1], $coordinates[2], $coordinates[3]); |
196 | 195 | } |
@@ -121,10 +121,8 @@ |
||
121 | 121 | public function boundary(): Geometry |
122 | 122 | { |
123 | 123 | return $this->isEmpty() ? |
124 | - new LineString() : |
|
125 | - ($this->isClosed() ? |
|
126 | - new MultiPoint() : |
|
127 | - new MultiPoint([$this->startPoint() ?? new Point(), $this->endPoint() ?? new Point()]) |
|
124 | + new LineString() : ($this->isClosed() ? |
|
125 | + new MultiPoint() : new MultiPoint([$this->startPoint() ?? new Point(), $this->endPoint() ?? new Point()]) |
|
128 | 126 | ); |
129 | 127 | } |
130 | 128 |
@@ -68,7 +68,7 @@ |
||
68 | 68 | public function read(string $gpx, array $allowedElements = []): Geometry |
69 | 69 | { |
70 | 70 | // Converts XML tags to lower-case (DOMDocument functions are case sensitive) |
71 | - $gpx = preg_replace_callback("/(<\/?\w+)(.*?>)/", function ($m) { |
|
71 | + $gpx = preg_replace_callback("/(<\/?\w+)(.*?>)/", function($m) { |
|
72 | 72 | return strtolower($m[1]) . $m[2]; |
73 | 73 | }, $gpx); |
74 | 74 |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $length = 0.0; |
124 | 124 | $points = $this->getPoints(); |
125 | 125 | $numPoints = count($points) - 1; |
126 | - for ($i = 0; $i<$numPoints; ++$i) { |
|
126 | + for ($i = 0; $i < $numPoints; ++$i) { |
|
127 | 127 | $length += sqrt( |
128 | 128 | pow(($points[$i]->getX() - $points[$i + 1]->getX()), 2) + |
129 | 129 | pow(($points[$i]->getY() - $points[$i + 1]->getY()), 2) |
@@ -277,14 +277,14 @@ discard block |
||
277 | 277 | $C = $f / 16 * $cosSqAlpha * (4 + $f * (4 - 3 * $cosSqAlpha)); |
278 | 278 | $lambdaP = $lambda; |
279 | 279 | $lambda = $L + (1 - $C) * $f * $sinAlpha * |
280 | - ($sigma + $C * $sinSigma * ($cos2SigmaM + $C * $cosSigma * (- 1 + 2 * $cos2SigmaM * $cos2SigmaM))); |
|
280 | + ($sigma + $C * $sinSigma * ($cos2SigmaM + $C * $cosSigma * (-1 + 2 * $cos2SigmaM * $cos2SigmaM))); |
|
281 | 281 | } while (abs($lambda - $lambdaP) > 1e-12 && --$iterationLimit > 0); |
282 | 282 | if ($iterationLimit == 0) { |
283 | 283 | return 0.0; // not converging |
284 | 284 | } |
285 | 285 | $uSq = $cosSqAlpha * ($a * $a - $b * $b) / ($b * $b); |
286 | - $A = 1 + $uSq / 16384 * (4096 + $uSq * (- 768 + $uSq * (320 - 175 * $uSq))); |
|
287 | - $B = $uSq / 1024 * (256 + $uSq * (- 128 + $uSq * (74 - 47 * $uSq))); |
|
286 | + $A = 1 + $uSq / 16384 * (4096 + $uSq * (-768 + $uSq * (320 - 175 * $uSq))); |
|
287 | + $B = $uSq / 1024 * (256 + $uSq * (-128 + $uSq * (74 - 47 * $uSq))); |
|
288 | 288 | $deltaSigma = $B * $sinSigma * ($cos2SigmaM + $B / 4 * |
289 | 289 | ($cosSigma * (-1 + 2 * $cos2SigmaM * $cos2SigmaM) - $B / 6 |
290 | 290 | * $cos2SigmaM * (-3 + 4 * $sinSigma * $sinSigma) |