update 2023-06-21 05:10:02
This commit is contained in:
parent
7c50406c91
commit
48a894ff7a
@ -26,6 +26,7 @@ This repository contains an index (see below) of all the approved powers within
|
||||
- **Namespace**: [VDM\Joomla\GetBible](#vdm-joomla-getbible)
|
||||
|
||||
- **abstract class Factory** | [Details](src/11892cfa-374e-4e3f-b0bc-531871c822d9) | [Code](src/11892cfa-374e-4e3f-b0bc-531871c822d9/code.php) | [Settings](src/11892cfa-374e-4e3f-b0bc-531871c822d9/settings.json) | Super__11892cfa_374e_4e3f_b0bc_531871c822d9__Power
|
||||
- **final class DailyScripture** | [Details](src/90f2ee7a-c041-4316-ad54-af4f97fa3003) | [Code](src/90f2ee7a-c041-4316-ad54-af4f97fa3003/code.php) | [Settings](src/90f2ee7a-c041-4316-ad54-af4f97fa3003/settings.json) | Super__90f2ee7a_c041_4316_ad54_af4f97fa3003__Power
|
||||
- **final class Search** | [Details](src/8336e3c4-f11b-41bc-a2b1-976f99442a84) | [Code](src/8336e3c4-f11b-41bc-a2b1-976f99442a84/code.php) | [Settings](src/8336e3c4-f11b-41bc-a2b1-976f99442a84/settings.json) | Super__8336e3c4_f11b_41bc_a2b1_976f99442a84__Power
|
||||
- **final class Watcher** | [Details](src/f815fb33-f721-48a5-a84e-53f1986e8881) | [Code](src/f815fb33-f721-48a5-a84e-53f1986e8881/code.php) | [Settings](src/f815fb33-f721-48a5-a84e-53f1986e8881/settings.json) | Super__f815fb33_f721_48a5_a84e_53f1986e8881__Power
|
||||
- **class Config** | [Details](src/71075f03-4e77-4fc0-840a-ef55fd9260b2) | [Code](src/71075f03-4e77-4fc0-840a-ef55fd9260b2/code.php) | [Settings](src/71075f03-4e77-4fc0-840a-ef55fd9260b2/settings.json) | Super__71075f03_4e77_4fc0_840a_ef55fd9260b2__Power
|
||||
|
@ -14,6 +14,7 @@ class App #Gold {
|
||||
+ register(Container $container) : void
|
||||
+ getConfig(Container $container) : Config
|
||||
+ getTable(Container $container) : Table
|
||||
+ getDailyScripture(Container $container) : DailyScripture
|
||||
+ getSearch(Container $container) : Search
|
||||
+ getWatcher(Container $container) : Watcher
|
||||
}
|
||||
@ -39,6 +40,13 @@ note right of App::getTable
|
||||
return: Table
|
||||
end note
|
||||
|
||||
note right of App::getDailyScripture
|
||||
Get the Daily Scripture class
|
||||
|
||||
since: 2.0.1
|
||||
return: DailyScripture
|
||||
end note
|
||||
|
||||
note right of App::getSearch
|
||||
Get the Search class
|
||||
|
||||
|
@ -16,6 +16,7 @@ use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
use VDM\Joomla\GetBible\Config;
|
||||
use VDM\Joomla\GetBible\Table;
|
||||
use VDM\Joomla\GetBible\DailyScripture;
|
||||
use VDM\Joomla\GetBible\Search;
|
||||
use VDM\Joomla\GetBible\Watcher;
|
||||
|
||||
@ -43,6 +44,9 @@ class App implements ServiceProviderInterface
|
||||
$container->alias(Table::class, 'GetBible.Table')
|
||||
->share('GetBible.Table', [$this, 'getTable'], true);
|
||||
|
||||
$container->alias(DailyScripture::class, 'DailyScripture')
|
||||
->share('DailyScripture', [$this, 'getDailyScripture'], true);
|
||||
|
||||
$container->alias(Search::class, 'GetBible.Search')
|
||||
->share('GetBible.Search', [$this, 'getSearch'], true);
|
||||
|
||||
@ -76,6 +80,22 @@ class App implements ServiceProviderInterface
|
||||
return new Table();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Daily Scripture class
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return DailyScripture
|
||||
* @since 2.0.1
|
||||
*/
|
||||
public function getDailyScripture(Container $container): DailyScripture
|
||||
{
|
||||
return new DailyScripture(
|
||||
$container->get('GetBible.Config'),
|
||||
$container->get('GetBible.Utilities.Http')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Search class
|
||||
*
|
||||
|
@ -14,6 +14,9 @@
|
||||
$container->alias(Table::class, 'GetBible.Table')
|
||||
->share('GetBible.Table', [$this, 'getTable'], true);
|
||||
|
||||
$container->alias(DailyScripture::class, 'DailyScripture')
|
||||
->share('DailyScripture', [$this, 'getDailyScripture'], true);
|
||||
|
||||
$container->alias(Search::class, 'GetBible.Search')
|
||||
->share('GetBible.Search', [$this, 'getSearch'], true);
|
||||
|
||||
@ -47,6 +50,22 @@
|
||||
return new Table();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Daily Scripture class
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return DailyScripture
|
||||
* @since 2.0.1
|
||||
*/
|
||||
public function getDailyScripture(Container $container): DailyScripture
|
||||
{
|
||||
return new DailyScripture(
|
||||
$container->get('GetBible.Config'),
|
||||
$container->get('GetBible.Utilities.Http')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Search class
|
||||
*
|
||||
|
@ -20,6 +20,10 @@
|
||||
"use": "ff8d5fdb-2d1f-4178-bd18-a43b8efd1068",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection4": {
|
||||
"use": "90f2ee7a-c041-4316-ad54-af4f97fa3003",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection2": {
|
||||
"use": "8336e3c4-f11b-41bc-a2b1-976f99442a84",
|
||||
"as": "default"
|
||||
|
@ -15,6 +15,7 @@ class Config #Gold {
|
||||
# getSchema() : ?string
|
||||
# getDomain() : ?string
|
||||
# getVersion() : ?string
|
||||
# getDailyscriptureurl() : ?string
|
||||
}
|
||||
|
||||
note right of Config::getEndpoint
|
||||
@ -44,6 +45,13 @@ note right of Config::getVersion
|
||||
since: 2.0.1
|
||||
return: ?string
|
||||
end note
|
||||
|
||||
note right of Config::getDailyscriptureurl
|
||||
get Daily Scripture URL
|
||||
|
||||
since: 2.0.1
|
||||
return: ?string
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
@ -12,6 +12,7 @@
|
||||
namespace VDM\Joomla\GetBible;
|
||||
|
||||
|
||||
use VDM\Joomla\Utilities\GetHelper;
|
||||
use VDM\Joomla\Abstraction\BaseConfig;
|
||||
|
||||
|
||||
@ -64,6 +65,17 @@ class Config extends BaseConfig
|
||||
protected function getVersion(): ?string
|
||||
{
|
||||
return 'v2';
|
||||
}
|
||||
|
||||
/**
|
||||
* get Daily Scripture URL
|
||||
*
|
||||
* @return string The Get Daily Scripture URL
|
||||
* @since 2.0.1
|
||||
*/
|
||||
protected function getDailyscriptureurl(): ?string
|
||||
{
|
||||
return 'https://raw.githubusercontent.com/trueChristian/daily-scripture/master/README.today';
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -40,4 +40,15 @@
|
||||
protected function getVersion(): ?string
|
||||
{
|
||||
return 'v2';
|
||||
}
|
||||
|
||||
/**
|
||||
* get Daily Scripture URL
|
||||
*
|
||||
* @return string The Get Daily Scripture URL
|
||||
* @since 2.0.1
|
||||
*/
|
||||
protected function getDailyscriptureurl(): ?string
|
||||
{
|
||||
return 'https://raw.githubusercontent.com/trueChristian/daily-scripture/master/README.today';
|
||||
}
|
@ -9,7 +9,12 @@
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.GetBible.Config",
|
||||
"type": "class",
|
||||
"use_selection": null,
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "db87c339-5bb6-4291-a7ef-2c48ea1b06bc",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\GetBible\\Config",
|
||||
"description": "GetBible Configurations\r\n\r\n@since 2.0.1",
|
||||
"licensing_template": "\/**\r\n * @package GetBible\r\n *\r\n * @created 30th May, 2023\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git GetBible <https:\/\/git.vdm.dev\/getBible>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
|
70
src/90f2ee7a-c041-4316-ad54-af4f97fa3003/README.md
Normal file
70
src/90f2ee7a-c041-4316-ad54-af4f97fa3003/README.md
Normal file
@ -0,0 +1,70 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# final class DailyScripture (Details)
|
||||
> namespace: **VDM\Joomla\GetBible**
|
||||
```uml
|
||||
@startuml
|
||||
class DailyScripture << (F,LightGreen) >> #Green {
|
||||
# ?int $book
|
||||
# ?int $chapter
|
||||
# ?string $verses
|
||||
+ __construct(Config $config, Http $http)
|
||||
+ book() : ?int
|
||||
+ chapter() : ?int
|
||||
+ verses() : ?string
|
||||
# parse(string $reference)
|
||||
}
|
||||
|
||||
note right of DailyScripture::__construct
|
||||
Constructor
|
||||
|
||||
since: 2.0.1
|
||||
end note
|
||||
|
||||
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
|
||||
Get the chapter from the reference
|
||||
|
||||
since: 2.0.1
|
||||
return: ?int
|
||||
end note
|
||||
|
||||
note right of DailyScripture::verses
|
||||
Get the verses from the reference
|
||||
|
||||
since: 2.0.1
|
||||
return: ?string
|
||||
end note
|
||||
|
||||
note right of DailyScripture::parse
|
||||
Parse the scriptural reference
|
||||
|
||||
since: 2.0.1
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
120
src/90f2ee7a-c041-4316-ad54-af4f97fa3003/code.php
Normal file
120
src/90f2ee7a-c041-4316-ad54-af4f97fa3003/code.php
Normal file
@ -0,0 +1,120 @@
|
||||
<?php
|
||||
/**
|
||||
* @package GetBible
|
||||
*
|
||||
* @created 30th May, 2023
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git GetBible <https://git.vdm.dev/getBible>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\GetBible;
|
||||
|
||||
|
||||
use VDM\Joomla\GetBible\Config;
|
||||
use VDM\Joomla\GetBible\Utilities\Http;
|
||||
|
||||
|
||||
/**
|
||||
* The GetBible Daily Scripture
|
||||
*
|
||||
* @since 2.0.1
|
||||
*/
|
||||
final class DailyScripture
|
||||
{
|
||||
/**
|
||||
* The book number
|
||||
*
|
||||
* @var string|null
|
||||
* @since 2.0.1
|
||||
*/
|
||||
protected ?int $book = null;
|
||||
|
||||
/**
|
||||
* The chapter number
|
||||
*
|
||||
* @var int|null
|
||||
* @since 2.0.1
|
||||
*/
|
||||
protected ?int $chapter = null;
|
||||
|
||||
/**
|
||||
* The verses string
|
||||
*
|
||||
* @var string|null
|
||||
* @since 2.0.1
|
||||
*/
|
||||
protected ?string $verses = null;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Config $config The config object.
|
||||
* @param Http $http The http object.
|
||||
*
|
||||
* @since 2.0.1
|
||||
*/
|
||||
public function __construct(Config $config, Http $http)
|
||||
{
|
||||
$response = $http->get($config->daily_scripture_url);
|
||||
|
||||
// make sure we got the correct response
|
||||
if ($response->code == 200 && isset($response->body) && is_string($response->body))
|
||||
{
|
||||
$this->parse($response->body);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the book number from the reference
|
||||
*
|
||||
* @return int|null Book number
|
||||
* @since 2.0.1
|
||||
*/
|
||||
public function book(): ?int
|
||||
{
|
||||
return $this->book;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the chapter from the reference
|
||||
*
|
||||
* @return int|null Chapter number
|
||||
* @since 2.0.1
|
||||
*/
|
||||
public function chapter(): ?int
|
||||
{
|
||||
return $this->chapter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the verses from the reference
|
||||
*
|
||||
* @return string|null Verses
|
||||
* @since 2.0.1
|
||||
*/
|
||||
public function verses(): ?string
|
||||
{
|
||||
return $this->verses;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the scriptural reference
|
||||
*
|
||||
* @param string $reference The scriptural reference.
|
||||
*
|
||||
* @since 2.0.1
|
||||
*/
|
||||
protected function parse(string $reference)
|
||||
{
|
||||
$parts = explode(' ', $reference);
|
||||
|
||||
$this->book = isset($parts[0]) ? intval($parts[0]) : null;
|
||||
$chapterVerses = isset($parts[1]) ? explode(':', $parts[1]) : [null, null];
|
||||
|
||||
$this->chapter = isset($chapterVerses[0]) ? intval($chapterVerses[0]) : null;
|
||||
$this->verses = isset($chapterVerses[1]) ? trim($chapterVerses[1]) : null;
|
||||
}
|
||||
}
|
||||
|
93
src/90f2ee7a-c041-4316-ad54-af4f97fa3003/code.power
Normal file
93
src/90f2ee7a-c041-4316-ad54-af4f97fa3003/code.power
Normal file
@ -0,0 +1,93 @@
|
||||
/**
|
||||
* The book number
|
||||
*
|
||||
* @var string|null
|
||||
* @since 2.0.1
|
||||
*/
|
||||
protected ?int $book = null;
|
||||
|
||||
/**
|
||||
* The chapter number
|
||||
*
|
||||
* @var int|null
|
||||
* @since 2.0.1
|
||||
*/
|
||||
protected ?int $chapter = null;
|
||||
|
||||
/**
|
||||
* The verses string
|
||||
*
|
||||
* @var string|null
|
||||
* @since 2.0.1
|
||||
*/
|
||||
protected ?string $verses = null;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param Config $config The config object.
|
||||
* @param Http $http The http object.
|
||||
*
|
||||
* @since 2.0.1
|
||||
*/
|
||||
public function __construct(Config $config, Http $http)
|
||||
{
|
||||
$response = $http->get($config->daily_scripture_url);
|
||||
|
||||
// make sure we got the correct response
|
||||
if ($response->code == 200 && isset($response->body) && is_string($response->body))
|
||||
{
|
||||
$this->parse($response->body);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the book number from the reference
|
||||
*
|
||||
* @return int|null Book number
|
||||
* @since 2.0.1
|
||||
*/
|
||||
public function book(): ?int
|
||||
{
|
||||
return $this->book;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the chapter from the reference
|
||||
*
|
||||
* @return int|null Chapter number
|
||||
* @since 2.0.1
|
||||
*/
|
||||
public function chapter(): ?int
|
||||
{
|
||||
return $this->chapter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the verses from the reference
|
||||
*
|
||||
* @return string|null Verses
|
||||
* @since 2.0.1
|
||||
*/
|
||||
public function verses(): ?string
|
||||
{
|
||||
return $this->verses;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the scriptural reference
|
||||
*
|
||||
* @param string $reference The scriptural reference.
|
||||
*
|
||||
* @since 2.0.1
|
||||
*/
|
||||
protected function parse(string $reference)
|
||||
{
|
||||
$parts = explode(' ', $reference);
|
||||
|
||||
$this->book = isset($parts[0]) ? intval($parts[0]) : null;
|
||||
$chapterVerses = isset($parts[1]) ? explode(':', $parts[1]) : [null, null];
|
||||
|
||||
$this->chapter = isset($chapterVerses[0]) ? intval($chapterVerses[0]) : null;
|
||||
$this->verses = isset($chapterVerses[1]) ? trim($chapterVerses[1]) : null;
|
||||
}
|
27
src/90f2ee7a-c041-4316-ad54-af4f97fa3003/settings.json
Normal file
27
src/90f2ee7a-c041-4316-ad54-af4f97fa3003/settings.json
Normal file
@ -0,0 +1,27 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "0",
|
||||
"guid": "90f2ee7a-c041-4316-ad54-af4f97fa3003",
|
||||
"implements": null,
|
||||
"load_selection": null,
|
||||
"name": "DailyScripture",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "Joomla.GetBible.DailyScripture",
|
||||
"type": "final class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "71075f03-4e77-4fc0-840a-ef55fd9260b2",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection1": {
|
||||
"use": "b8c66089-735e-4081-825c-8fe36b28e4a6",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"namespace": "VDM\\Joomla\\GetBible\\DailyScripture",
|
||||
"description": "The GetBible Daily Scripture\r\n\r\n@since 2.0.1",
|
||||
"licensing_template": "\/**\r\n * @package GetBible\r\n *\r\n * @created 30th May, 2023\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git GetBible <https:\/\/git.vdm.dev\/getBible>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "",
|
||||
"composer": ""
|
||||
}
|
@ -87,6 +87,17 @@
|
||||
"spk": "Super__8336e3c4_f11b_41bc_a2b1_976f99442a84__Power",
|
||||
"guid": "8336e3c4-f11b-41bc-a2b1-976f99442a84"
|
||||
},
|
||||
"90f2ee7a-c041-4316-ad54-af4f97fa3003": {
|
||||
"name": "DailyScripture",
|
||||
"type": "final class",
|
||||
"namespace": "VDM\\Joomla\\GetBible",
|
||||
"code": "src\/90f2ee7a-c041-4316-ad54-af4f97fa3003\/code.php",
|
||||
"power": "src\/90f2ee7a-c041-4316-ad54-af4f97fa3003\/code.power",
|
||||
"settings": "src\/90f2ee7a-c041-4316-ad54-af4f97fa3003\/settings.json",
|
||||
"path": "src\/90f2ee7a-c041-4316-ad54-af4f97fa3003",
|
||||
"spk": "Super__90f2ee7a_c041_4316_ad54_af4f97fa3003__Power",
|
||||
"guid": "90f2ee7a-c041-4316-ad54-af4f97fa3003"
|
||||
},
|
||||
"91b37bd7-b314-48be-91cf-434ec823bd80": {
|
||||
"name": "Upsert",
|
||||
"type": "final class",
|
||||
|
Loading…
x
Reference in New Issue
Block a user