From 617bbd2832cc152193d7833610d177be7072b041 Mon Sep 17 00:00:00 2001 From: Sander Verbrugge <32176563+sandcore-dev@users.noreply.github.com> Date: Wed, 22 Jan 2020 23:31:45 +0100 Subject: [PATCH 1/3] Added helper function and test for filtering out null values in toArray/JSON output --- src/phpGPX/Helpers/SerializationHelper.php | 17 +++ src/phpGPX/Models/GpxFile.php | 4 +- .../Helpers/SerializationHelperTest.php | 102 +++++++++++++----- 3 files changed, 97 insertions(+), 26 deletions(-) diff --git a/src/phpGPX/Helpers/SerializationHelper.php b/src/phpGPX/Helpers/SerializationHelper.php index f73fe8f..5ef7805 100644 --- a/src/phpGPX/Helpers/SerializationHelper.php +++ b/src/phpGPX/Helpers/SerializationHelper.php @@ -65,4 +65,21 @@ public static function serialize($object) return $object != null ? $object->toArray() : null; } } + + public static function filterNotNull(array $array) + { + foreach ($array as &$item) { + if (!is_array($item)) { + continue; + } + + $item = self::filterNotNull($item); + } + + $array = array_filter($array, function ($item) { + return $item !== null && (!is_array($item) || count($item)); + }); + + return $array; + } } diff --git a/src/phpGPX/Models/GpxFile.php b/src/phpGPX/Models/GpxFile.php index 7028faf..5ebda5f 100644 --- a/src/phpGPX/Models/GpxFile.php +++ b/src/phpGPX/Models/GpxFile.php @@ -77,14 +77,14 @@ public function __construct() */ public function toArray() { - return [ + return SerializationHelper::filterNotNull([ 'creator' => SerializationHelper::stringOrNull($this->creator), 'metadata' => SerializationHelper::serialize($this->metadata), 'waypoints' => SerializationHelper::serialize($this->waypoints), 'routes' => SerializationHelper::serialize($this->routes), 'tracks' => SerializationHelper::serialize($this->tracks), 'extensions' => SerializationHelper::serialize($this->extensions) - ]; + ]); } /** diff --git a/tests/UnitTests/phpGPX/Helpers/SerializationHelperTest.php b/tests/UnitTests/phpGPX/Helpers/SerializationHelperTest.php index 048d69e..d925515 100644 --- a/tests/UnitTests/phpGPX/Helpers/SerializationHelperTest.php +++ b/tests/UnitTests/phpGPX/Helpers/SerializationHelperTest.php @@ -10,30 +10,84 @@ class SerializationHelperTest extends TestCase { - public function testIntegerOrNull() - { - $this->assertNull(SerializationHelper::integerOrNull("")); - $this->assertNull(SerializationHelper::integerOrNull(null)); - $this->assertNull(SerializationHelper::integerOrNull("BLA")); - $this->assertInternalType("int", SerializationHelper::integerOrNull(5)); - $this->assertInternalType("int", SerializationHelper::integerOrNull("5")); - } + public function testIntegerOrNull() + { + $this->assertNull(SerializationHelper::integerOrNull("")); + $this->assertNull(SerializationHelper::integerOrNull(null)); + $this->assertNull(SerializationHelper::integerOrNull("BLA")); + $this->assertInternalType("int", SerializationHelper::integerOrNull(5)); + $this->assertInternalType("int", SerializationHelper::integerOrNull("5")); + } - public function testFloatOrNull() - { - $this->assertNull(SerializationHelper::floatOrNull("")); - $this->assertNull(SerializationHelper::floatOrNull(null)); - $this->assertNull(SerializationHelper::floatOrNull("BLA")); - $this->assertInternalType("float", SerializationHelper::floatOrNull(5.6)); - $this->assertInternalType("float", SerializationHelper::floatOrNull(5)); - $this->assertInternalType("float", SerializationHelper::floatOrNull("5.6")); - $this->assertInternalType("float", SerializationHelper::floatOrNull("5")); - } + public function testFloatOrNull() + { + $this->assertNull(SerializationHelper::floatOrNull("")); + $this->assertNull(SerializationHelper::floatOrNull(null)); + $this->assertNull(SerializationHelper::floatOrNull("BLA")); + $this->assertInternalType("float", SerializationHelper::floatOrNull(5.6)); + $this->assertInternalType("float", SerializationHelper::floatOrNull(5)); + $this->assertInternalType("float", SerializationHelper::floatOrNull("5.6")); + $this->assertInternalType("float", SerializationHelper::floatOrNull("5")); + } - public function testStringOrNull() - { - $this->assertNull(SerializationHelper::stringOrNull(null)); - $this->assertInternalType("string", SerializationHelper::stringOrNull("")); - $this->assertInternalType("string", SerializationHelper::stringOrNull("Bla bla")); - } + public function testStringOrNull() + { + $this->assertNull(SerializationHelper::stringOrNull(null)); + $this->assertInternalType("string", SerializationHelper::stringOrNull("")); + $this->assertInternalType("string", SerializationHelper::stringOrNull("Bla bla")); + } + + /** + * @dataProvider dataProviderFilterNotNull + */ + public function testFilterNotNull($expected, $actual) + { + $this->assertEquals($expected, SerializationHelper::filterNotNull($actual)); + } + + public function dataProviderFilterNotNull() + { + return [ + 'numeric 1' => [ + [], + [null], + ], + 'numeric 2' => [ + [], + [null, [null]], + ], + 'numeric 3' => [ + [1 => 1], + [null, 1], + ], + 'numeric 4' => [ + [1 => 1, 3 => 2], + [null, 1, null, 2, null], + ], + 'numeric 5' => [ + [1 => 1, 3 => 2, 5 => [0 => 3, 2 => 4], 6 => 5], + [null, 1, null, 2, null, [3, null, 4], 5, null], + ], + 'associative 1' => [ + [], + ["foo" => null], + ], + 'associative 2' => [ + [], + ["foo" => null, ["bar" => null]], + ], + 'associative 3' => [ + ["bar" => 1], + ["foo" => null, "bar" => 1], + ], + 'associative 4' => [ + ["bar" => 1, "caw" => 2], + ["foo" => null, "bar" => 1, "baz" => null, "caw" => 2, "doo" => null], + ], + 'associative 5' => [ + ["bar" => 1, "caw" => 2, "ere" => ["foo" => 3, "baz" => 4], "moo" => 5], + ["foo" => null, "bar" => 1, "baz" => null, "caw" => 2, "doo" => null, "ere" => ["foo" => 3, "bar" => null, "baz" => 4], "moo" => 5, "boo" => null], + ], + ]; + } } From 1f00ff457e948ed74b5fc9a1e7383182fff936d0 Mon Sep 17 00:00:00 2001 From: Jakub Dubec Date: Sat, 7 Nov 2020 20:35:20 +0100 Subject: [PATCH 2/3] =?UTF-8?q?1.0=20release=20=F0=9F=98=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 11 ++++++++++- README.md | 2 +- composer.json | 4 ++-- example/Example.php | 4 ++-- src/phpGPX/Parsers/ExtensionParser.php | 3 ++- src/phpGPX/phpGPX.php | 2 +- tests/CreateWaypointTest.php | 1 - .../UnitTests/phpGPX/Parsers/CopyrightParserTest.php | 5 +++-- 8 files changed, 21 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index faae408..fa5e6b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 1.0 + +I am not very proud of idea having a major release in such terrible state. This release is just freeze from 2017 +compatible API and behaviour with some bugfixies. It looks like some people use the library and I want to perform some +radical refactoring. See you in `2.x`. + +- **Fix**: Do not return extra `:` while parsing unsupported extensions if there is no namespace for child element +- **Fix**: Fixed Copyright test + ## 1.0-RC5 - **Change:** Moved PHPUnit to development dependencies. @@ -27,4 +36,4 @@ ## 1.0-RC1 -Initial release \ No newline at end of file +Initial release diff --git a/README.md b/README.md index c2765ca..3730d3c 100644 --- a/README.md +++ b/README.md @@ -196,7 +196,7 @@ Currently supported output formats: You can easily install phpGPX library with composer. There is no stable release yet, so please use release candidates. ``` -composer require sibyx/phpgpx:@RC +composer require sibyx/phpgpx:@1.0 ``` ## Configuration diff --git a/composer.json b/composer.json index 0d0c885..5b1dd90 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "sibyx/phpgpx", "type": "library", - "version": "1.0-RC5", + "version": "1.0", "description": "A simple PHP library for GPX import/export", "minimum-stability": "stable", "license": "MIT", @@ -13,7 +13,7 @@ } ], "require": { - "php": ">=5.4", + "php": ">=5.5", "lib-libxml": "*", "ext-simplexml": "*", "ext-dom": "*" diff --git a/example/Example.php b/example/Example.php index c42abba..c08b5f0 100644 --- a/example/Example.php +++ b/example/Example.php @@ -9,10 +9,10 @@ require_once '../vendor/autoload.php'; $gpx = new phpGPX(); -$file = $gpx->load('Evening_Ride.gpx'); +$file = $gpx->load('endomondo.gpx'); phpGPX::$PRETTY_PRINT = true; -$file->save('output_Evening_Ride.gpx', phpGPX::XML_FORMAT); +//$file->save('output_Evening_Ride.gpx', phpGPX::XML_FORMAT); foreach ($file->tracks as $track) { var_dump($track->stats->toArray()); diff --git a/src/phpGPX/Parsers/ExtensionParser.php b/src/phpGPX/Parsers/ExtensionParser.php index 7528a74..bb1b144 100644 --- a/src/phpGPX/Parsers/ExtensionParser.php +++ b/src/phpGPX/Parsers/ExtensionParser.php @@ -41,7 +41,8 @@ public static function parse($nodes) break; default: foreach ($nodes->children($namespace) as $child_key => $value) { - $extensions->unsupported["$key:$child_key"] = (string) $value; + + $extensions->unsupported[$key ? "$key:$child_key" : "$child_key"] = (string) $value; } } } diff --git a/src/phpGPX/phpGPX.php b/src/phpGPX/phpGPX.php index 0d8ee62..7132738 100644 --- a/src/phpGPX/phpGPX.php +++ b/src/phpGPX/phpGPX.php @@ -22,7 +22,7 @@ class phpGPX const XML_FORMAT = 'xml'; const PACKAGE_NAME = 'phpGPX'; - const VERSION = '1.0RC5'; + const VERSION = '1.0'; /** * Create Stats object for each track, segment and route diff --git a/tests/CreateWaypointTest.php b/tests/CreateWaypointTest.php index 9ba0705..0259653 100644 --- a/tests/CreateWaypointTest.php +++ b/tests/CreateWaypointTest.php @@ -1,5 +1,4 @@ */ -namespace UnitTests\phpGPX\Parsers; +namespace phpGPX\Tests\UnitTests\phpGPX\Parsers; use phpGPX\Models\Copyright; use phpGPX\Parsers\CopyrightParser; +use UnitTests\phpGPX\Parsers\AbstractParserTest; class CopyrightParserTest extends AbstractParserTest { @@ -24,7 +25,7 @@ public static function createTestInstance() $copyright->author = "Jakub Dubec"; $copyright->license = "https://github.com/Sibyx/phpGPX/blob/master/LICENSE"; - $copyright->year = 2017; + $copyright->year = '2017'; return $copyright; } From 58d5eb970c8287b252897e737d7fa5c428aa6aa9 Mon Sep 17 00:00:00 2001 From: Sander Verbrugge <32176563+sandcore-dev@users.noreply.github.com> Date: Mon, 23 Nov 2020 22:30:29 +0100 Subject: [PATCH 3/3] Changed expected arrays to reflect SerializationHelper changes --- tests/LoadFileTest.php | 172 +----------------------------------- tests/LoadRouteFileTest.php | 169 ----------------------------------- 2 files changed, 2 insertions(+), 339 deletions(-) diff --git a/tests/LoadFileTest.php b/tests/LoadFileTest.php index 413fef4..3e398a9 100644 --- a/tests/LoadFileTest.php +++ b/tests/LoadFileTest.php @@ -23,34 +23,14 @@ public function testLoadXmlFileGeneratedByTimezero() private function createExpectedArray() { return [ - 'creator' => null, - 'metadata' => null, 'waypoints' => [ [ 'lat' => 49.3636333333086, 'lon' => 0.0800866666666667, - 'ele' => null, 'time' => '2014-12-13T16:32:51+00:00', - 'magvar' => null, - 'geoidheight' => null, 'name' => 'Event 0000', - 'cmt' => null, - 'desc' => null, - 'src' => null, - 'link' => [], - 'sym' => null, - 'type' => null, - 'fix' => null, - 'sat' => null, - 'hdop' => null, - 'vdop' => null, - 'pdop' => null, - 'ageofdgpsdata' => null, - 'dgpsid' => null, - 'difference' => null, - 'distance' => null, + 'cmt' => '', 'extensions' => [ - 'trackpoint' => null, 'unsupported' => [ 'MxTimeZeroSymbol' => 10, 'color' => -16744448, @@ -60,28 +40,10 @@ private function createExpectedArray() [ 'lat' => 49.3636333333086, 'lon' => 0.0800866666666667, - 'ele' => null, 'time' => '2014-12-13T16:32:52+00:00', - 'magvar' => null, - 'geoidheight' => null, 'name' => 'Event 0001', - 'cmt' => null, - 'desc' => null, - 'src' => null, - 'link' => [], - 'sym' => null, - 'type' => null, - 'fix' => null, - 'sat' => null, - 'hdop' => null, - 'vdop' => null, - 'pdop' => null, - 'ageofdgpsdata' => null, - 'dgpsid' => null, - 'difference' => null, - 'distance' => null, + 'cmt' => '', 'extensions' => [ - 'trackpoint' => null, 'unsupported' => [ 'MxTimeZeroSymbol' => 10, 'color' => -16744448, @@ -89,18 +51,10 @@ private function createExpectedArray() ], ], ], - 'routes' => [], 'tracks' => [ [ 'name' => 'Ownship', - 'cmt' => null, - 'desc' => null, - 'src' => null, - 'link' => [], - 'number' => null, - 'type' => null, 'extensions' => [ - 'trackpoint' => null, 'unsupported' => [ 'guid' => 201, ], @@ -111,80 +65,23 @@ private function createExpectedArray() [ 'lat' => 49.3635449998312, 'lon' => 0.0801483333364938, - 'ele' => null, 'time' => '2010-01-01T14:48:37+00:00', - 'magvar' => null, - 'geoidheight' => null, - 'name' => null, - 'cmt' => null, - 'desc' => null, - 'src' => null, - 'link' => array(), - 'sym' => null, - 'type' => null, - 'fix' => null, - 'sat' => null, - 'hdop' => null, - 'vdop' => null, - 'pdop' => null, - 'ageofdgpsdata' => null, - 'dgpsid' => null, - 'difference' => null, - 'distance' => 0.0, - 'extensions' => null, ], [ 'lat' => 49.3635350651798, 'lon' => 0.0801416666698513, - 'ele' => null, 'time' => '2010-01-01T14:48:40+00:00', - 'magvar' => null, - 'geoidheight' => null, - 'name' => null, - 'cmt' => null, - 'desc' => null, - 'src' => null, - 'link' => array(), - 'sym' => null, - 'type' => null, - 'fix' => null, - 'sat' => null, - 'hdop' => null, - 'vdop' => null, - 'pdop' => null, - 'ageofdgpsdata' => null, - 'dgpsid' => null, 'difference' => 1.2055693602077022, 'distance' => 1.2055693602077022, - 'extensions' => null, ], [ 'lat' => 49.3635266991555, 'lon' => 0.0801333333365323, - 'ele' => null, 'time' => '2010-01-01T14:48:46+00:00', - 'magvar' => null, - 'geoidheight' => null, - 'name' => null, - 'cmt' => null, - 'desc' => null, - 'src' => null, - 'link' => array(), - 'sym' => null, - 'type' => null, - 'fix' => null, - 'sat' => null, - 'hdop' => null, - 'vdop' => null, - 'pdop' => null, - 'ageofdgpsdata' => null, - 'dgpsid' => null, 'difference' => 1.1088552014759407, 'distance' => 2.314424561683643, - 'extensions' => null, ], ], - 'extensions' => null, 'stats' => [ 'distance' => 2.314424561683643, 'avgSpeed' => 0.2571582846315159, @@ -214,14 +111,7 @@ private function createExpectedArray() ], [ 'name' => 'Ownship', - 'cmt' => null, - 'desc' => null, - 'src' => null, - 'link' => [], - 'number' => null, - 'type' => null, 'extensions' => [ - 'trackpoint' => null, 'unsupported' => [ 'guid' => 102, ], @@ -232,80 +122,23 @@ private function createExpectedArray() [ 'lat' => 49.4574117319429, 'lon' => 0.0343682156842231, - 'ele' => null, 'time' => '2016-04-03T14:13:09+00:00', - 'magvar' => null, - 'geoidheight' => null, - 'name' => null, - 'cmt' => null, - 'desc' => null, - 'src' => null, - 'link' => array(), - 'sym' => null, - 'type' => null, - 'fix' => null, - 'sat' => null, - 'hdop' => null, - 'vdop' => null, - 'pdop' => null, - 'ageofdgpsdata' => null, - 'dgpsid' => null, - 'difference' => null, - 'distance' => 0.0, - 'extensions' => null, ], [ 'lat' => 49.4573966992346, 'lon' => 0.0343466078409025, - 'ele' => null, 'time' => '2016-04-03T14:13:10+00:00', - 'magvar' => null, - 'geoidheight' => null, - 'name' => null, - 'cmt' => null, - 'desc' => null, - 'src' => null, - 'link' => array(), - 'sym' => null, - 'type' => null, - 'fix' => null, - 'sat' => null, - 'hdop' => null, - 'vdop' => null, - 'pdop' => null, - 'ageofdgpsdata' => null, - 'dgpsid' => null, 'difference' => 2.2876315307770505, 'distance' => 2.2876315307770505, - 'extensions' => null, ], [ 'lat' => 49.4573700325059, 'lon' => 0.0342948235267376, - 'ele' => null, 'time' => '2016-04-03T14:13:12+00:00', - 'magvar' => null, - 'geoidheight' => null, - 'name' => null, - 'cmt' => null, - 'desc' => null, - 'src' => null, - 'link' => array(), - 'sym' => null, - 'type' => null, - 'fix' => null, - 'sat' => null, - 'hdop' => null, - 'vdop' => null, - 'pdop' => null, - 'ageofdgpsdata' => null, - 'dgpsid' => null, 'difference' => 4.775098771720203, 'distance' => 7.062730302497254, - 'extensions' => null, ], ], - 'extensions' => null, 'stats' => [ 'distance' => 7.062730302497254, 'avgSpeed' => 2.354243434165751, @@ -334,7 +167,6 @@ private function createExpectedArray() ], ], ], - 'extensions' => null, ]; } } diff --git a/tests/LoadRouteFileTest.php b/tests/LoadRouteFileTest.php index 649e639..d7e00aa 100644 --- a/tests/LoadRouteFileTest.php +++ b/tests/LoadRouteFileTest.php @@ -50,125 +50,40 @@ private function createExpectedArray() 'creator' => 'RouteConverter', 'metadata' => [ 'name' => 'Test file by Patrick', - 'desc' => null, - 'author' => null, - 'copyright' => null, - 'links' => null, - 'time' => null, - 'keywords' => null, - 'bounds' => null, - 'extensions' => null ], 'routes' => [ [ 'name' => "Patrick's Route", - 'cmt' => null, - 'desc' => null, - 'src' => null, - 'link' => [], - 'number' => null, - 'type' => null, - 'extensions' => null, 'rtep' => [ [ 'lat' => 54.9328621088893, 'lon' => 9.860624216140083, 'ele' => 0.0, - 'time' => null, - 'magvar' => null, - 'geoidheight' => null, 'name' => 'Position 1', - 'cmt' => null, - 'desc' => null, - 'src' => null, - 'link' => [], - 'sym' => null, - 'type' => null, - 'fix' => null, - 'sat' => null, - 'hdop' => null, - 'vdop' => null, - 'pdop' => null, - 'ageofdgpsdata' => null, - 'dgpsid' => null, - 'difference' => 0.0, - 'distance' => 0.0, - 'extensions' => null ], [ 'lat' => 54.93293237320851, 'lon' => 9.86092208681491, 'ele' => 1.0, - 'time' => null, - 'magvar' => null, - 'geoidheight' => null, 'name' => 'Position 2', - 'cmt' => null, - 'desc' => null, - 'src' => null, - 'link' => [], - 'sym' => null, - 'type' => null, - 'fix' => null, - 'sat' => null, - 'hdop' => null, - 'vdop' => null, - 'pdop' => null, - 'ageofdgpsdata' => null, - 'dgpsid' => null, 'difference' => 20.57107116626639, 'distance' => 20.57107116626639, - 'extensions' => null, ], [ 'lat' => 54.93327743521187, 'lon' => 9.86187816543752, 'ele' => 2.0, - 'time' => null, - 'magvar' => null, - 'geoidheight' => null, 'name' => 'Position 3', - 'cmt' => null, - 'desc' => null, - 'src' => null, - 'link' => [], - 'sym' => null, - 'type' => null, - 'fix' => null, - 'sat' => null, - 'hdop' => null, - 'vdop' => null, - 'pdop' => null, - 'ageofdgpsdata' => null, - 'dgpsid' => null, 'difference' => 72.1308280496404, 'distance' => 92.70189921590679, - 'extensions' => null, ], [ 'lat' => 54.93342326167919, 'lon' => 9.862439849679859, 'ele' => 3.0, - 'time' => null, - 'magvar' => null, - 'geoidheight' => null, 'name' => 'Position 4', - 'cmt' => null, - 'desc' => null, - 'src' => null, - 'link' => [], - 'sym' => null, - 'type' => null, - 'fix' => null, - 'sat' => null, - 'hdop' => null, - 'vdop' => null, - 'pdop' => null, - 'ageofdgpsdata' => null, - 'dgpsid' => null, 'difference' => 39.37668614018047, 'distance' => 132.07858535608727, - 'extensions' => null, ], ], 'stats' => [ @@ -179,120 +94,41 @@ private function createExpectedArray() 'maxAltitude' => 3.0, 'cumulativeElevationGain' => 3.0, 'cumulativeElevationLoss' => 0.0, - 'startedAt' => null, - 'finishedAt' => null, 'duration' => 0.0 ] ], [ 'name' => "Sibyx's Route", - 'cmt' => null, - 'desc' => null, - 'src' => null, - 'link' => [], - 'number' => null, - 'type' => null, - 'extensions' => null, 'rtep' => [ [ 'lat' => 54.9328621088893, 'lon' => 9.860624216140083, 'ele' => 0.0, - 'time' => null, - 'magvar' => null, - 'geoidheight' => null, 'name' => 'Position 4', - 'cmt' => null, - 'desc' => null, - 'src' => null, - 'link' => [], - 'sym' => null, - 'type' => null, - 'fix' => null, - 'sat' => null, - 'hdop' => null, - 'vdop' => null, - 'pdop' => null, - 'ageofdgpsdata' => null, - 'dgpsid' => null, - 'difference' => 0.0, - 'distance' => 0.0, - 'extensions' => null, ], [ 'lat' => 54.93293237320851, 'lon' => 9.86092208681491, 'ele' => 1.0, - 'time' => null, - 'magvar' => null, - 'geoidheight' => null, 'name' => 'Position 3', - 'cmt' => null, - 'desc' => null, - 'src' => null, - 'link' => [], - 'sym' => null, - 'type' => null, - 'fix' => null, - 'sat' => null, - 'hdop' => null, - 'vdop' => null, - 'pdop' => null, - 'ageofdgpsdata' => null, - 'dgpsid' => null, 'difference' => 20.57107116626639, 'distance' => 20.57107116626639, - 'extensions' => null, ], [ 'lat' => 54.93327743521187, 'lon' => 9.86187816543752, 'ele' => 2.0, - 'time' => null, - 'magvar' => null, - 'geoidheight' => null, 'name' => 'Position 2', - 'cmt' => null, - 'desc' => null, - 'src' => null, - 'link' => [], - 'sym' => null, - 'type' => null, - 'fix' => null, - 'sat' => null, - 'hdop' => null, - 'vdop' => null, - 'pdop' => null, - 'ageofdgpsdata' => null, - 'dgpsid' => null, 'difference' => 72.1308280496404, 'distance' => 92.70189921590679, - 'extensions' => null, ], [ 'lat' => 54.93342326167919, 'lon' => 9.862439849679859, 'ele' => 3.0, - 'time' => null, - 'magvar' => null, - 'geoidheight' => null, 'name' => 'Position 1', - 'cmt' => null, - 'desc' => null, - 'src' => null, - 'link' => [], - 'sym' => null, - 'type' => null, - 'fix' => null, - 'sat' => null, - 'hdop' => null, - 'vdop' => null, - 'pdop' => null, - 'ageofdgpsdata' => null, - 'dgpsid' => null, 'difference' => 39.37668614018047, 'distance' => 132.07858535608727, - 'extensions' => null, ], ], 'stats' => [ @@ -303,15 +139,10 @@ private function createExpectedArray() 'maxAltitude' => 3.0, 'cumulativeElevationGain' => 3.0, 'cumulativeElevationLoss' => 0.0, - 'startedAt' => null, - 'finishedAt' => null, 'duration' => 0.0 ] ] ], - 'waypoints' => [], - 'tracks' => [], - 'extensions' => null ]; } }