File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
app/Http/Controllers/Backend/Support Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -126,19 +126,18 @@ public function calculateLivePosition(): ?LivePointDto {
126
126
}
127
127
128
128
private function getDistanceFromGeoJson (stdClass $ geoJson ): int {
129
- $ fullD = 0 ;
129
+ $ fullDistance = 0 ;
130
130
$ lastStopover = null ;
131
131
foreach ($ geoJson ->features as $ stopover ) {
132
132
$ stopover = Coordinate::fromGeoJson ($ stopover );
133
- if ($ lastStopover === null ) {
133
+ if ($ lastStopover === null || $ stopover === null ) {
134
134
$ lastStopover = $ stopover ;
135
135
continue ;
136
136
}
137
- $ fullD += (new LineSegment ($ lastStopover , $ stopover ))->calculateDistance ();
137
+ $ fullDistance += (new LineSegment ($ lastStopover , $ stopover ))->calculateDistance ();
138
138
$ lastStopover = $ stopover ;
139
139
}
140
-
141
- return $ fullD ;
140
+ return $ fullDistance ;
142
141
}
143
142
144
143
/**
You can’t perform that action at this time.
0 commit comments