update 2023-06-22 08:54:55
This commit is contained in:
parent
a1c3b7aacb
commit
fa79d503ad
@ -23,6 +23,8 @@ class Watcher << (F,LightGreen) >> #Green {
|
|||||||
# ?object $verse
|
# ?object $verse
|
||||||
+ __construct(Load $load, Insert $insert, ...)
|
+ __construct(Load $load, Insert $insert, ...)
|
||||||
+ api(string $translation, int $book, ...) : bool
|
+ api(string $translation, int $book, ...) : bool
|
||||||
|
+ next(string $translation, int $book, ...) : ?int
|
||||||
|
+ previous(int $chapter) : ?int
|
||||||
- translation(string $translation) : ?string
|
- translation(string $translation) : ?string
|
||||||
- book(string $translation, int $book) : ?string
|
- book(string $translation, int $book) : ?string
|
||||||
- chapter(string $translation, int $book, ...) : ?string
|
- chapter(string $translation, int $book, ...) : ?string
|
||||||
@ -61,6 +63,25 @@ note left of Watcher::api
|
|||||||
int $chapter
|
int $chapter
|
||||||
end note
|
end note
|
||||||
|
|
||||||
|
note right of Watcher::next
|
||||||
|
Get the next chapter
|
||||||
|
|
||||||
|
since: 2.0.1
|
||||||
|
return: ?int
|
||||||
|
|
||||||
|
arguments:
|
||||||
|
string $translation
|
||||||
|
int $book
|
||||||
|
int $chapter
|
||||||
|
end note
|
||||||
|
|
||||||
|
note left of Watcher::previous
|
||||||
|
Get the previous chapter
|
||||||
|
|
||||||
|
since: 2.0.1
|
||||||
|
return: ?int
|
||||||
|
end note
|
||||||
|
|
||||||
note right of Watcher::translation
|
note right of Watcher::translation
|
||||||
Get Translation Hash Value
|
Get Translation Hash Value
|
||||||
|
|
||||||
|
@ -200,6 +200,52 @@ final class Watcher
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the next chapter
|
||||||
|
*
|
||||||
|
* @param string $translation The translation.
|
||||||
|
* @param int $book The book number.
|
||||||
|
* @param int $chapter The chapter number.
|
||||||
|
*
|
||||||
|
* @return int|null Number if there is a next, else null
|
||||||
|
* @since 2.0.1
|
||||||
|
*/
|
||||||
|
public function next(string $translation, int $book, int $chapter): ?int
|
||||||
|
{
|
||||||
|
// we load the next chapter
|
||||||
|
$next = $chapter + 1;
|
||||||
|
// check if this books has this next chapter
|
||||||
|
if (!$this->fresh && ($chapter_sha = $this->load->value(
|
||||||
|
['abbreviation' => $translation, 'book_nr' => $book, 'chapter' => $next],
|
||||||
|
'sha', 'chapter'
|
||||||
|
)) !== null)
|
||||||
|
{
|
||||||
|
return $next;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the previous chapter
|
||||||
|
*
|
||||||
|
* @param int $chapter The chapter number.
|
||||||
|
*
|
||||||
|
* @return int|null Number if there is a previous, else null
|
||||||
|
* @since 2.0.1
|
||||||
|
*/
|
||||||
|
public function previous(int $chapter): ?int
|
||||||
|
{
|
||||||
|
// we load the previous chapter
|
||||||
|
$previous = $chapter - 1;
|
||||||
|
if (!$this->fresh && $previous > 0)
|
||||||
|
{
|
||||||
|
return $previous;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Translation Hash Value
|
* Get Translation Hash Value
|
||||||
*
|
*
|
||||||
|
@ -169,6 +169,52 @@
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the next chapter
|
||||||
|
*
|
||||||
|
* @param string $translation The translation.
|
||||||
|
* @param int $book The book number.
|
||||||
|
* @param int $chapter The chapter number.
|
||||||
|
*
|
||||||
|
* @return int|null Number if there is a next, else null
|
||||||
|
* @since 2.0.1
|
||||||
|
*/
|
||||||
|
public function next(string $translation, int $book, int $chapter): ?int
|
||||||
|
{
|
||||||
|
// we load the next chapter
|
||||||
|
$next = $chapter + 1;
|
||||||
|
// check if this books has this next chapter
|
||||||
|
if (!$this->fresh && ($chapter_sha = $this->load->value(
|
||||||
|
['abbreviation' => $translation, 'book_nr' => $book, 'chapter' => $next],
|
||||||
|
'sha', 'chapter'
|
||||||
|
)) !== null)
|
||||||
|
{
|
||||||
|
return $next;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the previous chapter
|
||||||
|
*
|
||||||
|
* @param int $chapter The chapter number.
|
||||||
|
*
|
||||||
|
* @return int|null Number if there is a previous, else null
|
||||||
|
* @since 2.0.1
|
||||||
|
*/
|
||||||
|
public function previous(int $chapter): ?int
|
||||||
|
{
|
||||||
|
// we load the previous chapter
|
||||||
|
$previous = $chapter - 1;
|
||||||
|
if (!$this->fresh && $previous > 0)
|
||||||
|
{
|
||||||
|
return $previous;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Translation Hash Value
|
* Get Translation Hash Value
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user