/** * @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; }
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()); }