4
0

update 2023-07-19 12:32:39

This commit is contained in:
Robot 2023-07-19 12:32:39 +02:00
parent 5ef0795a29
commit 73c4c18371
Signed by: Robot
GPG Key ID: 14DECD44E7E1BB95
10 changed files with 277 additions and 0 deletions

View File

@ -82,6 +82,7 @@ This repository contains an index (see below) of all the approved powers within
- **final class Http** | [Details](src/b8c66089-735e-4081-825c-8fe36b28e4a6) | [Code](src/b8c66089-735e-4081-825c-8fe36b28e4a6/code.php) | [Settings](src/b8c66089-735e-4081-825c-8fe36b28e4a6/settings.json) | Super__b8c66089_735e_4081_825c_8fe36b28e4a6__Power
- **final class Response** | [Details](src/c99e85a0-d120-4f25-bcbf-0940dd7b773b) | [Code](src/c99e85a0-d120-4f25-bcbf-0940dd7b773b/code.php) | [Settings](src/c99e85a0-d120-4f25-bcbf-0940dd7b773b/settings.json) | Super__c99e85a0_d120_4f25_bcbf_0940dd7b773b__Power
- **final class SessionHelper** | [Details](src/84e84cd1-c938-4559-8414-d5692db4118e) | [Code](src/84e84cd1-c938-4559-8414-d5692db4118e/code.php) | [Settings](src/84e84cd1-c938-4559-8414-d5692db4118e/settings.json) | Super__84e84cd1_c938_4559_8414_d5692db4118e__Power
- **final class StringHelper** | [Details](src/a5b32737-207d-4cf6-b8ae-ee815612c3a0) | [Code](src/a5b32737-207d-4cf6-b8ae-ee815612c3a0/code.php) | [Settings](src/a5b32737-207d-4cf6-b8ae-ee815612c3a0/settings.json) | Super__a5b32737_207d_4cf6_b8ae_ee815612c3a0__Power
- **final class Uri** | [Details](src/fc9ab6f0-c31b-4077-bb1c-2dcddd36f6bb) | [Code](src/fc9ab6f0-c31b-4077-bb1c-2dcddd36f6bb/code.php) | [Settings](src/fc9ab6f0-c31b-4077-bb1c-2dcddd36f6bb/settings.json) | Super__fc9ab6f0_c31b_4077_bb1c_2dcddd36f6bb__Power

View File

@ -0,0 +1,51 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# final class SessionHelper (Details)
> namespace: **VDM\Joomla\GetBible\Utilities**
```uml
@startuml
class SessionHelper << (F,LightGreen) >> #Green {
# Session $session
+ __construct(?Session $session = null)
+ getLinker() : string
+ setLinker(string $linker) : bool
}
note right of SessionHelper::__construct
Constructor
since: 3.2.0
end note
note right of SessionHelper::getLinker
Get the Active Linker GUID Value
return: string
end note
note right of SessionHelper::setLinker
Set the Active Linker GUID Value
return: bool
end note
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,87 @@
<?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\Utilities;
use Joomla\CMS\Factory as JoomlaFactory;
use Joomla\CMS\Session\Session;
use VDM\Joomla\Utilities\GuidHelper;
/**
* The GetBible Session Helper
*
* @since 2.0.1
*/
final class SessionHelper
{
/**
* The Session
*
* @var Session
* @since 3.2.0
*/
protected Session $session;
/**
* Constructor
*
* @param Session|null $session The Joomla session.
*
* @since 3.2.0
*/
public function __construct(?Session $session = null)
{
$this->session = $session ?: JoomlaFactory::getSession();
}
/**
* Get the Active Linker GUID Value
*
* @return string A Valid Linker GUID Value
*/
public function getLinker(): string
{
$linker = $this->session->get('getbible_active_linker_guid', GuidHelper::get());
if (GuidHelper::valid($linker))
{
return $linker;
}
$linker = GuidHelper::get();
$this->session->set('getbible_active_linker_guid', $linker);
return $linker;
}
/**
* Set the Active Linker GUID Value
*
* @param string $linker The linker GUID value.
*
* @return bool True on success
*/
public function setLinker($linker): bool
{
if (GuidHelper::valid($linker))
{
$this->session->set('getbible_active_linker_guid', $linker);
return true;
}
return false;
}
}

View File

@ -0,0 +1,59 @@
/**
* The Session
*
* @var Session
* @since 3.2.0
*/
protected Session $session;
/**
* Constructor
*
* @param Session|null $session The Joomla session.
*
* @since 3.2.0
*/
public function __construct(?Session $session = null)
{
$this->session = $session ?: JoomlaFactory::getSession();
}
/**
* Get the Active Linker GUID Value
*
* @return string A Valid Linker GUID Value
*/
public function getLinker(): string
{
$linker = $this->session->get('getbible_active_linker_guid', GuidHelper::get());
if (GuidHelper::valid($linker))
{
return $linker;
}
$linker = GuidHelper::get();
$this->session->set('getbible_active_linker_guid', $linker);
return $linker;
}
/**
* Set the Active Linker GUID Value
*
* @param string $linker The linker GUID value.
*
* @return bool True on success
*/
public function setLinker($linker): bool
{
if (GuidHelper::valid($linker))
{
$this->session->set('getbible_active_linker_guid', $linker);
return true;
}
return false;
}

View File

@ -0,0 +1,23 @@
{
"add_head": "1",
"add_licensing_template": "2",
"extends": "0",
"guid": "84e84cd1-c938-4559-8414-d5692db4118e",
"implements": null,
"load_selection": null,
"name": "SessionHelper",
"power_version": "1.0.0",
"system_name": "Joomla.GetBible.Utilities.SessionHelper",
"type": "final class",
"use_selection": {
"use_selection0": {
"use": "9c513baf-b279-43fd-ae29-a585c8cbc4f0",
"as": "default"
}
},
"namespace": "VDM\\Joomla\\GetBible\\Utilities.SessionHelper",
"description": "The GetBible Session Helper\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": "use Joomla\\CMS\\Factory as JoomlaFactory;\r\nuse Joomla\\CMS\\Session\\Session;",
"composer": ""
}

View File

@ -16,6 +16,7 @@ class Utilities #Gold {
+ getResponse(Container $container) : Response
+ getHttp(Container $container) : Http
+ getString(Container $container) : StringHelper
+ getSession(Container $container) : SessionHelper
}
note right of Utilities::register
@ -52,6 +53,13 @@ note right of Utilities::getString
since: 3.2.0
return: StringHelper
end note
note right of Utilities::getSession
Get the Session Helper class
since: 3.2.0
return: SessionHelper
end note
@enduml
```

