createdBy = new NullAccount(); $this->createdAt = new \DateTime('now'); } /** * Get the content * * @return string * * @since 1.0.0 */ public function getContent() : string { return $this->content; } /** * Set the content * * @param string $content Content * * @return void * * @since 1.0.0 */ public function setContent(string $content) : void { $this->content = $content; } /** * Set the plain text * * @param string $plain Plain text * * @return void * * @since 1.0.0 */ public function setPlain(string $plain) : void { $this->plain = $plain; } /** * Get the plain text * * @return string * * @since 1.0.0 */ public function getPlain() : string { return $this->plain; } /** * Get created at * * @return \DateTime * * @since 1.0.0 */ public function getCreatedAt() : \DateTime { return $this->createdAt; } /** * Get the id * * @return int * * @since 1.0.0 */ public function getId() : int { return $this->id; } /** * Get created by * * @return Account * * @since 1.0.0 */ public function getCreatedBy() : Account { return $this->createdBy; } /** * Set created by * * @param Account $account Creator * * @since 1.0.0 */ public function setCreatedBy(Account $account) : void { $this->createdBy = $account; } /** * Get the title * * @return string * * @since 1.0.0 */ public function getTitle() : string { return $this->title; } /** * Set the title * * @param string $title Title * * @return mixed * * @since 1.0.0 */ public function setTitle(string $title) { $this->title = $title; } /** * Get the path * * @return string * * @since 1.0.0 */ public function getPath() : string { return $this->path; } /** * Set the path if file * * @param string $path Path to file * * @return mixed * * @since 1.0.0 */ public function setPath(string $path) { $this->path = $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; } /** * {@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() { return $this->toArray(); } }