id; } /** * @return string * * @since 1.0.0 */ public function getPath() : string { return $this->path; } /** * @param string $path * * @return mixed * * @since 1.0.0 */ public function setPath(string $path) { $this->path = $path; } /** * @return mixed * * @since 1.0.0 */ public function getMedia() { return $this->media; } /** * @param mixed $media * * @since 1.0.0 */ public function setMedia($media) { $this->media = $media; } public function toArray() : array { return [ 'id' => $this->id, 'path' => $this->path, 'media' => $this->media->toArray(), ]; } public function __toString() { return json_encode($this->toArray()); } public function jsonSerialize() { return $this->toArray(); } public static function fromMedia(Media $media) { $image = new self(); $image->setMedia($media); return $image; } }