4
0
Fork 0

update 2023-07-26 22:23:09

This commit is contained in:
Robot 2023-07-26 22:23:09 +02:00
parent 00fc7f9fe6
commit a89438dc3b
Signed by: Robot
GPG Key ID: 14DECD44E7E1BB95
3 changed files with 81 additions and 8 deletions

View File

@ -19,6 +19,7 @@ class DailyScripture << (F,LightGreen) >> #Green {
# string $active
+ __construct(Config $config, Http $http, ...)
+ isDaily() : bool
+ setActive(?int $book, ?int $chapter, ...) : void
+ load(string $reference)
+ book() : ?int
+ chapter() : ?int
@ -47,47 +48,59 @@ note left of DailyScripture::isDaily
return: bool
end note
note right of DailyScripture::load
note right of DailyScripture::setActive
Set Current active verse
since: 2.0.1
return: void
arguments:
?int $book
?int $chapter
?string $verses
end note
note left of DailyScripture::load
An option to load another reference
since: 2.0.1
end note
note left of DailyScripture::book
note right of DailyScripture::book
Get the book number from the reference
since: 2.0.1
return: ?int
end note
note right of DailyScripture::chapter
note left of DailyScripture::chapter
Get the chapter from the reference
since: 2.0.1
return: ?int
end note
note left of DailyScripture::verses
note right of DailyScripture::verses
Get the verses from the reference
since: 2.0.1
return: ?string
end note
note right of DailyScripture::parse
note left of DailyScripture::parse
Parse the scriptural reference
since: 2.0.1
end note
note left of DailyScripture::extract
note right of DailyScripture::extract
Extract the book name from the reference
since: 2.0.1
return: ?string
end note
note right of DailyScripture::replace
note left of DailyScripture::replace
Replace the book name with a number in the reference
since: 2.0.1
@ -99,7 +112,7 @@ note right of DailyScripture::replace
int $number
end note
note left of DailyScripture::mb_str_replace
note right of DailyScripture::mb_str_replace
Build in str_replace that will work with all languages
since: 2.0.1

View File

@ -107,6 +107,36 @@ final class DailyScripture
return (strcasecmp($this->active, $this->reference) == 0);
}
/**
* Set Current active verse
*
* @return int|null Book number
* @return int|null Chapter number
* @return string|null Verses
*
* @since 2.0.1
*/
public function setActive(?int $book, ?int $chapter, ?string $verses): void
{
$active = '';
if ($book !== null)
{
$active = $book;
if ($chapter !== null)
{
$this->book = (int) $book;
$this->chapter = (int) $chapter;
$active .= ' ' . $chapter;
if ($verses !== null)
{
$active .= ':' . $verses;
$this->verses = $verses;
}
$this->active = $active;
}
}
}
/**
* An option to load another reference
*

View File

@ -81,6 +81,36 @@
return (strcasecmp($this->active, $this->reference) == 0);
}
/**
* Set Current active verse
*
* @return int|null Book number
* @return int|null Chapter number
* @return string|null Verses
*
* @since 2.0.1
*/
public function setActive(?int $book, ?int $chapter, ?string $verses): void
{
$active = '';
if ($book !== null)
{
$active = $book;
if ($chapter !== null)
{
$this->book = (int) $book;
$this->chapter = (int) $chapter;
$active .= ' ' . $chapter;
if ($verses !== null)
{
$active .= ':' . $verses;
$this->verses = $verses;
}
$this->active = $active;
}
}
}
/**
* An option to load another reference
*