createdBy = new NullAccount(); $this->createdAt = new \DateTimeImmutable('now'); } /** * Get the id * * @return int * * @since 1.0.0 */ public function getId() : int { return $this->id; } /** * Get the path * * @return string * * @since 1.0.0 */ public function getVirtualPath() : string { return $this->virtualPath; } /** * Set the path if file * * @param string $path Path to file * * @return mixed * * @since 1.0.0 */ public function setVirtualPath(string $path) { $this->virtualPath = $path; } /** * Get tags * * @return array * * @since 1.0.0 */ public function getTags() : array { return $this->tags; } /** * Add tag * * @param Tag $tag Tag * * @return void * * @since 1.0.0 */ public function addTag(Tag $tag) : void { $this->tags[] = $tag; } /** * Get all media * * @return Media[] * * @since 1.0.0 */ public function getMedia() : array { return $this->media; } /** * Add media * * @param Media $media Media to add * * @return void * * @since 1.0.0 */ public function addMedia(Media $media) : void { $this->media[] = $media; } /** * {@inheritdoc} */ public function toArray() : array { return [ 'id' => $this->id, 'title' => $this->title, 'plain' => $this->plain, 'content' => $this->content, 'createdAt' => $this->createdAt, 'createdBy' => $this->createdBy, ]; } /** * {@inheritdoc} */ public function __toString() { return (string) \json_encode($this->toArray()); } /** * {@inheritdoc} */ public function jsonSerialize() : mixed { return $this->toArray(); } }