Esempio n. 1
0
 public function testGeoPointType()
 {
     $message = NestedMessage::create();
     $geoJson = '{"type":"Point","coordinates":[102.0,0.5]}';
     $point = GeoPoint::fromArray(json_decode($geoJson, true));
     $message->set('location', $point);
     $this->assertSame($message->get('location')->getLatitude(), 0.5);
     $this->assertSame($message->get('location')->getLongitude(), 102.0);
     $this->assertSame($message->toArray()['location'], $point->toArray());
 }
Esempio n. 2
0
 /**
  * @param mixed $value
  * @param Field $field
  *
  * @return GeoPoint
  */
 public function decodeGeoPoint($value, Field $field)
 {
     return GeoPoint::fromArray($value);
 }