format() public method

public format ( Polygon $polygon ) : string
$polygon Location\Polygon
return string
Beispiel #1
0
 /**
  * @covers Location\Formatter\Coordinate\DecimalDegrees::format
  */
 public function testFormatDefault()
 {
     $polygon = new Polygon();
     $polygon->addPoint(new Coordinate(10, 20));
     $polygon->addPoint(new Coordinate(20, 40));
     $polygon->addPoint(new Coordinate(30, 40));
     $polygon->addPoint(new Coordinate(30, 20));
     $json = '{ "type" : "Polygon" , "coordinates" : [ [ 20, 10 ], [ 40, 20 ], [ 40, 30 ], [ 20, 30] ] }';
     $this->assertJsonStringEqualsJsonString($json, $this->formatter->format($polygon));
 }