page = [ 'uri' => (string) $page->parent()->uri(), 'title' => (string) $page->parent()->title(), ]; $this->file = [ 'uuid' => (string) $file->uuid(), ]; $this->replies = $replies ?? []; $this->text = $text; $this->author = [ 'name' => (string) $author->name(), 'email' => (string) $author->email(), 'uuid' => (string) $author->uuid(), 'role' => (string) $author->role(), ]; $this->date = $date; $this->id = $id; $this->type = $type; $this->isRead = false; $this->position = $position; } public function page() { return $this->page; } public function file() { return $this->file; } public function replies() { return $this->replies; } public function text() { return $this->text; } public function author() { return $this->author; } public function date() { return $this->date; } public function id() { return $this->id; } public function type() { return $this->type; } public function isRead() { return $this->isRead; } public function read() { $this->isRead = true; return $this->isRead; } public function unread() { $this->isRead = false; return $this->isRead; } public function pageIndex() { $this->position['pageIndex']; } public function toArray() { return [ 'page' => $this->page, 'file' => $this->file, 'replies' => $this->replies, 'text' => $this->text, 'author' => $this->author, 'position' => $this->position, 'date' => $this->date, 'id' => $this->id, 'type' => $this->type, 'isRead' => $this->isRead ]; } }