コード例 #1
0
 /**
  * @see http://php.net/manual/en/jsonserializable.jsonserialize.php
  */
 public function jsonSerialize()
 {
     $json = array('type' => $this->type);
     if (isset($this->crs)) {
         $json['crs'] = $this->crs->jsonSerialize();
     }
     if (isset($this->boundingBox)) {
         $json['bbox'] = $this->boundingBox->jsonSerialize();
     }
     return $json;
 }
コード例 #2
0
 public function testSerialization()
 {
     $bounds = array(-180.0, -90.0, 0.0, 180.0, 90.0, 100.0);
     $boundingBox = new BoundingBox($bounds);
     $this->assertSame($bounds, $boundingBox->getBounds());
     $this->assertSame($bounds, $boundingBox->jsonSerialize());
 }