src/Workout/Track.php
private function recomputeLength(): float
    {
        $this->length = 0;

        $trackPoints = $this->trackPoints();
        $trackPointsCount = count($trackPoints);
        if ($trackPointsCount < 2) {
            return 0;
        }

        for ($i = 1; $i < $trackPointsCount; $i++) {
            $previousTrack = $trackPoints[$i - 1];
            $currentTrack = $trackPoints[$i];

            $this->length += $currentTrack->distanceFromPoint($previousTrack);
        }

        $this->length = round($this->length, 6);

        return $this->length;
    }
private function recomputeLength(): float
    {
        $this->length = 0;

        $trackPoints = $this->trackPoints();
        $trackPointsCount = count($trackPoints);
        if ($trackPointsCount < 2) {
            return 0;
        }

        for ($i = 1; $i < $trackPointsCount; $i++) {
            $previousTrack = $trackPoints[$i - 1];
            $currentTrack = $trackPoints[$i];

            $this->length += $currentTrack->distanceFromPoint($previousTrack);
        }

        $this->length = round($this->length, 6);

        return $this->length;
    }
private function recomputeLength ( ) : float { $ this -> length = 0 ; $ trackPoints = $ this -> trackPoints ( ) ; $ trackPointsCount = count ( $ trackPoints ) ; if ( $ trackPointsCount < 2 ) { return 0 ; } for ( $ i = 1 ; $ i < $ trackPointsCount ; $ i ++ ) { $ previousTrack = $ trackPoints [ $ i - 1 ] ; $ currentTrack = $ trackPoints [ $ i ] ; $ this -> length += $ currentTrack -> distanceFromPoint ( $ previousTrack ) ; } $ this -> length = round ( $ this -> length , 6 ) ; return $ this -> length ; }
Recompute the length of the track.

@return float
Recompute the length of the track .