code: public function getLength(DistanceInterface $calculator): float
      {
          $distance = 0.0;
  
          if (count($this->points) <= 1) {
              return $distance;
          }
  
          foreach ($this->getSegments() as $segment) {
              $distance += $segment->getLength($calculator);
          }
  
          return $distance;
      }
docs: Calculates the length of the polyline.
  
  @param DistanceInterface $calculator instance of distance calculation class
  
  @return float