id; } public function setId(?Uuid $id): static { $this->id = $id; return $this; } public static function idFromString(string $id): Uuid { return Uuid::fromString($id); } public function getBook(): ?string { return $this->book; } public function setBook(string $book): static { $this->book = $book; return $this; } public function getChapter(): ?int { return $this->chapter; } public function setChapter(int $chapter): static { $this->chapter = $chapter; return $this; } public function getVerse(): ?int { return $this->verse; } public function setVerse(int $verse): static { $this->verse = $verse; return $this; } public function getContent(): ?string { return $this->content; } public function setContent(?string $content): static { $this->content = $content; return $this; } public function getBookIndex(): ?int { return $this->book_index; } public function setBookIndex(int $book_index): static { $this->book_index = $book_index; return $this; } public function getLabel(): ?string { return $this->label; } public function setLabel(?string $label): static { $this->label = $label; return $this; } public static function findBook(string $reference): string { $book = ''; $tmp = explode(' ', $reference); $book = "{$tmp[0]}"; if(count($tmp) > 2) { $book = "{$tmp[0]}{$tmp[1]}"; } return $book; } public static function findChapter(string $reference): string { $chapter = ''; $tmp = explode(' ', $reference); if(count($tmp) > 2) { $passage = $tmp[2]; } else { $passage = $tmp[1]; } $tmp = explode(':', $passage); $chapter = $tmp[0]; return $chapter; } public static function findVerse(string $reference): int|array|bool { $verses = null; $semicolon = strpos($reference, ':'); if ($semicolon === false) { return false; } $tmp = substr($reference, $semicolon + 1); if(strpos($tmp, '-') !== false) { $verses = explode('-', $tmp); } else { $verses = (int) $tmp; } return $verses; } public function jsonSerialize(): array { return [ 'id' => $this->getId(), 'book' => $this->getBook(), 'chapter' => $this->getChapter(), 'verse' => $this->getVerse(), 'content' => $this->getContent(), 'book_index' => $this->getBookIndex(), 'label' => $this->getLabel(), ]; } }