@fleetbase/fleetops-engine 0.4.10 → 0.4.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/composer.json
CHANGED
package/extension.json
CHANGED
package/package.json
CHANGED
|
@@ -17,9 +17,9 @@ namespace Fleetbase\FleetOps\Support;
|
|
|
17
17
|
class DistanceMatrix
|
|
18
18
|
{
|
|
19
19
|
public ?float $distance;
|
|
20
|
-
public ?
|
|
20
|
+
public ?float $time;
|
|
21
21
|
|
|
22
|
-
public function __construct(?float $distance, ?
|
|
22
|
+
public function __construct(?float $distance, ?float $time)
|
|
23
23
|
{
|
|
24
24
|
$this->distance = $distance;
|
|
25
25
|
$this->time = $time;
|
|
@@ -783,8 +783,8 @@ class Utils extends FleetbaseUtils
|
|
|
783
783
|
]
|
|
784
784
|
)->json();
|
|
785
785
|
|
|
786
|
-
$distance = data_get($response, 'rows.0.elements.0.distance.value');
|
|
787
|
-
$time = data_get($response, 'rows.0.elements.0.duration.value');
|
|
786
|
+
$distance = (float) data_get($response, 'rows.0.elements.0.distance.value', 0);
|
|
787
|
+
$time = (float) data_get($response, 'rows.0.elements.0.duration.value', 0);
|
|
788
788
|
|
|
789
789
|
$result = static::createObject(
|
|
790
790
|
[
|
|
@@ -812,7 +812,7 @@ class Utils extends FleetbaseUtils
|
|
|
812
812
|
$destination = static::getPointFromMixed($destination);
|
|
813
813
|
|
|
814
814
|
$distance = Utils::vincentyGreatCircleDistance($origin, $destination);
|
|
815
|
-
$time = round($distance / 100) * self::DRIVING_TIME_MULTIPLIER;
|
|
815
|
+
$time = (float) round($distance / 100) * self::DRIVING_TIME_MULTIPLIER;
|
|
816
816
|
|
|
817
817
|
return new DistanceMatrix($distance, $time);
|
|
818
818
|
}
|