Code Duplication    Length = 14-14 lines in 2 locations

src/Polygon.php 1 location

@@ 196-209 (lines=14) @@
193
     *
194
     * @return float
195
     */
196
    public function getPerimeter(DistanceInterface $calculator): float
197
    {
198
        $perimeter = 0.0;
199
200
        if (count($this->points) < 2) {
201
            return $perimeter;
202
        }
203
204
        foreach ($this->getSegments() as $segment) {
205
            $perimeter += $segment->getLength($calculator);
206
        }
207
208
        return $perimeter;
209
    }
210
211
    /**
212
     * Calculates the polygon area.

src/Polyline.php 1 location

@@ 133-146 (lines=14) @@
130
     *
131
     * @return float
132
     */
133
    public function getLength(DistanceInterface $calculator): float
134
    {
135
        $distance = 0.0;
136
137
        if (count($this->points) <= 1) {
138
            return $distance;
139
        }
140
141
        foreach ($this->getSegments() as $segment) {
142
            $distance += $segment->getLength($calculator);
143
        }
144
145
        return $distance;
146
    }
147
148
    /**
149
     * Create a new polyline with reversed order of points, i. e. reversed