Location\Polyline::getReverse PHP Method

getReverse() public method

Create a new polyline with reversed order of points, i. e. reversed polyline direction.
public getReverse ( ) : Polyline
return Polyline
    public function getReverse()
    {
        $reversed = new static();
        foreach (array_reverse($this->points) as $point) {
            $reversed->addPoint($point);
        }
        return $reversed;
    }

Usage Example

Beispiel #1
0
 public function testReverseTwiceWorksAsExpected()
 {
     $doubleReversed = $this->polyline->getReverse()->getReverse();
     $this->assertEquals($this->polyline, $doubleReversed);
 }