diff --git a/src/90f2ee7a-c041-4316-ad54-af4f97fa3003/README.md b/src/90f2ee7a-c041-4316-ad54-af4f97fa3003/README.md index 98353d0..de9c3c0 100644 --- a/src/90f2ee7a-c041-4316-ad54-af4f97fa3003/README.md +++ b/src/90f2ee7a-c041-4316-ad54-af4f97fa3003/README.md @@ -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 diff --git a/src/90f2ee7a-c041-4316-ad54-af4f97fa3003/code.php b/src/90f2ee7a-c041-4316-ad54-af4f97fa3003/code.php index 46cf947..95a1b05 100644 --- a/src/90f2ee7a-c041-4316-ad54-af4f97fa3003/code.php +++ b/src/90f2ee7a-c041-4316-ad54-af4f97fa3003/code.php @@ -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 * diff --git a/src/90f2ee7a-c041-4316-ad54-af4f97fa3003/code.power b/src/90f2ee7a-c041-4316-ad54-af4f97fa3003/code.power index 9636694..cdc5bde 100644 --- a/src/90f2ee7a-c041-4316-ad54-af4f97fa3003/code.power +++ b/src/90f2ee7a-c041-4316-ad54-af4f97fa3003/code.power @@ -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 *