View File

@ -18,6 +18,7 @@ use VDM\Joomla\GetBible\Utilities\Uri;
use VDM\Joomla\GetBible\Utilities\Response;
use VDM\Joomla\GetBible\Utilities\Http;
use VDM\Joomla\GetBible\Utilities\StringHelper;
use VDM\Joomla\GetBible\Utilities\SessionHelper;
/**
@ -48,6 +49,9 @@ class Utilities implements ServiceProviderInterface
$container->alias(StringHelper::class, 'GetBible.Utilities.String')
->share('GetBible.Utilities.String', [$this, 'getString'], true);
$container->alias(SessionHelper::class, 'GetBible.Utilities.Session')
->share('GetBible.Utilities.Session', [$this, 'getSession'], true);
}
/**
@ -102,6 +106,19 @@ class Utilities implements ServiceProviderInterface
public function getString(Container $container): StringHelper
{
return new StringHelper();
}
/**
* Get the Session Helper class
*
* @param Container $container The DI container.
*
* @return SessionHelper
* @since 3.2.0
*/
public function getSession(Container $container): SessionHelper
{
return new SessionHelper();
}
}

View File

@ -19,6 +19,9 @@
$container->alias(StringHelper::class, 'GetBible.Utilities.String')
->share('GetBible.Utilities.String', [$this, 'getString'], true);
$container->alias(SessionHelper::class, 'GetBible.Utilities.Session')
->share('GetBible.Utilities.Session', [$this, 'getSession'], true);
}
/**
@ -73,4 +76,17 @@
public function getString(Container $container): StringHelper
{
return new StringHelper();
}
/**
* Get the Session Helper class
*
* @param Container $container The DI container.
*
* @return SessionHelper
* @since 3.2.0
*/
public function getSession(Container $container): SessionHelper
{
return new SessionHelper();
}

View File

@ -27,6 +27,10 @@
"use_selection3": {
"use": "a5b32737-207d-4cf6-b8ae-ee815612c3a0",
"as": "default"
},
"use_selection4": {
"use": "84e84cd1-c938-4559-8414-d5692db4118e",
"as": "default"
}
},
"namespace": "VDM\\Joomla\\GetBible\\Service.Utilities",

View File

@ -153,6 +153,17 @@
"spk": "Super__8336e3c4_f11b_41bc_a2b1_976f99442a84__Power",
"guid": "8336e3c4-f11b-41bc-a2b1-976f99442a84"
},
"84e84cd1-c938-4559-8414-d5692db4118e": {
"name": "SessionHelper",
"type": "final class",
"namespace": "VDM\\Joomla\\GetBible\\Utilities",
"code": "src\/84e84cd1-c938-4559-8414-d5692db4118e\/code.php",
"power": "src\/84e84cd1-c938-4559-8414-d5692db4118e\/code.power",
"settings": "src\/84e84cd1-c938-4559-8414-d5692db4118e\/settings.json",
"path": "src\/84e84cd1-c938-4559-8414-d5692db4118e",
"spk": "Super__84e84cd1_c938_4559_8414_d5692db4118e__Power",
"guid": "84e84cd1-c938-4559-8414-d5692db4118e"
},
"899551ac-943e-4f81-becd-7e15c41f1081": {
"name": "Word",
"type": "final class",