4
0

update 2023-07-10 16:11:33

This commit is contained in:
Robot 2023-07-10 16:11:33 +02:00
parent ded890a4d2
commit 65b3fad842
Signed by: Robot
GPG Key ID: 14DECD44E7E1BB95
3 changed files with 57 additions and 8 deletions

View File

@ -16,7 +16,9 @@ class DailyScripture << (F,LightGreen) >> #Green {
# ?string $verses
# ?string $reference
# Load $load
# string $active
+ __construct(Config $config, Http $http, ...)
+ isDaily() : bool
+ load(string $reference)
+ book() : ?int
+ chapter() : ?int
@ -38,47 +40,54 @@ note right of DailyScripture::__construct
Load $load
end note
note left of DailyScripture::load
note left of DailyScripture::isDaily
method to validate if this is still the daily verse
since: 2.0.1
return: bool
end note
note right of DailyScripture::load
An option to load another reference
since: 2.0.1
end note
note right of DailyScripture::book
note left of DailyScripture::book
Get the book number from the reference
since: 2.0.1
return: ?int
end note
note left of DailyScripture::chapter
note right of DailyScripture::chapter
Get the chapter from the reference
since: 2.0.1
return: ?int
end note
note right of DailyScripture::verses
note left of DailyScripture::verses
Get the verses from the reference
since: 2.0.1
return: ?string
end note
note left of DailyScripture::parse
note right of DailyScripture::parse
Parse the scriptural reference
since: 2.0.1
end note
note right of DailyScripture::extract
note left of DailyScripture::extract
Extract the book name from the reference
since: 2.0.1
return: ?string
end note
note left of DailyScripture::replace
note right of DailyScripture::replace
Replace the book name with a number in the reference
since: 2.0.1
@ -90,7 +99,7 @@ note left of DailyScripture::replace
int $number
end note
note right of DailyScripture::mb_str_replace
note left of DailyScripture::mb_str_replace
Build in str_replace that will work with all languages
since: 2.0.1

View File

@ -64,6 +64,14 @@ final class DailyScripture
*/
protected Load $load;
/**
* The active verse
*
* @var string
* @since 2.0.1
*/
protected string $active = '';
/**
* Constructor
*
@ -88,6 +96,17 @@ final class DailyScripture
$this->load = $load;
}
/**
* method to validate if this is still the daily verse
*
* @return bool true if it is daily
* @since 2.0.1
*/
public function isDaily(): bool
{
return (strcasecmp($this->active, $this->reference) == 0);
}
/**
* An option to load another reference
*
@ -160,6 +179,7 @@ final class DailyScripture
*/
private function parse(string $reference)
{
$this->active = $reference;
$parts = explode(' ', $reference);
$this->book = (isset($parts[0]) && is_numeric($parts[0])) ? intval($parts[0]) : null;

View File

@ -38,6 +38,14 @@
*/
protected Load $load;
/**
* The active verse
*
* @var string
* @since 2.0.1
*/
protected string $active = '';
/**
* Constructor
*
@ -62,6 +70,17 @@
$this->load = $load;
}
/**
* method to validate if this is still the daily verse
*
* @return bool true if it is daily
* @since 2.0.1
*/
public function isDaily(): bool
{
return (strcasecmp($this->active, $this->reference) == 0);
}
/**
* An option to load another reference
*
@ -134,6 +153,7 @@
*/
private function parse(string $reference)
{
$this->active = $reference;
$parts = explode(' ', $reference);
$this->book = (isset($parts[0]) && is_numeric($parts[0])) ? intval($parts[0]) : null;