Code Duplication    Length = 14-14 lines in 2 locations

src/Polygon.php 1 location

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

src/Polyline.php 1 location

@@ 83-96 (lines=14) @@
80
     *
81
     * @return float
82
     */
83
    public function getLength(DistanceInterface $calculator): float
84
    {
85
        $distance = 0.0;
86
87
        if (count($this->points) <= 1) {
88
            return $distance;
89
        }
90
91
        foreach ($this->getSegments() as $segment) {
92
            $distance += $segment->getLength($calculator);
93
        }
94
95
        return $distance;
96
    }
97
98
    /**
99
     * Create a new polyline with reversed order of points, i. e. reversed