@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | public function read(string $gpx, array $allowedElements = []): Geometry |
| 68 | 68 | { |
| 69 | 69 | // Converts XML tags to lower-case (DOMDocument functions are case sensitive) |
| 70 | - $gpx = preg_replace_callback("/(<\/?\w+)(.*?>)/", function ($m) { |
|
| 70 | + $gpx = preg_replace_callback("/(<\/?\w+)(.*?>)/", function($m) { |
|
| 71 | 71 | return strtolower($m[1]) . $m[2]; |
| 72 | 72 | }, $gpx); |
| 73 | 73 | |
@@ -217,14 +217,13 @@ discard block |
||
| 217 | 217 | $points[] = $this->parsePoint($trkpt); |
| 218 | 218 | } |
| 219 | 219 | // Avoids creating invalid LineString |
| 220 | - if (count($points)>1) { |
|
| 220 | + if (count($points) > 1) { |
|
| 221 | 221 | $segments[] = new LineString($points); |
| 222 | 222 | } |
| 223 | 223 | } |
| 224 | 224 | if (!empty($segments)) { |
| 225 | 225 | $track = count($segments) === 1 ? |
| 226 | - $segments[0] : |
|
| 227 | - new MultiLineString($segments); |
|
| 226 | + $segments[0] : new MultiLineString($segments); |
|
| 228 | 227 | $track->setData($this->parseNodeProperties($trk, $this->gpxTypes->get('trkType'))); |
| 229 | 228 | $track->setData('gpxType', 'track'); |
| 230 | 229 | $tracks[] = $track; |
@@ -440,7 +439,7 @@ discard block |
||
| 440 | 439 | { |
| 441 | 440 | $metadata = self::processGeometryData($geometry, $this->gpxTypes->get('metadataType')); |
| 442 | 441 | $metadata = empty($metadata) || !in_array('metadataType', $this->gpxTypes->get('gpxType')) ? |
| 443 | - '' : "<metadata>\n" . $metadata. "</metadata>\n\n"; |
|
| 442 | + '' : "<metadata>\n" . $metadata . "</metadata>\n\n"; |
|
| 444 | 443 | $wayPoints = $routes = $tracks = ""; |
| 445 | 444 | |
| 446 | 445 | foreach ($geometry->getComponents() as $component) { |
@@ -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) { |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | // First char is a tab, space or carriage-return. trim it and try again |
| 380 | - if (in_array($bytes[1], [9,10,32], true)) { |
|
| 380 | + if (in_array($bytes[1], [9, 10, 32], true)) { |
|
| 381 | 381 | $input = ltrim($input); |
| 382 | 382 | return geoPHP::detectFormat($input); |
| 383 | 383 | } |
@@ -445,7 +445,7 @@ discard block |
||
| 445 | 445 | |
| 446 | 446 | // We need an 8 byte string for geohash and unpacked WKB / WKT |
| 447 | 447 | fseek($mem, 0); |
| 448 | - $string = trim((string)fread($mem, 8)); |
|
| 448 | + $string = trim((string) fread($mem, 8)); |
|
| 449 | 449 | |
| 450 | 450 | // Detect geohash - geohash ONLY contains lowercase chars and numerics |
| 451 | 451 | $matches = []; |
@@ -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 | |