noteId = (string)$result->getInteger(0); $this->userId = (string)$result->getInteger(1); $this->authorId = $result->isNull(2) ? null : (string)$result->getInteger(2); $this->created = $result->getInteger(3); $this->title = $result->getString(4); $this->body = $result->getString(5); } public function getId(): string { return $this->noteId; } public function getUserId(): string { return $this->userId; } public function hasAuthorId(): bool { return $this->authorId !== null; } public function getAuthorId(): ?string { return $this->authorId; } public function getCreatedTime(): int { return $this->created; } public function getCreatedAt(): DateTime { return DateTime::fromUnixTimeSeconds($this->created); } public function getTitle(): string { return $this->title; } public function hasBody(): bool { return trim($this->body) !== ''; } public function getBody(): string { return $this->body; } public function getFirstParagraph(): string { $index = mb_strpos($this->body, "\n"); return $index === false ? $this->body : mb_substr($this->body, 0, $index); } public function hasMoreParagraphs(): bool { return mb_strpos($this->body, "\n") !== false; } }