Code Duplication    Length = 14-14 lines in 2 locations

src/Polygon.php 1 location

@@ 186-199 (lines=14) @@
183
     *
184
     * @return float
185
     */
186
    public function getPerimeter(DistanceInterface $calculator): float
187
    {
188
        $perimeter = 0.0;
189
190
        if (count($this->points) < 2) {
191
            return $perimeter;
192
        }
193
194
        foreach ($this->getSegments() as $segment) {
195
            $perimeter += $segment->getLength($calculator);
196
        }
197
198
        return $perimeter;
199
    }
200
201
    /**
202
     * Calculates the polygon area.

src/Polyline.php 1 location

@@ 102-115 (lines=14) @@
99
     *
100
     * @return float
101
     */
102
    public function getLength(DistanceInterface $calculator): float
103
    {
104
        $distance = 0.0;
105
106
        if (count($this->points) <= 1) {
107
            return $distance;
108
        }
109
110
        foreach ($this->getSegments() as $segment) {
111
            $distance += $segment->getLength($calculator);
112
        }
113
114
        return $distance;
115
    }
116
117
    /**
118
     * Create a new polyline with reversed order of points, i. e. reversed