format() public method

public format ( Coordinate $coordinate ) : string
$coordinate Location\Coordinate
return string
Example #1
0
 /**
  * @covers Location\Formatter\Coordinate\DecimalDegrees::format
  */
 public function testIfSetSeparatorWorksAsExpected()
 {
     $coordinate = new Coordinate(52.5, 13.5);
     $formatter = new DecimalDegrees();
     $formatter->setSeparator("/");
     $this->assertEquals("52.50000/13.50000", $formatter->format($coordinate));
 }
 /**
  * @covers Location\Formatter\Coordinate\DecimalDegrees::format
  */
 public function testFormatCustomSeparator()
 {
     $coordinate = new Coordinate(52.5, 13.5);
     $formatter = new DecimalDegrees(", ");
     $this->assertEquals("52.50000, 13.50000", $formatter->format($coordinate));
 }
Example #3
0
 /**
  * @covers Location\Formatter\DecimalDegrees::format
  */
 public function testFormatPrecision()
 {
     $coordinate = new Coordinate(52.123456789012344, 13.123456789012344);
     $json = '{ "type" : "Point" , "coordinates" : [ 13.123456789012345, 52.123456789012345 ] }';
     $this->assertJsonStringEqualsJsonString($json, $this->formatter->format($coordinate));
 }