/** * Returns an object to be used by `json_encode` to serialize objects of this class. * * @return object * * @see http://php.net/manual/en/jsonserializable.jsonserialize.php JsonSerializable::jsonSerialize */ public function jsonSerialize() { $obj = new \stdClass(); if ($this->id !== null) { $obj->id = $this->id; } if ($this->type !== null) { $obj->type = $this->type; } if ($this->space !== null) { $obj->space = (object) ['sys' => (object) ['type' => 'Link', 'linkType' => 'Space', 'id' => $this->space->getId()]]; } if ($this->contentType !== null) { $obj->contentType = (object) ['sys' => (object) ['type' => 'Link', 'linkType' => 'ContentType', 'id' => $this->contentType->getId()]]; } if ($this->revision !== null) { $obj->revision = $this->revision; } if ($this->createdAt !== null) { $obj->createdAt = $this->formatDateForJson($this->createdAt); } if ($this->updatedAt !== null) { $obj->updatedAt = $this->formatDateForJson($this->updatedAt); } if ($this->deletedAt !== null) { $obj->deletedAt = $this->formatDateForJson($this->deletedAt); } return $obj; }