update 2023-10-04 18:35:53

This commit is contained in:
Robot 2023-10-04 20:23:30 +02:00
parent b727169617
commit 11a4167cf9
Signed by untrusted user: Robot
GPG Key ID: 14DECD44E7E1BB95
76 changed files with 3858 additions and 118 deletions

View File

@ -28,10 +28,12 @@ This repository contains an index (see below) of all the approved powers within
- **trait Utilities** | [Details](src/79d765b3-7319-4988-9730-446c7f347020) | [Code](src/79d765b3-7319-4988-9730-446c7f347020/code.php) | [Settings](src/79d765b3-7319-4988-9730-446c7f347020/settings.json) | Super__79d765b3_7319_4988_9730_446c7f347020__Power
- **Namespace**: [VDM\Joomla\Abstraction](#vdm-joomla-abstraction)
- **abstract class ActiveStorageRegistry** | [Details](src/43134867-5cb8-4280-9be8-309fd2fd135f) | [Code](src/43134867-5cb8-4280-9be8-309fd2fd135f/code.php) | [Settings](src/43134867-5cb8-4280-9be8-309fd2fd135f/settings.json) | Super__43134867_5cb8_4280_9be8_309fd2fd135f__Power
- **abstract class BaseConfig** | [Details](src/ffbd4e1f-a342-4080-ab7d-1de3741bf319) | [Code](src/ffbd4e1f-a342-4080-ab7d-1de3741bf319/code.php) | [Settings](src/ffbd4e1f-a342-4080-ab7d-1de3741bf319/settings.json) | Super__ffbd4e1f_a342_4080_ab7d_1de3741bf319__Power
- **abstract class BaseTable** | [Details](src/e0f6ddbe-2a35-4537-942c-faff2ebd04f6) | [Code](src/e0f6ddbe-2a35-4537-942c-faff2ebd04f6/code.php) | [Settings](src/e0f6ddbe-2a35-4537-942c-faff2ebd04f6/settings.json) | Super__e0f6ddbe_2a35_4537_942c_faff2ebd04f6__Power
- **abstract class Database** | [Details](src/6cbef8f8-4813-48e3-b05a-65e1aea95171) | [Code](src/6cbef8f8-4813-48e3-b05a-65e1aea95171/code.php) | [Settings](src/6cbef8f8-4813-48e3-b05a-65e1aea95171/settings.json) | Super__6cbef8f8_4813_48e3_b05a_65e1aea95171__Power
- **abstract class Model** | [Details](src/584747d1-3a86-453d-b7a3-a2219de8d777) | [Code](src/584747d1-3a86-453d-b7a3-a2219de8d777/code.php) | [Settings](src/584747d1-3a86-453d-b7a3-a2219de8d777/settings.json) | Super__584747d1_3a86_453d_b7a3_a2219de8d777__Power
- **abstract class StorageRegistry** | [Details](src/7e822c03-1b20-41d1-9427-f5b8d5836af7) | [Code](src/7e822c03-1b20-41d1-9427-f5b8d5836af7/code.php) | [Settings](src/7e822c03-1b20-41d1-9427-f5b8d5836af7/settings.json) | Super__7e822c03_1b20_41d1_9427_f5b8d5836af7__Power
- **Namespace**: [VDM\Joomla\Componentbuilder](#vdm-joomla-componentbuilder)
- **class Table** | [Details](src/bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8) | [Code](src/bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8/code.php) | [Settings](src/bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8/settings.json) | Super__bfd1d6d5_56c1_4fe9_9fee_1c5910e1f5d8__Power
@ -42,15 +44,18 @@ This repository contains an index (see below) of all the approved powers within
- **final class Update** | [Details](src/cce56585-58b0-4f72-a92c-e2635ea52d83) | [Code](src/cce56585-58b0-4f72-a92c-e2635ea52d83/code.php) | [Settings](src/cce56585-58b0-4f72-a92c-e2635ea52d83/settings.json) | Super__cce56585_58b0_4f72_a92c_e2635ea52d83__Power
- **Namespace**: [VDM\Joomla\Interfaces](#vdm-joomla-interfaces)
- **interface Activestorageregistryinterface** | [Details](src/af0eedbe-603b-4671-8e5a-28165d88254b) | [Code](src/af0eedbe-603b-4671-8e5a-28165d88254b/code.php) | [Settings](src/af0eedbe-603b-4671-8e5a-28165d88254b/settings.json) | Super__af0eedbe_603b_4671_8e5a_28165d88254b__Power
- **interface FactoryInterface** | [Details](src/caf33c5d-858c-4f9a-894f-ab302ec5445a) | [Code](src/caf33c5d-858c-4f9a-894f-ab302ec5445a/code.php) | [Settings](src/caf33c5d-858c-4f9a-894f-ab302ec5445a/settings.json) | Super__caf33c5d_858c_4f9a_894f_ab302ec5445a__Power
- **interface InsertInterface** | [Details](src/ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48) | [Code](src/ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48/code.php) | [Settings](src/ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48/settings.json) | Super__ad12ca1c_d3ce_4e7f_88c5_c6c92bdedc48__Power
- **interface LoadInterface** | [Details](src/2ad31f74-f579-499d-b98b-c4f54fd615dd) | [Code](src/2ad31f74-f579-499d-b98b-c4f54fd615dd/code.php) | [Settings](src/2ad31f74-f579-499d-b98b-c4f54fd615dd/settings.json) | Super__2ad31f74_f579_499d_b98b_c4f54fd615dd__Power
- **interface ModelInterface** | [Details](src/8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff) | [Code](src/8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff/code.php) | [Settings](src/8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff/settings.json) | Super__8aef58c1_3f70_4bd4_b9e4_3f29fcd41cff__Power
- **interface Storageregistryinterface** | [Details](src/64e291c2-11f1-423d-a44d-837cc12cc017) | [Code](src/64e291c2-11f1-423d-a44d-837cc12cc017/code.php) | [Settings](src/64e291c2-11f1-423d-a44d-837cc12cc017/settings.json) | Super__64e291c2_11f1_423d_a44d_837cc12cc017__Power
- **interface Tableinterface** | [Details](src/2da6d6c4-eb29-4d69-8bc2-36d96e916adf) | [Code](src/2da6d6c4-eb29-4d69-8bc2-36d96e916adf/code.php) | [Settings](src/2da6d6c4-eb29-4d69-8bc2-36d96e916adf/settings.json) | Super__2da6d6c4_eb29_4d69_8bc2_36d96e916adf__Power
- **interface UpdateInterface** | [Details](src/7179fde6-1e51-4b51-8545-7ca18f74a0f4) | [Code](src/7179fde6-1e51-4b51-8545-7ca18f74a0f4/code.php) | [Settings](src/7179fde6-1e51-4b51-8545-7ca18f74a0f4/settings.json) | Super__7179fde6_1e51_4b51_8545_7ca18f74a0f4__Power
- **Namespace**: [VDM\Joomla\Utilities](#vdm-joomla-utilities)
- **abstract class ArrayHelper** | [Details](src/0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a) | [Code](src/0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a/code.php) | [Settings](src/0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a/settings.json) | Super__0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a__Power
- **abstract class Base64Helper** | [Details](src/64a6ff6c-069c-4a11-a76b-db5e36c27690) | [Code](src/64a6ff6c-069c-4a11-a76b-db5e36c27690/code.php) | [Settings](src/64a6ff6c-069c-4a11-a76b-db5e36c27690/settings.json) | Super__64a6ff6c_069c_4a11_a76b_db5e36c27690__Power
- **abstract class FileHelper** | [Details](src/a223b31e-ea1d-4cdf-92ae-5f9becffaff0) | [Code](src/a223b31e-ea1d-4cdf-92ae-5f9becffaff0/code.php) | [Settings](src/a223b31e-ea1d-4cdf-92ae-5f9becffaff0/settings.json) | Super__a223b31e_ea1d_4cdf_92ae_5f9becffaff0__Power
- **abstract class GetHelper** | [Details](src/db87c339-5bb6-4291-a7ef-2c48ea1b06bc) | [Code](src/db87c339-5bb6-4291-a7ef-2c48ea1b06bc/code.php) | [Settings](src/db87c339-5bb6-4291-a7ef-2c48ea1b06bc/settings.json) | Super__db87c339_5bb6_4291_a7ef_2c48ea1b06bc__Power
- **abstract class GuidHelper** | [Details](src/9c513baf-b279-43fd-ae29-a585c8cbc4f0) | [Code](src/9c513baf-b279-43fd-ae29-a585c8cbc4f0/code.php) | [Settings](src/9c513baf-b279-43fd-ae29-a585c8cbc4f0/settings.json) | Super__9c513baf_b279_43fd_ae29_a585c8cbc4f0__Power
@ -62,7 +67,14 @@ This repository contains an index (see below) of all the approved powers within
- **abstract class BaseRegistry** | [Details](src/b84e947d-2a13-44f7-ac0f-3902ae55ae0c) | [Code](src/b84e947d-2a13-44f7-ac0f-3902ae55ae0c/code.php) | [Settings](src/b84e947d-2a13-44f7-ac0f-3902ae55ae0c/settings.json) | Super__b84e947d_2a13_44f7_ac0f_3902ae55ae0c__Power
- **abstract class Mapper** | [Details](src/44a3367c-f9e4-406b-b396-0f452bde0f03) | [Code](src/44a3367c-f9e4-406b-b396-0f452bde0f03/code.php) | [Settings](src/44a3367c-f9e4-406b-b396-0f452bde0f03/settings.json) | Super__44a3367c_f9e4_406b_b396_0f452bde0f03__Power
- **abstract class MapperDouble** | [Details](src/4d4e76e9-12d9-4d19-b58c-b88974b2586a) | [Code](src/4d4e76e9-12d9-4d19-b58c-b88974b2586a/code.php) | [Settings](src/4d4e76e9-12d9-4d19-b58c-b88974b2586a/settings.json) | Super__4d4e76e9_12d9_4d19_b58c_b88974b2586a__Power
- **abstract class MapperSingle** | [Details](src/c6bbc3ee-58e7-4463-adba-5c5ae839ee36) | [Code](src/c6bbc3ee-58e7-4463-adba-5c5ae839ee36/code.php) | [Settings](src/c6bbc3ee-58e7-4463-adba-5c5ae839ee36/settings.json) | Super__c6bbc3ee_58e7_4463_adba_5c5ae839ee36__Power
- **Namespace**: [VDM\Joomla\Componentbuilder\Interfaces](#vdm-joomla-componentbuilder-interfaces)
- **interface Mapperdoublejoininterface** | [Details](src/7921a2b3-b58c-4184-af3f-f58094f695a8) | [Code](src/7921a2b3-b58c-4184-af3f-f58094f695a8/code.php) | [Settings](src/7921a2b3-b58c-4184-af3f-f58094f695a8/settings.json) | Super__7921a2b3_b58c_4184_af3f_f58094f695a8__Power
- **Namespace**: [VDM\Joomla\Componentbuilder\Service](#vdm-joomla-componentbuilder-service)
- **class Database** | [Details](src/4815e1c7-a433-443d-a112-d1e03d7df84b) | [Code](src/4815e1c7-a433-443d-a112-d1e03d7df84b/code.php) | [Settings](src/4815e1c7-a433-443d-a112-d1e03d7df84b/settings.json) | Super__4815e1c7_a433_443d_a112_d1e03d7df84b__Power
- **Namespace**: [VDM\Joomla\Componentbuilder\Utilities](#vdm-joomla-componentbuilder-utilities)
- **abstract class FilterHelper** | [Details](src/cddcac51-9a46-47c4-ba59-105c70453bd6) | [Code](src/cddcac51-9a46-47c4-ba59-105c70453bd6/code.php) | [Settings](src/cddcac51-9a46-47c4-ba59-105c70453bd6/settings.json) | Super__cddcac51_9a46_47c4_ba59_105c70453bd6__Power
@ -77,6 +89,14 @@ This repository contains an index (see below) of all the approved powers within
- **abstract class NamespaceHelper** | [Details](src/ce8cf834-6bac-44fb-941c-861f7e046cc0) | [Code](src/ce8cf834-6bac-44fb-941c-861f7e046cc0/code.php) | [Settings](src/ce8cf834-6bac-44fb-941c-861f7e046cc0/settings.json) | Super__ce8cf834_6bac_44fb_941c_861f7e046cc0__Power
- **abstract class PluginHelper** | [Details](src/3cf76fbf-fd95-4a33-878e-7aff6d36b7f6) | [Code](src/3cf76fbf-fd95-4a33-878e-7aff6d36b7f6/code.php) | [Settings](src/3cf76fbf-fd95-4a33-878e-7aff6d36b7f6/settings.json) | Super__3cf76fbf_fd95_4a33_878e_7aff6d36b7f6__Power
- **abstract class TypeHelper** | [Details](src/a8935cbe-7701-40dc-bfd5-675f2d600954) | [Code](src/a8935cbe-7701-40dc-bfd5-675f2d600954/code.php) | [Settings](src/a8935cbe-7701-40dc-bfd5-675f2d600954/settings.json) | Super__a8935cbe_7701_40dc_bfd5_675f2d600954__Power
- **Namespace**: [VDM\Joomla\Abstraction\StorageRegistry\Traits](#vdm-joomla-abstraction-storageregistry-traits)
- **trait Count** | [Details](src/11572d9b-e3d5-4b29-904c-9618d8f2bfd8) | [Code](src/11572d9b-e3d5-4b29-904c-9618d8f2bfd8/code.php) | [Settings](src/11572d9b-e3d5-4b29-904c-9618d8f2bfd8/settings.json) | Super__11572d9b_e3d5_4b29_904c_9618d8f2bfd8__Power
- **trait GetString** | [Details](src/59b1a2ea-d77e-4040-ac8c-e65cd8743e9b) | [Code](src/59b1a2ea-d77e-4040-ac8c-e65cd8743e9b/code.php) | [Settings](src/59b1a2ea-d77e-4040-ac8c-e65cd8743e9b/settings.json) | Super__59b1a2ea_d77e_4040_ac8c_e65cd8743e9b__Power
- **trait InArray** | [Details](src/215b35ac-1b26-4838-bbcf-d1fdbbd9353f) | [Code](src/215b35ac-1b26-4838-bbcf-d1fdbbd9353f/code.php) | [Settings](src/215b35ac-1b26-4838-bbcf-d1fdbbd9353f/settings.json) | Super__215b35ac_1b26_4838_bbcf_d1fdbbd9353f__Power
- **trait IsString** | [Details](src/ff7d0111-8f79-42aa-ac14-b53ba2c49369) | [Code](src/ff7d0111-8f79-42aa-ac14-b53ba2c49369/code.php) | [Settings](src/ff7d0111-8f79-42aa-ac14-b53ba2c49369/settings.json) | Super__ff7d0111_8f79_42aa_ac14_b53ba2c49369__Power
- **trait ToString** | [Details](src/7d494d91-ab60-43cd-aecf-d50e07f7f30e) | [Code](src/7d494d91-ab60-43cd-aecf-d50e07f7f30e/code.php) | [Settings](src/7d494d91-ab60-43cd-aecf-d50e07f7f30e/settings.json) | Super__7d494d91_ab60_43cd_aecf_d50e07f7f30e__Power
- **trait VarExport** | [Details](src/52a1d14f-304a-431c-8fa4-411179942db5) | [Code](src/52a1d14f-304a-431c-8fa4-411179942db5/code.php) | [Settings](src/52a1d14f-304a-431c-8fa4-411179942db5/settings.json) | Super__52a1d14f_304a_431c_8fa4_411179942db5__Power
---
```

View File

@ -8,9 +8,10 @@
```
# final class Load (Details)
> namespace: **VDM\Joomla\Database**
> extends: **Database**
```uml
@startuml
class Load << (F,LightGreen) >> #Green {
class Load << (F,LightGreen) >> #RoyalBlue {
+ rows(array $select, array $tables, ...) : ?array
+ items(array $select, array $tables, ...) : ?array
+ row(array $select, array $tables, ...) : ?array

View File

@ -385,25 +385,48 @@ final class Load extends Database implements LoadInterface
{
if (isset($value['value']) && isset($value['operator']))
{
if (ArrayHelper::check($value['value']))
// check if value needs to be quoted
$quote = $value['quote'] ?? true;
if (!$quote)
{
// add the where by array
$query->where($this->db->quoteName($key) . ' ' .
$value['operator'] . ' (' .
implode(',',
array_map(
fn($val) => $this->quote($val),
$value['value']
)
)
. ')'
);
if (ArrayHelper::check($value['value']))
{
// add the where by array
$query->where($this->db->quoteName($key) . ' ' .
$value['operator'] . ' (' .
implode(',', $value['value'])
. ')'
);
}
else
{
// add the where
$query->where($this->db->quoteName($key) . ' ' .
$value['operator'] . ' ' . $value['value']);
}
}
else
{
// add the where
$query->where($this->db->quoteName($key) . ' ' .
$value['operator'] . ' ' . $this->quote($value['value']));
if (ArrayHelper::check($value['value']))
{
// add the where by array
$query->where($this->db->quoteName($key) . ' ' .
$value['operator'] . ' (' .
implode(',',
array_map(
fn($val) => $this->quote($val),
$value['value']
)
)
. ')'
);
}
else
{
// add the where
$query->where($this->db->quoteName($key) . ' ' .
$value['operator'] . ' ' . $this->quote($value['value']));
}
}
}
else

View File

@ -359,25 +359,48 @@
{
if (isset($value['value']) && isset($value['operator']))
{
if (ArrayHelper::check($value['value']))
// check if value needs to be quoted
$quote = $value['quote'] ?? true;
if (!$quote)
{
// add the where by array
$query->where($this->db->quoteName($key) . ' ' .
$value['operator'] . ' (' .
implode(',',
array_map(
fn($val) => $this->quote($val),
$value['value']
)
)
. ')'
);
if (ArrayHelper::check($value['value']))
{
// add the where by array
$query->where($this->db->quoteName($key) . ' ' .
$value['operator'] . ' (' .
implode(',', $value['value'])
. ')'
);
}
else
{
// add the where
$query->where($this->db->quoteName($key) . ' ' .
$value['operator'] . ' ' . $value['value']);
}
}
else
{
// add the where
$query->where($this->db->quoteName($key) . ' ' .
$value['operator'] . ' ' . $this->quote($value['value']));
if (ArrayHelper::check($value['value']))
{
// add the where by array
$query->where($this->db->quoteName($key) . ' ' .
$value['operator'] . ' (' .
implode(',',
array_map(
fn($val) => $this->quote($val),
$value['value']
)
)
. ')'
);
}
else
{
// add the where
$query->where($this->db->quoteName($key) . ' ' .
$value['operator'] . ' ' . $this->quote($value['value']));
}
}
}
else

View File

@ -0,0 +1,37 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# trait Count (Details)
> namespace: **VDM\Joomla\Abstraction\StorageRegistry\Traits**
```uml
@startuml
class Count << (T,Orange) >> #Turquoise {
+ count(string $path) : int
}
note right of Count::count
Retrieves number of values (or sub-array) from the storage using multiple keys.
since: 3.2.0
return: int
end note
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,51 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @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\Abstraction\StorageRegistry\Traits;
/**
* Count Values
*
* @since 3.2.0
*/
trait Count
{
/**
* Retrieves number of values (or sub-array) from the storage using multiple keys.
*
* @param string $path Storage path (e.g. vdm.content.builder)
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return int The number of values
* @since 3.2.0
*/
public function count(string $path): int
{
if (($values = $this->get($path)) === null)
{
return 0;
}
if (is_array($values))
{
return count($values);
}
if (is_object($values))
{
return count((array) $values);
}
return 1;
}
}

View File

@ -0,0 +1,28 @@
/**
* Retrieves number of values (or sub-array) from the storage using multiple keys.
*
* @param string $path Storage path (e.g. vdm.content.builder)
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return int The number of values
* @since 3.2.0
*/
public function count(string $path): int
{
if (($values = $this->get($path)) === null)
{
return 0;
}
if (is_array($values))
{
return count($values);
}
if (is_object($values))
{
return count((array) $values);
}
return 1;
}

View File

@ -0,0 +1,18 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "0",
"guid": "11572d9b-e3d5-4b29-904c-9618d8f2bfd8",
"implements": null,
"load_selection": null,
"name": "Count",
"power_version": "1.0.0",
"system_name": "VDM.Abstraction.StorageRegistry.Traits.Count",
"type": "trait",
"use_selection": null,
"namespace": "VDM\\Joomla\\Abstraction.StorageRegistry.Traits.Count",
"description": "Count Values\r\n\r\n@since 3.2.0",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\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": ""
}

View File

@ -0,0 +1,37 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# trait InArray (Details)
> namespace: **VDM\Joomla\Abstraction\StorageRegistry\Traits**
```uml
@startuml
class InArray << (T,Orange) >> #Turquoise {
+ inArray(mixed $value, ?string $path = null) : bool
}
note right of InArray::inArray
Check if a value is found in an array
since: 3.2.0
return: bool
end note
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,50 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @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\Abstraction\StorageRegistry\Traits;
/**
* Check if a value is in an array
*
* @since 3.2.0
*/
trait InArray
{
/**
* Check if a value is found in an array
*
* @param mixed $value The value to check for
* @param string|null $path Registry path (e.g. joomla.content.showauthor)
*
* @return bool
* @since 3.2.0
*/
public function inArray($value, ?string $path = null): bool
{
// Check base array if no path is given
if (empty($path))
{
return in_array($value, $this->active);
}
// get the value
if (($node = $this->get($path)) !== null
&& is_array($node)
&& in_array($value, $node))
{
return true;
}
return false;
}
}

View File

@ -0,0 +1,27 @@
/**
* Check if a value is found in an array
*
* @param mixed $value The value to check for
* @param string|null $path Registry path (e.g. joomla.content.showauthor)
*
* @return bool
* @since 3.2.0
*/
public function inArray($value, ?string $path = null): bool
{
// Check base array if no path is given
if (empty($path))
{
return in_array($value, $this->active);
}
// get the value
if (($node = $this->get($path)) !== null
&& is_array($node)
&& in_array($value, $node))
{
return true;
}
return false;
}

View File

@ -0,0 +1,18 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "0",
"guid": "215b35ac-1b26-4838-bbcf-d1fdbbd9353f",
"implements": null,
"load_selection": null,
"name": "InArray",
"power_version": "1.0.0",
"system_name": "VDM.Abstraction.StorageRegistry.Traits.InArray",
"type": "trait",
"use_selection": null,
"namespace": "VDM\\Joomla\\Abstraction.StorageRegistry.Traits.InArray",
"description": "Check if a value is in an array\r\n\r\n@since 3.2.0",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\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": ""
}

View File

@ -0,0 +1,100 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# abstract class ActiveStorageRegistry (Details)
> namespace: **VDM\Joomla\Abstraction**
```uml
@startuml
abstract ActiveStorageRegistry #Orange {
# array $active
+ isActive() : bool
+ allActive() : array
+ setActive(mixed $value, $keys) : void
+ addActive(mixed $value, bool $asArray, ...) : void
+ getActive(mixed $default, $keys) : mixed
+ removeActive($keys) : void
+ existsActive($keys) : bool
# validActiveKeys(array $keys) : bool
}
note right of ActiveStorageRegistry::isActive
Check if the main storage has any content.
since: 3.2.0
return: bool
end note
note left of ActiveStorageRegistry::allActive
Get all value from the active storage.
since: 3.2.0
return: array
end note
note right of ActiveStorageRegistry::setActive
Sets a value into the storage using multiple keys.
since: 3.2.0
return: void
end note
note left of ActiveStorageRegistry::addActive
Adds content into the storage. If a key exists,
it either appends or concatenates based on the value's type.
since: 3.2.0
return: void
arguments:
mixed $value
bool $asArray
$keys
end note
note right of ActiveStorageRegistry::getActive
Retrieves a value (or sub-array) from the storage using multiple keys.
since: 3.2.0
return: mixed
end note
note left of ActiveStorageRegistry::removeActive
Removes a value (or sub-array) from the storage using multiple keys.
since: 3.2.0
return: void
end note
note right of ActiveStorageRegistry::existsActive
Checks the existence of a particular location in the storage using multiple keys.
since: 3.2.0
return: bool
end note
note left of ActiveStorageRegistry::validActiveKeys
Checks that the keys are valid
since: 3.2.0
return: bool
end note
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,260 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @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\Abstraction;
use VDM\Joomla\Interfaces\Activestorageregistryinterface;
/**
* Active Storage Registry.
*
* Don't use this beyond 10 dimensional depth for best performance.
*
* @since 3.2.0
*/
abstract class ActiveStorageRegistry implements Activestorageregistryinterface
{
/**
* The main storage array.
*
* @var array
* @since 3.2.0
**/
protected array $active = [];
/**
* Check if the main storage has any content.
*
* @return bool Returns true if the active array is not empty, false otherwise.
* @since 3.2.0
*/
public function isActive(): bool
{
return !empty($this->active);
}
/**
* Get all value from the active storage.
*
* @return array The values or empty array.
* @since 3.2.0
*/
public function allActive(): array
{
return $this->active;
}
/**
* Sets a value into the storage using multiple keys.
*
* @param mixed $value The value to set.
* @param string ...$keys The keys to determine the location.
*
* @throws \InvalidArgumentException If any of the keys are not a number or string.
* @return void
* @since 3.2.0
*/
public function setActive($value, string ...$keys): void
{
if (!$this->validActiveKeys($keys))
{
throw new \InvalidArgumentException("Keys must only be strings or numbers to set any value.");
}
$array = &$this->active;
foreach ($keys as $key)
{
if (!isset($array[$key]))
{
$array[$key] = [];
}
$array = &$array[$key];
}
$array = $value;
}
/**
* Adds content into the storage. If a key exists,
* it either appends or concatenates based on the value's type.
*
* @param mixed $value The value to set.
* @param bool $asArray Determines if the new value should be treated as an array.
* @param string ...$keys The keys to determine the location.
*
* @throws \InvalidArgumentException If any of the keys are not a number or string.
* @return void
* @since 3.2.0
*/
public function addActive($value, bool $asArray, string ...$keys): void
{
if (!$this->validActiveKeys($keys))
{
throw new \InvalidArgumentException("Keys must only be strings or numbers to add any value.");
}
$array = &$this->active;
foreach ($keys as $key)
{
if (!isset($array[$key]))
{
$array[$key] = [];
}
$array = &$array[$key];
}
// add string
if (!$asArray && $array === [])
{
$array = '';
}
// Handle the adding logic at the tip of the array
if (is_array($array) || $asArray)
{
if (!is_array($array))
{
// Convert to array if it's not already an array
$array = [$array];
}
$array[] = $value;
}
else
{
if (is_string($value) || is_numeric($value))
{
$array .= (string) $value;
}
else
{
$array = $value;
}
}
}
/**
* Retrieves a value (or sub-array) from the storage using multiple keys.
*
* @param mixed $default The default value if not set.
* @param string ...$keys The keys to determine the location.
*
* @throws \InvalidArgumentException If any of the keys are not a number or string.
* @return mixed The value or sub-array from the storage. Null if the location doesn't exist.
* @since 3.2.0
*/
public function getActive($default, string ...$keys)
{
if (!$this->validActiveKeys($keys))
{
throw new \InvalidArgumentException("Keys must only be strings or numbers to get any value.");
}
$array = $this->active;
foreach ($keys as $key)
{
if (!isset($array[$key]))
{
return $default;
}
$array = $array[$key];
}
return $array;
}
/**
* Removes a value (or sub-array) from the storage using multiple keys.
*
* @param string ...$keys The keys to determine the location.
*
* @throws \InvalidArgumentException If any of the keys are not a number or string.
* @return void
* @since 3.2.0
*/
public function removeActive(string ...$keys): void
{
if (!$this->validActiveKeys($keys))
{
throw new \InvalidArgumentException("Keys must only be strings or numbers to remove any value.");
}
$array = &$this->active;
$lastKey = array_pop($keys);
foreach ($keys as $key)
{
if (!isset($array[$key]))
{
return; // Exit early if the key doesn't exist
}
$array = &$array[$key];
}
unset($array[$lastKey]);
}
/**
* Checks the existence of a particular location in the storage using multiple keys.
*
* @param string ...$keys The keys to determine the location.
*
* @throws \InvalidArgumentException If any of the keys are not a number or string.
* @return bool True if the location exists, false otherwise.
* @since 3.2.0
*/
public function existsActive(string ...$keys): bool
{
if (!$this->validActiveKeys($keys))
{
throw new \InvalidArgumentException("Keys must only be strings or numbers to check if any value exist.");
}
$array = $this->active;
foreach ($keys as $key)
{
if (!isset($array[$key]))
{
return false;
}
$array = $array[$key];
}
return true;
}
/**
* Checks that the keys are valid
*
* @param array $keys The keys to determine the location.
*
* @return bool False if any of the keys are not a number or string.
* @since 3.2.0
*/
protected function validActiveKeys(array $keys): bool
{
foreach ($keys as $key)
{
if ($key === '' || (!is_string($key) && !is_numeric($key)))
{
return false;
}
}
return true;
}
}

View File

@ -0,0 +1,232 @@
/**
* The main storage array.
*
* @var array
* @since 3.2.0
**/
protected array $active = [];
/**
* Check if the main storage has any content.
*
* @return bool Returns true if the active array is not empty, false otherwise.
* @since 3.2.0
*/
public function isActive(): bool
{
return !empty($this->active);
}
/**
* Get all value from the active storage.
*
* @return array The values or empty array.
* @since 3.2.0
*/
public function allActive(): array
{
return $this->active;
}
/**
* Sets a value into the storage using multiple keys.
*
* @param mixed $value The value to set.
* @param string ...$keys The keys to determine the location.
*
* @throws \InvalidArgumentException If any of the keys are not a number or string.
* @return void
* @since 3.2.0
*/
public function setActive($value, string ...$keys): void
{
if (!$this->validActiveKeys($keys))
{
throw new \InvalidArgumentException("Keys must only be strings or numbers to set any value.");
}
$array = &$this->active;
foreach ($keys as $key)
{
if (!isset($array[$key]))
{
$array[$key] = [];
}
$array = &$array[$key];
}
$array = $value;
}
/**
* Adds content into the storage. If a key exists,
* it either appends or concatenates based on the value's type.
*
* @param mixed $value The value to set.
* @param bool $asArray Determines if the new value should be treated as an array.
* @param string ...$keys The keys to determine the location.
*
* @throws \InvalidArgumentException If any of the keys are not a number or string.
* @return void
* @since 3.2.0
*/
public function addActive($value, bool $asArray, string ...$keys): void
{
if (!$this->validActiveKeys($keys))
{
throw new \InvalidArgumentException("Keys must only be strings or numbers to add any value.");
}
$array = &$this->active;
foreach ($keys as $key)
{
if (!isset($array[$key]))
{
$array[$key] = [];
}
$array = &$array[$key];
}
// add string
if (!$asArray && $array === [])
{
$array = '';
}
// Handle the adding logic at the tip of the array
if (is_array($array) || $asArray)
{
if (!is_array($array))
{
// Convert to array if it's not already an array
$array = [$array];
}
$array[] = $value;
}
else
{
if (is_string($value) || is_numeric($value))
{
$array .= (string) $value;
}
else
{
$array = $value;
}
}
}
/**
* Retrieves a value (or sub-array) from the storage using multiple keys.
*
* @param mixed $default The default value if not set.
* @param string ...$keys The keys to determine the location.
*
* @throws \InvalidArgumentException If any of the keys are not a number or string.
* @return mixed The value or sub-array from the storage. Null if the location doesn't exist.
* @since 3.2.0
*/
public function getActive($default, string ...$keys)
{
if (!$this->validActiveKeys($keys))
{
throw new \InvalidArgumentException("Keys must only be strings or numbers to get any value.");
}
$array = $this->active;
foreach ($keys as $key)
{
if (!isset($array[$key]))
{
return $default;
}
$array = $array[$key];
}
return $array;
}
/**
* Removes a value (or sub-array) from the storage using multiple keys.
*
* @param string ...$keys The keys to determine the location.
*
* @throws \InvalidArgumentException If any of the keys are not a number or string.
* @return void
* @since 3.2.0
*/
public function removeActive(string ...$keys): void
{
if (!$this->validActiveKeys($keys))
{
throw new \InvalidArgumentException("Keys must only be strings or numbers to remove any value.");
}
$array = &$this->active;
$lastKey = array_pop($keys);
foreach ($keys as $key)
{
if (!isset($array[$key]))
{
return; // Exit early if the key doesn't exist
}
$array = &$array[$key];
}
unset($array[$lastKey]);
}
/**
* Checks the existence of a particular location in the storage using multiple keys.
*
* @param string ...$keys The keys to determine the location.
*
* @throws \InvalidArgumentException If any of the keys are not a number or string.
* @return bool True if the location exists, false otherwise.
* @since 3.2.0
*/
public function existsActive(string ...$keys): bool
{
if (!$this->validActiveKeys($keys))
{
throw new \InvalidArgumentException("Keys must only be strings or numbers to check if any value exist.");
}
$array = $this->active;
foreach ($keys as $key)
{
if (!isset($array[$key]))
{
return false;
}
$array = $array[$key];
}
return true;
}
/**
* Checks that the keys are valid
*
* @param array $keys The keys to determine the location.
*
* @return bool False if any of the keys are not a number or string.
* @since 3.2.0
*/
protected function validActiveKeys(array $keys): bool
{
foreach ($keys as $key)
{
if ($key === '' || (!is_string($key) && !is_numeric($key)))
{
return false;
}
}
return true;
}

View File

@ -0,0 +1,20 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "0",
"guid": "43134867-5cb8-4280-9be8-309fd2fd135f",
"implements": [
"af0eedbe-603b-4671-8e5a-28165d88254b"
],
"load_selection": null,
"name": "ActiveStorageRegistry",
"power_version": "1.0.0",
"system_name": "VDM.Abstraction.ActiveStorageRegistry",
"type": "abstract class",
"use_selection": null,
"namespace": "VDM\\Joomla\\Abstraction.ActiveStorageRegistry",
"description": "Active Storage Registry.\r\n\r\nDon't use this beyond 10 dimensional depth for best performance.\r\n\r\n@since 3.2.0",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\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": ""
}

View File

@ -16,7 +16,7 @@ abstract Mapper #Orange {
+ set(string $key, mixed $value) : void
+ get(string $key) : mixed
+ exist(string $key) : bool
+ add(string $key, mixed $value) : void
+ add(string $key, mixed $value, ...) : void
+ remove(string $key) : void
# {abstract} key(string $key) : string
+ isActive_(string $firstKey = null) : bool
@ -62,6 +62,11 @@ note right of Mapper::add
since: 3.2.0
return: void
arguments:
string $key
mixed $value
bool $array = false
end note
note left of Mapper::remove
@ -121,6 +126,7 @@ note left of Mapper::add_
string $firstKey
string $secondKey
mixed $value
bool $array = false
end note
note right of Mapper::remove_

View File

@ -12,7 +12,7 @@
namespace VDM\Joomla\Componentbuilder\Abstraction;
use VDM\Joomla\Componentbuilder\Interfaces\Mapperdoubleinterface;
use VDM\Joomla\Componentbuilder\Interfaces\Mapperdoublejoininterface;
use VDM\Joomla\Componentbuilder\Interfaces\Mappersingleinterface;
@ -21,7 +21,7 @@ use VDM\Joomla\Componentbuilder\Interfaces\Mappersingleinterface;
*
* @since 3.2.0
*/
abstract class Mapper implements Mapperdoubleinterface, Mappersingleinterface
abstract class Mapper implements Mapperdoublejoininterface, Mappersingleinterface
{
/**
@ -52,7 +52,7 @@ abstract class Mapper implements Mapperdoubleinterface, Mappersingleinterface
* @return void
* @since 3.2.0
*/
public function set(string $key, $value)
public function set(string $key, $value): void
{
$this->active[$this->key($key)] = $value;
}
@ -92,19 +92,34 @@ abstract class Mapper implements Mapperdoubleinterface, Mappersingleinterface
*
* @param string $key The main string key
* @param mixed $value The values to set
* @param bool $array The is array switch
*
* @return void
* @since 3.2.0
*/
public function add(string $key, $value)
public function add(string $key, $value, bool $array = false): void
{
if (isset($this->active[$this->key($key)]))
{
$this->active[$this->key($key)] .= $value;
if (is_array($this->active[$this->key($key)]))
{
$this->active[$this->key($key)][] = $value;
}
else
{
$this->active[$this->key($key)] .= $value;
}
}
else
{
$this->active[$this->key($key)] = $value;
if ($array)
{
$this->active[$this->key($key)] = [$value];
}
else
{
$this->active[$this->key($key)] = $value;
}
}
}
@ -116,7 +131,7 @@ abstract class Mapper implements Mapperdoubleinterface, Mappersingleinterface
* @return void
* @since 3.2.0
*/
public function remove(string $key)
public function remove(string $key): void
{
unset($this->active[$this->key($key)]);
}
@ -175,7 +190,7 @@ abstract class Mapper implements Mapperdoubleinterface, Mappersingleinterface
* @return void
* @since 3.2.0
*/
public function set_(string $firstKey, string $secondKey, $value)
public function set_(string $firstKey, string $secondKey, $value): void
{
$this->_active[$this->firstKey($firstKey)]
[$this->secondKey($secondKey)] = $value;
@ -217,7 +232,7 @@ abstract class Mapper implements Mapperdoubleinterface, Mappersingleinterface
{
return true;
}
elseif (is_null($secondKey) && isset($this->_active[$this->firstKey($firstKey)]))
elseif ($secondKey === null && isset($this->_active[$this->firstKey($firstKey)]))
{
return true;
}
@ -230,23 +245,41 @@ abstract class Mapper implements Mapperdoubleinterface, Mappersingleinterface
* @param string $firstKey The first key
* @param string $secondKey The second key
* @param mixed $value The values to set
* @param bool $array The is array switch
*
* @return void
* @since 3.2.0
*/
public function add_(string $firstKey, string $secondKey, $value)
public function add_(string $firstKey, string $secondKey, $value, bool $array = false): void
{
if (isset($this->_active[$this->firstKey($firstKey)]) &&
isset($this->_active[$this->firstKey($firstKey)]
[$this->secondKey($secondKey)]))
{
$this->_active[$this->firstKey($firstKey)]
[$this->secondKey($secondKey)] .= $value;
if (is_array($this->_active[$this->firstKey($firstKey)]
[$this->secondKey($secondKey)]))
{
$this->_active[$this->firstKey($firstKey)]
[$this->secondKey($secondKey)][] = $value;
}
else
{
$this->_active[$this->firstKey($firstKey)]
[$this->secondKey($secondKey)] .= $value;
}
}
else
{
$this->_active[$this->firstKey($firstKey)]
[$this->secondKey($secondKey)] = $value;
if ($array)
{
$this->_active[$this->firstKey($firstKey)]
[$this->secondKey($secondKey)] = [$value];
}
else
{
$this->_active[$this->firstKey($firstKey)]
[$this->secondKey($secondKey)] = $value;
}
}
}
@ -259,7 +292,7 @@ abstract class Mapper implements Mapperdoubleinterface, Mappersingleinterface
* @return void
* @since 3.2.0
*/
public function remove_(string $firstKey, ?string $secondKey = null)
public function remove_(string $firstKey, ?string $secondKey = null): void
{
if (is_string($secondKey))
{

View File

@ -1,2 +1,2 @@
[CUSTOMCODE=abstractionMapperSingle]
[CUSTOMCODE=abstractionMapperDouble]
[CUSTOMCODE=abstractionMapperDouble+_]

View File

@ -4,7 +4,7 @@
"extends": "0",
"guid": "44a3367c-f9e4-406b-b396-0f452bde0f03",
"implements": [
"fbc58009-fa16-4d49-a0dd-419c3b62d42f",
"7921a2b3-b58c-4184-af3f-f58094f695a8",
"78527c29-24ad-4735-ad4c-ec33a4952d9b"
],
"load_selection": null,

View File

@ -0,0 +1,61 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# class Database (Details)
> namespace: **VDM\Joomla\Componentbuilder\Service**
```uml
@startuml
class Database #Gold {
+ register(Container $container) : void
+ getLoad(Container $container) : Load
+ getInsert(Container $container) : Insert
+ getUpdate(Container $container) : Update
}
note right of Database::register
Registers the service provider with a DI container.
since: 3.2.0
return: void
end note
note right of Database::getLoad
Get the Core Load Database
since: 3.2.0
return: Load
end note
note right of Database::getInsert
Get the Core Insert Database
since: 3.2.0
return: Insert
end note
note right of Database::getUpdate
Get the Core Update Database
since: 3.2.0
return: Update
end note
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,88 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @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\Componentbuilder\Service;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use VDM\Joomla\Database\Load;
use VDM\Joomla\Database\Insert;
use VDM\Joomla\Database\Update;
/**
* Database Service Provider
*
* @since 3.2.0
*/
class Database implements ServiceProviderInterface
{
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
* @since 3.2.0
*/
public function register(Container $container)
{
$container->alias(Load::class, 'Load')
->share('Load', [$this, 'getLoad'], true);
$container->alias(Insert::class, 'Insert')
->share('Insert', [$this, 'getInsert'], true);
$container->alias(Update::class, 'Update')
->share('Update', [$this, 'getUpdate'], true);
}
/**
* Get the Core Load Database
*
* @param Container $container The DI container.
*
* @return Load
* @since 3.2.0
*/
public function getLoad(Container $container): Load
{
return new Load();
}
/**
* Get the Core Insert Database
*
* @param Container $container The DI container.
*
* @return Insert
* @since 3.2.0
*/
public function getInsert(Container $container): Insert
{
return new Insert();
}
/**
* Get the Core Update Database
*
* @param Container $container The DI container.
*
* @return Update
* @since 3.2.0
*/
public function getUpdate(Container $container): Update
{
return new Update();
}
}

View File

@ -0,0 +1,58 @@
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
* @since 3.2.0
*/
public function register(Container $container)
{
$container->alias(Load::class, 'Load')
->share('Load', [$this, 'getLoad'], true);
$container->alias(Insert::class, 'Insert')
->share('Insert', [$this, 'getInsert'], true);
$container->alias(Update::class, 'Update')
->share('Update', [$this, 'getUpdate'], true);
}
/**
* Get the Core Load Database
*
* @param Container $container The DI container.
*
* @return Load
* @since 3.2.0
*/
public function getLoad(Container $container): Load
{
return new Load();
}
/**
* Get the Core Insert Database
*
* @param Container $container The DI container.
*
* @return Insert
* @since 3.2.0
*/
public function getInsert(Container $container): Insert
{
return new Insert();
}
/**
* Get the Core Update Database
*
* @param Container $container The DI container.
*
* @return Update
* @since 3.2.0
*/
public function getUpdate(Container $container): Update
{
return new Update();
}

View File

@ -0,0 +1,34 @@
{
"add_head": "1",
"add_licensing_template": "2",
"extends": "0",
"guid": "4815e1c7-a433-443d-a112-d1e03d7df84b",
"implements": [
"-1"
],
"load_selection": null,
"name": "Database",
"power_version": "1.0.0",
"system_name": "JCB.Service.Database",
"type": "class",
"use_selection": {
"use_selection0": {
"use": "06f8eada-d59b-441c-b287-0aea1793da5a",
"as": "default"
},
"use_selection1": {
"use": "524eb8f6-38d4-47dc-92ad-98b94e099ac0",
"as": "default"
},
"use_selection2": {
"use": "cce56585-58b0-4f72-a92c-e2635ea52d83",
"as": "default"
}
},
"namespace": "VDM\\Joomla\\Componentbuilder.Service.Database",
"description": "Database Service Provider\r\n\r\n@since 3.2.0",
"implements_custom": "ServiceProviderInterface",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\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\\DI\\Container;\r\nuse Joomla\\DI\\ServiceProviderInterface;",
"composer": ""
}

View File

@ -0,0 +1,105 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# abstract class MapperDouble (Details)
> namespace: **VDM\Joomla\Componentbuilder\Abstraction**
```uml
@startuml
abstract MapperDouble #Orange {
+ array $active
+ isActive(string $firstKey = null) : bool
+ set(string $firstKey, string $secondKey, ...) : void
+ get(string $firstKey, ?string $secondKey = null) : mixed
+ exist(string $firstKey, ?string $secondKey = null) : bool
+ add(string $firstKey, string $secondKey, ...) : void
+ remove(string $firstKey, ?string $secondKey = null) : void
# {abstract} firstKey(string $key) : string
# {abstract} secondKey(string $key) : string
}
note right of MapperDouble::isActive
Check if any values are set in the active array.
since: 3.2.0
return: bool
end note
note left of MapperDouble::set
Set dynamic content
since: 3.2.0
return: void
arguments:
string $firstKey
string $secondKey
mixed $value
end note
note right of MapperDouble::get
Get dynamic content
since: 3.2.0
return: mixed
end note
note left of MapperDouble::exist
Does keys exist
since: 3.2.0
return: bool
end note
note right of MapperDouble::add
Add dynamic content
since: 3.2.0
return: void
arguments:
string $firstKey
string $secondKey
mixed $value
bool $array = false
end note
note left of MapperDouble::remove
Remove dynamic content
since: 3.2.0
return: void
end note
note right of MapperDouble::firstKey
Model the first key
since: 3.2.0
return: string
end note
note left of MapperDouble::secondKey
Model the second key
since: 3.2.0
return: string
end note
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,205 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @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\Componentbuilder\Abstraction;
use VDM\Joomla\Componentbuilder\Interfaces\Mapperdoubleinterface;
/**
* Compiler Mapper Double
*
* @since 3.2.0
*/
abstract class MapperDouble implements Mapperdoubleinterface
{
/**
* The Dynamic Content
*
* @var array
* @since 3.2.0
**/
public array $active = [];
/**
* Check if any values are set in the active array.
*
* @param string|null $firstKey Optional. The first key to check for values.
*
* @return bool True if the active array or the specified subarray is not empty, false otherwise.
* @since 3.2.0
*/
public function isActive(string $firstKey = null): bool
{
// If a firstKey is provided, check if it has any values.
if (is_string($firstKey))
{
// Get the first key from the input parameter and check if it exists in the active array.
$firstKey = $this->firstKey($firstKey);
if (isset($this->active[$firstKey]))
{
return !empty($this->active[$firstKey]);
}
return false;
}
// If no firstKey is provided, check if the entire active array has any values.
return !empty($this->active);
}
/**
* Set dynamic content
*
* @param string $firstKey The first key
* @param string $secondKey The second key
* @param mixed $value The values to set
*
* @return void
* @since 3.2.0
*/
public function set(string $firstKey, string $secondKey, $value): void
{
$this->active[$this->firstKey($firstKey)]
[$this->secondKey($secondKey)] = $value;
}
/**
* Get dynamic content
*
* @param string $firstKey The first key
* @param string|null $secondKey The second key
*
* @return mixed
* @since 3.2.0
*/
public function get(string $firstKey, ?string $secondKey = null)
{
if (is_string($secondKey))
{
return $this->active[$this->firstKey($firstKey)]
[$this->secondKey($secondKey)] ?? null;
}
return $this->active[$this->firstKey($firstKey)] ?? null;
}
/**
* Does keys exist
*
* @param string $firstKey The first key
* @param string|null $secondKey The second key
*
* @return bool
* @since 3.2.0
*/
public function exist(string $firstKey, ?string $secondKey = null): bool
{
if (is_string($secondKey) && isset($this->active[$this->firstKey($firstKey)]) &&
isset($this->active[$this->firstKey($firstKey)]
[$this->secondKey($secondKey)]))
{
return true;
}
elseif ($secondKey === null && isset($this->active[$this->firstKey($firstKey)]))
{
return true;
}
return false;
}
/**
* Add dynamic content
*
* @param string $firstKey The first key
* @param string $secondKey The second key
* @param mixed $value The values to set
* @param bool $array The is array switch
*
* @return void
* @since 3.2.0
*/
public function add(string $firstKey, string $secondKey, $value, bool $array = false): void
{
if (isset($this->active[$this->firstKey($firstKey)]) &&
isset($this->active[$this->firstKey($firstKey)]
[$this->secondKey($secondKey)]))
{
if (is_array($this->active[$this->firstKey($firstKey)]
[$this->secondKey($secondKey)]))
{
$this->active[$this->firstKey($firstKey)]
[$this->secondKey($secondKey)][] = $value;
}
else
{
$this->active[$this->firstKey($firstKey)]
[$this->secondKey($secondKey)] .= $value;
}
}
else
{
if ($array)
{
$this->active[$this->firstKey($firstKey)]
[$this->secondKey($secondKey)] = [$value];
}
else
{
$this->active[$this->firstKey($firstKey)]
[$this->secondKey($secondKey)] = $value;
}
}
}
/**
* Remove dynamic content
*
* @param string $firstKey The first key
* @param string|null $secondKey The second key
*
* @return void
* @since 3.2.0
*/
public function remove(string $firstKey, ?string $secondKey = null): void
{
if (is_string($secondKey))
{
unset($this->active[$this->firstKey($firstKey)]
[$this->secondKey($secondKey)]);
}
else
{
unset($this->active[$this->firstKey($firstKey)]);
}
}
/**
* Model the first key
*
* @param string $key The first key to model
*
* @return string
* @since 3.2.0
*/
abstract protected function firstKey(string $key): string;
/**
* Model the second key
*
* @param string $key The second key to model
*
* @return string
* @since 3.2.0
*/
abstract protected function secondKey(string $key): string;
}

View File

@ -0,0 +1 @@
[CUSTOMCODE=abstractionMapperDouble+,]

View File

@ -0,0 +1,20 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "0",
"guid": "4d4e76e9-12d9-4d19-b58c-b88974b2586a",
"implements": [
"fbc58009-fa16-4d49-a0dd-419c3b62d42f"
],
"load_selection": null,
"name": "MapperDouble",
"power_version": "1.0.0",
"system_name": "JCB.Abstraction.MapperDouble",
"type": "abstract class",
"use_selection": null,
"namespace": "VDM\\Joomla\\Componentbuilder.Abstraction.MapperDouble",
"description": "Compiler Mapper Double\r\n\r\n@since 3.2.0",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\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": ""
}

View File

@ -8,9 +8,10 @@
```
# final class Insert (Details)
> namespace: **VDM\Joomla\Database**
> extends: **Database**
```uml
@startuml
class Insert << (F,LightGreen) >> #Green {
class Insert << (F,LightGreen) >> #RoyalBlue {
# bool $defaults
+ defaults(bool $trigger = true) : void
+ rows(array $data, string $table, ...) : bool

View File

@ -0,0 +1,46 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# trait VarExport (Details)
> namespace: **VDM\Joomla\Abstraction\StorageRegistry\Traits**
```uml
@startuml
class VarExport << (T,Orange) >> #Turquoise {
# int $indent
+ varExport(?string $path = null, int $indentation = 2) : ?string
# convertIndent(array $matches) : string
}
note right of VarExport::varExport
Method to export a set of values to a PHP array
since: 3.4.0
return: ?string
end note
note right of VarExport::convertIndent
Method to convert found of grouped spaces to system indentation
since: 3.4.0
return: string
end note
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,105 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @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\Abstraction\StorageRegistry\Traits;
use VDM\Joomla\Componentbuilder\Compiler\Utilities\Indent;
/**
* Var Export Values
*
* @since 3.2.0
*/
trait VarExport
{
/**
* Default indentation value
*
* @var int
* @since 3.4.0
*/
protected int $indent = 2;
/**
* Method to export a set of values to a PHP array
*
* @param string|null $path Registry path (e.g. joomla.content.showauthor)
* @param int $indentation The default indentation
*
* @return ?string The var set being exported as a PHP array
* @since 3.4.0
*/
public function varExport(?string $path = null, int $indentation = 2): ?string
{
// Load the data array
if ($path === null && $this->isActive())
{
$data = $this->allActive();
}
else
{
$data = $this->get($path);
}
// check if we have data
if ($data === null)
{
return null;
}
// set the default indentation value
$this->indent = $indentation;
// convert to string
$data = var_export($data, true);
// replace all space with system indentation
$data = preg_replace_callback("/^(\s{2})(\s{2})?(\s{2})?(\s{2})?(\s{2})?(\s{2})?(\s{2})?(\s{2})?(\s{2})?(\s{2})?(\s{2})?(.*)/m", [$this, 'convertIndent'], $data);
// convert all array to []
$array = preg_split("/\r\n|\n|\r/", $data);
$array = preg_replace(["/\s*array\s\($/", "/\)(,)?$/", "/\s=>\s$/"], [NULL, ']$1', ' => ['], $array);
$data = implode(PHP_EOL, array_filter(["["] + $array));
// add needed indentation to the last ]
$data = preg_replace("/^(\])/m", Indent::_($indentation) . '$1', $data);
return $data;
}
/**
* Method to convert found of grouped spaces to system indentation
*
* @param array $matches The regex array of matching values
*
* @return string The resulting string.
* @since 3.4.0
*/
protected function convertIndent(array $matches): string
{
// set number to indent by default
$indent = Indent::_($this->indent);
// update each found space (group) with one indentation
foreach (range(1, 11) as $space)
{
if (strlen((string) $matches[$space]) > 0)
{
$indent .= Indent::_(1);
}
}
return $indent . $matches[12];
}
}

View File

@ -0,0 +1,79 @@
/**
* Default indentation value
*
* @var int
* @since 3.4.0
*/
protected int $indent = 2;
/**
* Method to export a set of values to a PHP array
*
* @param string|null $path Registry path (e.g. joomla.content.showauthor)
* @param int $indentation The default indentation
*
* @return ?string The var set being exported as a PHP array
* @since 3.4.0
*/
public function varExport(?string $path = null, int $indentation = 2): ?string
{
// Load the data array
if ($path === null && $this->isActive())
{
$data = $this->allActive();
}
else
{
$data = $this->get($path);
}
// check if we have data
if ($data === null)
{
return null;
}
// set the default indentation value
$this->indent = $indentation;
// convert to string
$data = var_export($data, true);
// replace all space with system indentation
$data = preg_replace_callback("/^(\s{2})(\s{2})?(\s{2})?(\s{2})?(\s{2})?(\s{2})?(\s{2})?(\s{2})?(\s{2})?(\s{2})?(\s{2})?(.*)/m", [$this, 'convertIndent'], $data);
// convert all array to []
$array = preg_split("/\r\n|\n|\r/", $data);
$array = preg_replace(["/\s*array\s\($/", "/\)(,)?$/", "/\s=>\s$/"], [NULL, ']$1', ' => ['], $array);
$data = implode(PHP_EOL, array_filter(["["] + $array));
// add needed indentation to the last ]
$data = preg_replace("/^(\])/m", Indent::_($indentation) . '$1', $data);
return $data;
}
/**
* Method to convert found of grouped spaces to system indentation
*
* @param array $matches The regex array of matching values
*
* @return string The resulting string.
* @since 3.4.0
*/
protected function convertIndent(array $matches): string
{
// set number to indent by default
$indent = Indent::_($this->indent);
// update each found space (group) with one indentation
foreach (range(1, 11) as $space)
{
if (strlen((string) $matches[$space]) > 0)
{
$indent .= Indent::_(1);
}
}
return $indent . $matches[12];
}

View File

@ -0,0 +1,23 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "0",
"guid": "52a1d14f-304a-431c-8fa4-411179942db5",
"implements": null,
"load_selection": null,
"name": "VarExport",
"power_version": "1.0.0",
"system_name": "VDM.Abstraction.StorageRegistry.Traits.VarExport",
"type": "trait",
"use_selection": {
"use_selection0": {
"use": "a68c010b-e92e-47d5-8a44-d23cfddeb6c6",
"as": "default"
}
},
"namespace": "VDM\\Joomla\\Abstraction.StorageRegistry.Traits.VarExport",
"description": "Var Export Values\r\n\r\n@since 3.2.0",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\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": ""
}

View File

@ -0,0 +1,37 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# trait GetString (Details)
> namespace: **VDM\Joomla\Abstraction\StorageRegistry\Traits**
```uml
@startuml
class GetString << (T,Orange) >> #Turquoise {
+ getString(string $path, ?string $default = null) : ?string
}
note right of GetString::getString
Get a registry path if the return value is a string
since: 3.2.0
return: ?string
end note
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,50 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @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\Abstraction\StorageRegistry\Traits;
/**
* Get String Values
*
* @since 3.2.0
*/
trait GetString
{
/**
* Get a registry path if the return value is a string
*
* @param string $path Registry path (e.g. joomla.content.showauthor)
* @param string|null $default A default value
*
* @return string|null
* @since 3.2.0
*/
public function getString(string $path, ?string $default = null): ?string
{
// Return default value if path is empty
if (empty($path))
{
return $default;
}
// get the value
if (($node = $this->get($path)) !== null
&& is_string($node)
&& strlen((string) $node) > 0)
{
return $node;
}
return $default;
}
}

View File

@ -0,0 +1,27 @@
/**
* Get a registry path if the return value is a string
*
* @param string $path Registry path (e.g. joomla.content.showauthor)
* @param string|null $default A default value
*
* @return string|null
* @since 3.2.0
*/
public function getString(string $path, ?string $default = null): ?string
{
// Return default value if path is empty
if (empty($path))
{
return $default;
}
// get the value
if (($node = $this->get($path)) !== null
&& is_string($node)
&& strlen((string) $node) > 0)
{
return $node;
}
return $default;
}

View File

@ -0,0 +1,18 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "0",
"guid": "59b1a2ea-d77e-4040-ac8c-e65cd8743e9b",
"implements": null,
"load_selection": null,
"name": "GetString",
"power_version": "1.0.0",
"system_name": "VDM.Abstraction.StorageRegistry.Traits.GetString",
"type": "trait",
"use_selection": null,
"namespace": "VDM\\Joomla\\Abstraction.StorageRegistry.Traits.GetString",
"description": "Get String Values\r\n\r\n@since 3.2.0",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\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": ""
}

View File

@ -0,0 +1,42 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# abstract class Base64Helper (Details)
> namespace: **VDM\Joomla\Utilities**
```uml
@startuml
abstract Base64Helper #Orange {
+ {static} open(?string $data, ?string $key = '__.o0=base64=Oo.__', ...) : ?string
}
note right of Base64Helper::open
open base64 string if stored as base64 (in JCB)
since: 3.2.0
return: ?string
arguments:
?string $data
?string $key = '__.o0=base64=Oo.__'
?string $default = 'string'
end note
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,65 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @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\Utilities;
use VDM\Joomla\Utilities\StringHelper;
/**
* The Base64 Helper
*
* @since 3.2.0
*/
abstract class Base64Helper
{
/**
* open base64 string if stored as base64 (in JCB)
*
* @param string|null $data The base64 string
* @param string|null $key We store the string with that suffix :)
* @param string|null $default The default switch
*
* @return string|null The opened string
* @since 3.2.0
*/
public static function open(?string $data, ?string $key = '__.o0=base64=Oo.__', ?string $default = 'string'): ?string
{
// check that we have a string
if (StringHelper::check($data))
{
// check if we have a key
if (StringHelper::check($key))
{
if (strpos($data, $key) !== false)
{
return base64_decode(str_replace($key, '', $data));
}
}
// fallback to this, not perfect method
if (base64_encode(base64_decode($data, true)) === $data)
{
return base64_decode($data);
}
}
// check if we should just return the string
if ('string' === $default)
{
return $data;
}
return $default;
}
}

View File

@ -0,0 +1,39 @@
/**
* open base64 string if stored as base64 (in JCB)
*
* @param string|null $data The base64 string
* @param string|null $key We store the string with that suffix :)
* @param string|null $default The default switch
*
* @return string|null The opened string
* @since 3.2.0
*/
public static function open(?string $data, ?string $key = '__.o0=base64=Oo.__', ?string $default = 'string'): ?string
{
// check that we have a string
if (StringHelper::check($data))
{
// check if we have a key
if (StringHelper::check($key))
{
if (strpos($data, $key) !== false)
{
return base64_decode(str_replace($key, '', $data));
}
}
// fallback to this, not perfect method
if (base64_encode(base64_decode($data, true)) === $data)
{
return base64_decode($data);
}
}
// check if we should just return the string
if ('string' === $default)
{
return $data;
}
return $default;
}

View File

@ -0,0 +1,23 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "0",
"guid": "64a6ff6c-069c-4a11-a76b-db5e36c27690",
"implements": null,
"load_selection": null,
"name": "Base64Helper",
"power_version": "1.0.0",
"system_name": "Utilities Base64 Helper",
"type": "abstract class",
"use_selection": {
"use_selection0": {
"use": "1f28cb53-60d9-4db1-b517-3c7dc6b429ef",
"as": "default"
}
},
"namespace": "VDM\\Joomla\\Utilities.Base64Helper",
"description": "The Base64 Helper\r\n\r\n@since 3.2.0",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\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": ""
}

View File

@ -0,0 +1,83 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# interface Storageregistryinterface (Details)
> namespace: **VDM\Joomla\Interfaces**
```uml
@startuml
interface Storageregistryinterface #Lavender {
+ set(string $path, mixed $value) : void
+ add(string $path, mixed $value, ...) : void
+ get(string $path, mixed $default = null) : mixed
+ remove(string $path) : void
+ exists(string $path) : bool
+ setSeparator(?string $value) : void
}
note right of Storageregistryinterface::set
Sets a value into the storage using multiple keys.
since: 3.2.0
return: void
end note
note right of Storageregistryinterface::add
Adds content into the storage. If a key exists,
it either appends or concatenates based on $asArray switch.
since: 3.2.0
return: void
arguments:
string $path
mixed $value
bool $asArray = false
end note
note right of Storageregistryinterface::get
Retrieves a value (or sub-array) from the storage using multiple keys.
since: 3.2.0
return: mixed
end note
note right of Storageregistryinterface::remove
Removes a value (or sub-array) from the storage using multiple keys.
since: 3.2.0
return: void
end note
note right of Storageregistryinterface::exists
Checks the existence of a particular location in the storage using multiple keys.
since: 3.2.0
return: bool
end note
note right of Storageregistryinterface::setSeparator
Sets a separator value
since: 3.2.0
return: void
end note
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,92 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @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\Interfaces;
/**
* The Storage Registry Interface
*
* @since 3.2.0
*/
interface Storageregistryinterface
{
/**
* Sets a value into the storage using multiple keys.
*
* @param string $path Storage path (e.g. vdm.content.builder)
* @param mixed $value Value of entry
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return void
* @since 3.2.0
*/
public function set(string $path, $value): void;
/**
* Adds content into the storage. If a key exists,
* it either appends or concatenates based on $asArray switch.
*
* @param string $path Storage path (e.g. vdm.content.builder)
* @param mixed $value Value of entry
* @param bool $asArray Determines if the new value should be treated as an array. Default is false.
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return void
* @since 3.2.0
*/
public function add(string $path, $value, bool $asArray = false): void;
/**
* Retrieves a value (or sub-array) from the storage using multiple keys.
*
* @param string $path Storage path (e.g. vdm.content.builder)
* @param mixed $default Optional default value, returned if the internal doesn't exist.
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return mixed The value or sub-array from the storage. Null if the location doesn't exist.
* @since 3.2.0
*/
public function get(string $path, $default = null);
/**
* Removes a value (or sub-array) from the storage using multiple keys.
*
* @param string $path Storage path (e.g. vdm.content.builder)
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return void
* @since 3.2.0
*/
public function remove(string $path): void;
/**
* Checks the existence of a particular location in the storage using multiple keys.
*
* @param string $path Storage path (e.g. vdm.content.builder)
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return bool True if the location exists, false otherwise.
* @since 3.2.0
*/
public function exists(string $path): bool;
/**
* Sets a separator value
*
* @param string|null $value The value to set.
*
* @return void
* @since 3.2.0
*/
public function setSeparator(?string $value): void;
}

View File

@ -0,0 +1,69 @@
/**
* Sets a value into the storage using multiple keys.
*
* @param string $path Storage path (e.g. vdm.content.builder)
* @param mixed $value Value of entry
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return void
* @since 3.2.0
*/
public function set(string $path, $value): void;
/**
* Adds content into the storage. If a key exists,
* it either appends or concatenates based on $asArray switch.
*
* @param string $path Storage path (e.g. vdm.content.builder)
* @param mixed $value Value of entry
* @param bool $asArray Determines if the new value should be treated as an array. Default is false.
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return void
* @since 3.2.0
*/
public function add(string $path, $value, bool $asArray = false): void;
/**
* Retrieves a value (or sub-array) from the storage using multiple keys.
*
* @param string $path Storage path (e.g. vdm.content.builder)
* @param mixed $default Optional default value, returned if the internal doesn't exist.
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return mixed The value or sub-array from the storage. Null if the location doesn't exist.
* @since 3.2.0
*/
public function get(string $path, $default = null);
/**
* Removes a value (or sub-array) from the storage using multiple keys.
*
* @param string $path Storage path (e.g. vdm.content.builder)
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return void
* @since 3.2.0
*/
public function remove(string $path): void;
/**
* Checks the existence of a particular location in the storage using multiple keys.
*
* @param string $path Storage path (e.g. vdm.content.builder)
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return bool True if the location exists, false otherwise.
* @since 3.2.0
*/
public function exists(string $path): bool;
/**
* Sets a separator value
*
* @param string|null $value The value to set.
*
* @return void
* @since 3.2.0
*/
public function setSeparator(?string $value): void;

View File

@ -0,0 +1,18 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "0",
"guid": "64e291c2-11f1-423d-a44d-837cc12cc017",
"implements": null,
"load_selection": null,
"name": "Storageregistryinterface",
"power_version": "1.0.0",
"system_name": "VDM.Interfaces.Storageregistryinterface",
"type": "interface",
"use_selection": null,
"namespace": "VDM\\Joomla\\Interfaces.Storageregistryinterface",
"description": "The Storage Registry Interface\r\n\r\n@since 3.2.0",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\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": ""
}

View File

@ -0,0 +1,88 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# interface Mapperdoublejoininterface (Details)
> namespace: **VDM\Joomla\Componentbuilder\Interfaces**
```uml
@startuml
interface Mapperdoublejoininterface #Lavender {
+ isActive_(string $firstKey = null) : bool
+ set_(string $firstKey, string $secondKey, ...) : void
+ get_(string $firstKey, ?string $secondKey = null) : mixed
+ exist_(string $firstKey, ?string $secondKey = null) : bool
+ add_(string $firstKey, string $secondKey, ...) : void
+ remove_(string $firstKey, ?string $secondKey = null) : void
}
note right of Mapperdoublejoininterface::isActive_
Check if any values are set in the active array.
since: 3.2.0
return: bool
end note
note right of Mapperdoublejoininterface::set_
Set dynamic content
since: 3.2.0
return: void
arguments:
string $firstKey
string $secondKey
mixed $value
end note
note right of Mapperdoublejoininterface::get_
Get dynamic content
since: 3.2.0
return: mixed
end note
note right of Mapperdoublejoininterface::exist_
Does keys exist
since: 3.2.0
return: bool
end note
note right of Mapperdoublejoininterface::add_
Add dynamic content
since: 3.2.0
return: void
arguments:
string $firstKey
string $secondKey
mixed $value
bool $array = false
end note
note right of Mapperdoublejoininterface::remove_
Remove dynamic content
since: 3.2.0
return: void
end note
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,89 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @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\Componentbuilder\Interfaces;
/**
* The Double Jointed Mapper Interface
*/
interface Mapperdoublejoininterface
{
/**
* Check if any values are set in the active array.
*
* @param string|null $firstKey Optional. The first key to check for values.
*
* @return bool True if the active array or the specified subarray is not empty, false otherwise.
* @since 3.2.0
*/
public function isActive_(string $firstKey = null): bool;
/**
* Set dynamic content
*
* @param string $firstKey The first key
* @param string $secondKey The second key
* @param mixed $value The values to set
*
* @return void
* @since 3.2.0
*/
public function set_(string $firstKey, string $secondKey, $value): void;
/**
* Get dynamic content
*
* @param string $firstKey The first key
* @param string|null $secondKey The second key
*
* @return mixed
* @since 3.2.0
*/
public function get_(string $firstKey, ?string $secondKey = null);
/**
* Does keys exist
*
* @param string $firstKey The first key
* @param string|null $secondKey The second key
*
* @return bool
* @since 3.2.0
*/
public function exist_(string $firstKey, ?string $secondKey = null): bool;
/**
* Add dynamic content
*
* @param string $firstKey The first key
* @param string $secondKey The second key
* @param mixed $value The values to set
* @param bool $array The is array switch
*
* @return void
* @since 3.2.0
*/
public function add_(string $firstKey, string $secondKey, $value, bool $array = false): void;
/**
* Remove dynamic content
*
* @param string $firstKey The first key
* @param string|null $secondKey The second key
*
* @return void
* @since 3.2.0
*/
public function remove_(string $firstKey, ?string $secondKey = null): void;
}

View File

@ -0,0 +1 @@
[CUSTOMCODE=interfacesMapperDouble+_]

View File

@ -0,0 +1,18 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "0",
"guid": "7921a2b3-b58c-4184-af3f-f58094f695a8",
"implements": null,
"load_selection": null,
"name": "Mapperdoublejoininterface",
"power_version": "1.0.0",
"system_name": "JCB.Interfaces.Mapperdoublejoininterface",
"type": "interface",
"use_selection": null,
"namespace": "VDM\\Joomla\\Componentbuilder.Interfaces.Mapperdoublejoininterface",
"description": "The Double Jointed Mapper Interface",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\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": ""
}

View File

@ -0,0 +1,37 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# trait ToString (Details)
> namespace: **VDM\Joomla\Abstraction\StorageRegistry\Traits**
```uml
@startuml
class ToString << (T,Orange) >> #Turquoise {
+ toString(string $path, string $separator = '') : string
}
note right of ToString::toString
Convert an array of values to a string (or return string)
since: 3.2.0
return: string
end note
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,55 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @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\Abstraction\StorageRegistry\Traits;
/**
* To String Values
*
* @since 3.2.0
*/
trait ToString
{
/**
* Convert an array of values to a string (or return string)
*
* @param string $path Registry path (e.g. joomla.content.showauthor)
* @param string $seperator Return string separator
*
* @return string
* @since 3.2.0
*/
public function toString(string $path, string $separator = ''): string
{
// Return default value if path is empty
if (empty($path))
{
return '';
}
// get the value
if (($node = $this->get($path)) !== null)
{
if (is_array($node) && $node !== [])
{
return implode($separator, $node);
}
elseif (is_string($node) && strlen((string) $node) > 0)
{
return $node;
}
}
return '';
}
}

View File

@ -0,0 +1,32 @@
/**
* Convert an array of values to a string (or return string)
*
* @param string $path Registry path (e.g. joomla.content.showauthor)
* @param string $seperator Return string separator
*
* @return string
* @since 3.2.0
*/
public function toString(string $path, string $separator = ''): string
{
// Return default value if path is empty
if (empty($path))
{
return '';
}
// get the value
if (($node = $this->get($path)) !== null)
{
if (is_array($node) && $node !== [])
{
return implode($separator, $node);
}
elseif (is_string($node) && strlen((string) $node) > 0)
{
return $node;
}
}
return '';
}

View File

@ -0,0 +1,18 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "0",
"guid": "7d494d91-ab60-43cd-aecf-d50e07f7f30e",
"implements": null,
"load_selection": null,
"name": "ToString",
"power_version": "1.0.0",
"system_name": "VDM.Abstraction.StorageRegistry.Traits.ToString",
"type": "trait",
"use_selection": null,
"namespace": "VDM\\Joomla\\Abstraction.StorageRegistry.Traits.ToString",
"description": "To String Values\r\n\r\n@since 3.2.0",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\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": ""
}

View File

@ -0,0 +1,93 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# abstract class StorageRegistry (Details)
> namespace: **VDM\Joomla\Abstraction**
> extends: **ActiveStorageRegistry**
```uml
@startuml
abstract StorageRegistry #Orange {
# ?string $separator
+ set(string $path, mixed $value) : void
+ add(string $path, mixed $value, ...) : void
+ get(string $path, mixed $default = null) : mixed
+ remove(string $path) : void
+ exists(string $path) : bool
+ setSeparator(?string $value) : void
# getActiveKeys(string $path) : ?array
}
note right of StorageRegistry::set
Sets a value into the storage using multiple keys.
since: 3.2.0
return: void
end note
note right of StorageRegistry::add
Adds content into the storage. If a key exists,
it either appends or concatenates based on $asArray switch.
since: 3.2.0
return: void
arguments:
string $path
mixed $value
bool $asArray = false
end note
note right of StorageRegistry::get
Retrieves a value (or sub-array) from the storage using multiple keys.
since: 3.2.0
return: mixed
end note
note right of StorageRegistry::remove
Removes a value (or sub-array) from the storage using multiple keys.
since: 3.2.0
return: void
end note
note right of StorageRegistry::exists
Checks the existence of a particular location in the storage using multiple keys.
since: 3.2.0
return: bool
end note
note right of StorageRegistry::setSeparator
Sets a separator value
since: 3.2.0
return: void
end note
note right of StorageRegistry::getActiveKeys
Get that the active keys from a path
since: 3.2.0
return: ?array
end note
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,182 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @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\Abstraction;
use VDM\Joomla\Interfaces\Activestorageregistryinterface;
use VDM\Joomla\Interfaces\Storageregistryinterface;
use VDM\Joomla\Abstraction\ActiveStorageRegistry;
/**
* Storage Registry.
*
* Don't use this beyond 10 dimensional depth for best performance.
*
* @since 3.2.0
*/
abstract class StorageRegistry extends ActiveStorageRegistry implements Activestorageregistryinterface, Storageregistryinterface
{
/**
* Path separator
*
* @var string|null
* @since 3.2.0
*/
protected ?string $separator = '.';
/**
* Sets a value into the storage using multiple keys.
*
* @param string $path Storage path (e.g. vdm.content.builder)
* @param mixed $value Value of entry
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return void
* @since 3.2.0
*/
public function set(string $path, $value): void
{
if (($keys = $this->getActiveKeys($path)) === null)
{
throw new \InvalidArgumentException("Path must only be strings or numbers to set any value.");
}
$this->setActive($value, ...$keys);
}
/**
* Adds content into the storage. If a key exists,
* it either appends or concatenates based on $asArray switch.
*
* @param string $path Storage path (e.g. vdm.content.builder)
* @param mixed $value Value of entry
* @param bool $asArray Determines if the new value should be treated as an array. Default is false.
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return void
* @since 3.2.0
*/
public function add(string $path, $value, bool $asArray = false): void
{
if (($keys = $this->getActiveKeys($path)) === null)
{
throw new \InvalidArgumentException("Path must only be strings or numbers to add any value.");
}
$this->addActive($value, $asArray, ...$keys);
}
/**
* Retrieves a value (or sub-array) from the storage using multiple keys.
*
* @param string $path Storage path (e.g. vdm.content.builder)
* @param mixed $default Optional default value, returned if the internal doesn't exist.
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return mixed The value or sub-array from the storage. Null if the location doesn't exist.
* @since 3.2.0
*/
public function get(string $path, $default = null)
{
if (($keys = $this->getActiveKeys($path)) === null)
{
throw new \InvalidArgumentException("Path must only be strings or numbers to get any value.");
}
return $this->getActive($default, ...$keys);
}
/**
* Removes a value (or sub-array) from the storage using multiple keys.
*
* @param string $path Storage path (e.g. vdm.content.builder)
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return void
* @since 3.2.0
*/
public function remove(string $path): void
{
if (($keys = $this->getActiveKeys($path)) === null)
{
throw new \InvalidArgumentException("Path must only be strings or numbers to remove any value.");
}
$this->removeActive(...$keys);
}
/**
* Checks the existence of a particular location in the storage using multiple keys.
*
* @param string $path Storage path (e.g. vdm.content.builder)
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return bool True if the location exists, false otherwise.
* @since 3.2.0
*/
public function exists(string $path): bool
{
if (($keys = $this->getActiveKeys($path)) === null)
{
throw new \InvalidArgumentException("Path must only be strings or numbers to check if any value exist.");
}
return $this->existsActive(...$keys);
}
/**
* Sets a separator value
*
* @param string|null $value The value to set.
*
* @return void
* @since 3.2.0
*/
public function setSeparator(?string $value): void
{
$this->separator = $value;
}
/**
* Get that the active keys from a path
*
* @param string $path The path to determine the location storage.
*
* @return array|null The valid array of keys
* @since 3.2.0
*/
protected function getActiveKeys(string $path): ?array
{
// empty path no allowed
if ($path === '')
{
return null;
}
// Flatten the path
if ($this->separator === null || $this->separator === '')
{
return [$path];
}
$keys = array_values(array_filter(explode($this->separator, $path), 'strlen'));
if (empty($keys))
{
return null;
}
return $keys;
}
}

View File

@ -0,0 +1,152 @@
/**
* Path separator
*
* @var string|null
* @since 3.2.0
*/
protected ?string $separator = '.';
/**
* Sets a value into the storage using multiple keys.
*
* @param string $path Storage path (e.g. vdm.content.builder)
* @param mixed $value Value of entry
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return void
* @since 3.2.0
*/
public function set(string $path, $value): void
{
if (($keys = $this->getActiveKeys($path)) === null)
{
throw new \InvalidArgumentException("Path must only be strings or numbers to set any value.");
}
$this->setActive($value, ...$keys);
}
/**
* Adds content into the storage. If a key exists,
* it either appends or concatenates based on $asArray switch.
*
* @param string $path Storage path (e.g. vdm.content.builder)
* @param mixed $value Value of entry
* @param bool $asArray Determines if the new value should be treated as an array. Default is false.
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return void
* @since 3.2.0
*/
public function add(string $path, $value, bool $asArray = false): void
{
if (($keys = $this->getActiveKeys($path)) === null)
{
throw new \InvalidArgumentException("Path must only be strings or numbers to add any value.");
}
$this->addActive($value, $asArray, ...$keys);
}
/**
* Retrieves a value (or sub-array) from the storage using multiple keys.
*
* @param string $path Storage path (e.g. vdm.content.builder)
* @param mixed $default Optional default value, returned if the internal doesn't exist.
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return mixed The value or sub-array from the storage. Null if the location doesn't exist.
* @since 3.2.0
*/
public function get(string $path, $default = null)
{
if (($keys = $this->getActiveKeys($path)) === null)
{
throw new \InvalidArgumentException("Path must only be strings or numbers to get any value.");
}
return $this->getActive($default, ...$keys);
}
/**
* Removes a value (or sub-array) from the storage using multiple keys.
*
* @param string $path Storage path (e.g. vdm.content.builder)
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return void
* @since 3.2.0
*/
public function remove(string $path): void
{
if (($keys = $this->getActiveKeys($path)) === null)
{
throw new \InvalidArgumentException("Path must only be strings or numbers to remove any value.");
}
$this->removeActive(...$keys);
}
/**
* Checks the existence of a particular location in the storage using multiple keys.
*
* @param string $path Storage path (e.g. vdm.content.builder)
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return bool True if the location exists, false otherwise.
* @since 3.2.0
*/
public function exists(string $path): bool
{
if (($keys = $this->getActiveKeys($path)) === null)
{
throw new \InvalidArgumentException("Path must only be strings or numbers to check if any value exist.");
}
return $this->existsActive(...$keys);
}
/**
* Sets a separator value
*
* @param string|null $value The value to set.
*
* @return void
* @since 3.2.0
*/
public function setSeparator(?string $value): void
{
$this->separator = $value;
}
/**
* Get that the active keys from a path
*
* @param string $path The path to determine the location storage.
*
* @return array|null The valid array of keys
* @since 3.2.0
*/
protected function getActiveKeys(string $path): ?array
{
// empty path no allowed
if ($path === '')
{
return null;
}
// Flatten the path
if ($this->separator === null || $this->separator === '')
{
return [$path];
}
$keys = array_values(array_filter(explode($this->separator, $path), 'strlen'));
if (empty($keys))
{
return null;
}
return $keys;
}

View File

@ -0,0 +1,21 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "43134867-5cb8-4280-9be8-309fd2fd135f",
"guid": "7e822c03-1b20-41d1-9427-f5b8d5836af7",
"implements": [
"af0eedbe-603b-4671-8e5a-28165d88254b",
"64e291c2-11f1-423d-a44d-837cc12cc017"
],
"load_selection": null,
"name": "StorageRegistry",
"power_version": "1.0.0",
"system_name": "VDM.Abstraction.StorageRegistry",
"type": "abstract class",
"use_selection": null,
"namespace": "VDM\\Joomla\\Abstraction.StorageRegistry",
"description": "Storage Registry.\r\n\r\nDon't use this beyond 10 dimensional depth for best performance.\r\n\r\n@since 3.2.0",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\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": ""
}

View File

@ -7,7 +7,7 @@
"load_selection": null,
"name": "InsertInterface",
"power_version": "1.0.0",
"system_name": "JCB.Interfaces.InsertInterface",
"system_name": "VDM.Interfaces.InsertInterface",
"type": "interface",
"use_selection": null,
"namespace": "VDM\\Joomla\\Interfaces.InsertInterface",

View File

@ -0,0 +1,91 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# interface Activestorageregistryinterface (Details)
> namespace: **VDM\Joomla\Interfaces**
```uml
@startuml
interface Activestorageregistryinterface #Lavender {
+ isActive() : bool
+ allActive() : array
+ setActive(mixed $value, $keys) : void
+ addActive(mixed $value, bool $asArray, ...) : void
+ getActive(mixed $default, $keys) : mixed
+ removeActive($keys) : void
+ existsActive($keys) : bool
}
note right of Activestorageregistryinterface::isActive
Check if the main storage has any content.
since: 3.2.0
return: bool
end note
note right of Activestorageregistryinterface::allActive
Retrieves all value from the storage.
since: 3.2.0
return: array
end note
note right of Activestorageregistryinterface::setActive
Sets a value into the storage using multiple keys.
since: 3.2.0
return: void
end note
note right of Activestorageregistryinterface::addActive
Adds content into the storage. If a key exists,
it either appends or concatenates based on the value's type.
since: 3.2.0
return: void
arguments:
mixed $value
bool $asArray
$keys
end note
note right of Activestorageregistryinterface::getActive
Retrieves a value (or sub-array) from the storage using multiple keys.
since: 3.2.0
return: mixed
end note
note right of Activestorageregistryinterface::removeActive
Removes a value (or sub-array) from the storage using multiple keys.
since: 3.2.0
return: void
end note
note right of Activestorageregistryinterface::existsActive
Checks the existence of a particular location in the storage using multiple keys.
since: 3.2.0
return: bool
end note
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,98 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @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\Interfaces;
/**
* The Active Storage Registry Interface
*
* @since 3.2.0
*/
interface Activestorageregistryinterface
{
/**
* Check if the main storage has any content.
*
* @return bool Returns true if the active array is not empty, false otherwise.
* @since 3.2.0
*/
public function isActive(): bool;
/**
* Retrieves all value from the storage.
*
* @return array The values.
* @since 3.2.0
*/
public function allActive(): array;
/**
* Sets a value into the storage using multiple keys.
*
* @param mixed $value The value to set.
* @param string ...$keys The keys to determine the location.
*
* @throws \InvalidArgumentException If any of the keys are not a number or string.
* @return void
* @since 3.2.0
*/
public function setActive($value, string ...$keys): void;
/**
* Adds content into the storage. If a key exists,
* it either appends or concatenates based on the value's type.
*
* @param mixed $value The value to set.
* @param bool $asArray Determines if the new value should be treated as an array.
* @param string ...$keys The keys to determine the location.
*
* @throws \InvalidArgumentException If any of the keys are not a number or string.
* @return void
* @since 3.2.0
*/
public function addActive($value, bool $asArray, string ...$keys): void;
/**
* Retrieves a value (or sub-array) from the storage using multiple keys.
*
* @param mixed $default The default value if not set.
* @param string ...$keys The keys to determine the location.
*
* @throws \InvalidArgumentException If any of the keys are not a number or string.
* @return mixed The value or sub-array from the storage. Null if the location doesn't exist.
* @since 3.2.0
*/
public function getActive($default, string ...$keys);
/**
* Removes a value (or sub-array) from the storage using multiple keys.
*
* @param string ...$keys The keys to determine the location.
*
* @throws \InvalidArgumentException If any of the keys are not a number or string.
* @return void
* @since 3.2.0
*/
public function removeActive(string ...$keys): void;
/**
* Checks the existence of a particular location in the storage using multiple keys.
*
* @param string ...$keys The keys to determine the location.
*
* @throws \InvalidArgumentException If any of the keys are not a number or string.
* @return bool True if the location exists, false otherwise.
* @since 3.2.0
*/
public function existsActive(string ...$keys): bool;
}

View File

@ -0,0 +1,75 @@
/**
* Check if the main storage has any content.
*
* @return bool Returns true if the active array is not empty, false otherwise.
* @since 3.2.0
*/
public function isActive(): bool;
/**
* Retrieves all value from the storage.
*
* @return array The values.
* @since 3.2.0
*/
public function allActive(): array;
/**
* Sets a value into the storage using multiple keys.
*
* @param mixed $value The value to set.
* @param string ...$keys The keys to determine the location.
*
* @throws \InvalidArgumentException If any of the keys are not a number or string.
* @return void
* @since 3.2.0
*/
public function setActive($value, string ...$keys): void;
/**
* Adds content into the storage. If a key exists,
* it either appends or concatenates based on the value's type.
*
* @param mixed $value The value to set.
* @param bool $asArray Determines if the new value should be treated as an array.
* @param string ...$keys The keys to determine the location.
*
* @throws \InvalidArgumentException If any of the keys are not a number or string.
* @return void
* @since 3.2.0
*/
public function addActive($value, bool $asArray, string ...$keys): void;
/**
* Retrieves a value (or sub-array) from the storage using multiple keys.
*
* @param mixed $default The default value if not set.
* @param string ...$keys The keys to determine the location.
*
* @throws \InvalidArgumentException If any of the keys are not a number or string.
* @return mixed The value or sub-array from the storage. Null if the location doesn't exist.
* @since 3.2.0
*/
public function getActive($default, string ...$keys);
/**
* Removes a value (or sub-array) from the storage using multiple keys.
*
* @param string ...$keys The keys to determine the location.
*
* @throws \InvalidArgumentException If any of the keys are not a number or string.
* @return void
* @since 3.2.0
*/
public function removeActive(string ...$keys): void;
/**
* Checks the existence of a particular location in the storage using multiple keys.
*
* @param string ...$keys The keys to determine the location.
*
* @throws \InvalidArgumentException If any of the keys are not a number or string.
* @return bool True if the location exists, false otherwise.
* @since 3.2.0
*/
public function existsActive(string ...$keys): bool;

View File

@ -0,0 +1,18 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "0",
"guid": "af0eedbe-603b-4671-8e5a-28165d88254b",
"implements": null,
"load_selection": null,
"name": "Activestorageregistryinterface",
"power_version": "1.0.0",
"system_name": "VDM.Interfaces.Activestorageregistryinterface",
"type": "interface",
"use_selection": null,
"namespace": "VDM\\Joomla\\Interfaces.Activestorageregistryinterface",
"description": "The Active Storage Registry Interface\r\n\r\n@since 3.2.0",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\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": ""
}

View File

@ -8,6 +8,7 @@
```
# abstract class BaseRegistry (Details)
> namespace: **VDM\Joomla\Componentbuilder\Abstraction**
> extends: **JoomlaRegistry**
```uml
@startuml
abstract BaseRegistry #Orange {

View File

@ -8,6 +8,7 @@
```
# class Table (Details)
> namespace: **VDM\Joomla\Componentbuilder**
> extends: **BaseTable**
```uml
@startuml
class Table #Gold {

View File

@ -16,7 +16,7 @@ abstract MapperSingle #Orange {
+ set(string $key, mixed $value) : void
+ get(string $key) : mixed
+ exist(string $key) : bool
+ add(string $key, mixed $value) : void
+ add(string $key, mixed $value, ...) : void
+ remove(string $key) : void
# {abstract} key(string $key) : string
}
@ -54,6 +54,11 @@ note right of MapperSingle::add
since: 3.2.0
return: void
arguments:
string $key
mixed $value
bool $array = false
end note
note right of MapperSingle::remove

View File

@ -51,7 +51,7 @@ abstract class MapperSingle implements Mappersingleinterface
* @return void
* @since 3.2.0
*/
public function set(string $key, $value)
public function set(string $key, $value): void
{
$this->active[$this->key($key)] = $value;
}
@ -91,19 +91,34 @@ abstract class MapperSingle implements Mappersingleinterface
*
* @param string $key The main string key
* @param mixed $value The values to set
* @param bool $array The is array switch
*
* @return void
* @since 3.2.0
*/
public function add(string $key, $value)
public function add(string $key, $value, bool $array = false): void
{
if (isset($this->active[$this->key($key)]))
{
$this->active[$this->key($key)] .= $value;
if (is_array($this->active[$this->key($key)]))
{
$this->active[$this->key($key)][] = $value;
}
else
{
$this->active[$this->key($key)] .= $value;
}
}
else
{
$this->active[$this->key($key)] = $value;
if ($array)
{
$this->active[$this->key($key)] = [$value];
}
else
{
$this->active[$this->key($key)] = $value;
}
}
}
@ -115,7 +130,7 @@ abstract class MapperSingle implements Mappersingleinterface
* @return void
* @since 3.2.0
*/
public function remove(string $key)
public function remove(string $key): void
{
unset($this->active[$this->key($key)]);
}

View File

@ -8,9 +8,10 @@
```
# final class Update (Details)
> namespace: **VDM\Joomla\Database**
> extends: **Database**
```uml
@startuml
class Update << (F,LightGreen) >> #Green {
class Update << (F,LightGreen) >> #RoyalBlue {
+ rows(array $data, string $key, ...) : bool
+ items(array $data, string $key, ...) : bool
+ row(array $data, string $key, ...) : bool

View File

@ -11,7 +11,7 @@
```uml
@startuml
abstract NamespaceHelper #Orange {
+ {static} safe(string $string, bool $removeNumbers = true) : string
+ {static} safe(string $string) : string
}
note right of NamespaceHelper::safe

View File

@ -25,47 +25,43 @@ abstract class NamespaceHelper
/**
* Making namespace safe
*
* @input string $string The you would like to make safe
* @input bool $removeNumbers The switch to remove numbers
* @param string $string The namespace string you would like to make safe
*
* @returns string on success
*
* @return string on success
* @since 3.0.9
*/
public static function safe(string $string, bool $removeNumbers = true): string
public static function safe(string $string): string
{
// 0nly continue if we have a string with length
if (StringHelper::check($string))
// Remove leading and trailing backslashes
$string = trim($string, '\\');
// Split the string into namespace segments
$segments = explode('\\', $string);
foreach ($segments as &$segment)
{
// make sure it has not numbers
if ($removeNumbers)
// Check if segment starts with a number
if (preg_match("/^\d/", $segment))
{
$string = StringHelper::numbers($string);
// Extract the starting number(s)
preg_match("/^\d+/", $segment, $matches);
if (isset($matches[0]))
{
$numberWord = StringHelper::numbers($matches[0]);
$segment = str_replace($matches[0], $numberWord, $segment);
}
}
// Transliterate string TODO: look again as this makes it lowercase
// $string = StringHelper::transliterate($string);
// $segment = StringHelper::transliterate($segment);
// first remove all [\] backslashes
$string = str_replace('\\', '+', (string) $string);
// remove all and keep only characters and [\] backslashes inside of the string
if ($removeNumbers)
{
$string = trim( preg_replace("/[^A-Za-z\+]/", '', $string), '+');
}
else
{
$string = trim( preg_replace("/[^A-Za-z0-9\+]/", '', $string), '+');
}
// place the [\] backslashes back
return trim( preg_replace("/\++/", '\\', $string));
// Make sure segment only contains valid characters
$segment = preg_replace("/[^A-Za-z0-9]/", '', $segment);
}
// not a string
return '';
}
// Join the namespace segments back together
return implode('\\', $segments);
}
}

View File

@ -1,44 +1,41 @@
/**
* Making namespace safe
*
* @input string $string The you would like to make safe
* @input bool $removeNumbers The switch to remove numbers
* @param string $string The namespace string you would like to make safe
*
* @returns string on success
*
* @return string on success
* @since 3.0.9
*/
public static function safe(string $string, bool $removeNumbers = true): string
public static function safe(string $string): string
{
// 0nly continue if we have a string with length
if (StringHelper::check($string))
// Remove leading and trailing backslashes
$string = trim($string, '\\');
// Split the string into namespace segments
$segments = explode('\\', $string);
foreach ($segments as &$segment)
{
// make sure it has not numbers
if ($removeNumbers)
// Check if segment starts with a number
if (preg_match("/^\d/", $segment))
{
$string = StringHelper::numbers($string);
// Extract the starting number(s)
preg_match("/^\d+/", $segment, $matches);
if (isset($matches[0]))
{
$numberWord = StringHelper::numbers($matches[0]);
$segment = str_replace($matches[0], $numberWord, $segment);
}
}
// Transliterate string TODO: look again as this makes it lowercase
// $string = StringHelper::transliterate($string);
// $segment = StringHelper::transliterate($segment);
// first remove all [\] backslashes
$string = str_replace('\\', '+', (string) $string);
// remove all and keep only characters and [\] backslashes inside of the string
if ($removeNumbers)
{
$string = trim( preg_replace("/[^A-Za-z\+]/", '', $string), '+');
}
else
{
$string = trim( preg_replace("/[^A-Za-z0-9\+]/", '', $string), '+');
}
// place the [\] backslashes back
return trim( preg_replace("/\++/", '\\', $string));
// Make sure segment only contains valid characters
$segment = preg_replace("/[^A-Za-z0-9]/", '', $segment);
}
// not a string
return '';
}
// Join the namespace segments back together
return implode('\\', $segments);
}

View File

@ -0,0 +1,37 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# trait IsString (Details)
> namespace: **VDM\Joomla\Abstraction\StorageRegistry\Traits**
```uml
@startuml
class IsString << (T,Orange) >> #Turquoise {
+ isString(string $path) : bool
}
note right of IsString::isString
Check if a registry path exists and is a string
since: 3.2.0
return: bool
end note
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,48 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @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\Abstraction\StorageRegistry\Traits;
/**
* Is String Values
*
* @since 3.2.0
*/
trait IsString
{
/**
* Check if a registry path exists and is a string
*
* @param string $path Registry path (e.g. joomla.content.showauthor)
*
* @return boolean
* @since 3.2.0
*/
public function isString(string $path): bool
{
// Return default value if path is empty
if (empty($path)) {
return false;
}
// get the value
if (($node = $this->get($path)) !== null
&& is_string($node)
&& strlen((string) $node) > 0)
{
return true;
}
return false;
}
}

View File

@ -0,0 +1,25 @@
/**
* Check if a registry path exists and is a string
*
* @param string $path Registry path (e.g. joomla.content.showauthor)
*
* @return boolean
* @since 3.2.0
*/
public function isString(string $path): bool
{
// Return default value if path is empty
if (empty($path)) {
return false;
}
// get the value
if (($node = $this->get($path)) !== null
&& is_string($node)
&& strlen((string) $node) > 0)
{
return true;
}
return false;
}

View File

@ -0,0 +1,18 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "0",
"guid": "ff7d0111-8f79-42aa-ac14-b53ba2c49369",
"implements": null,
"load_selection": null,
"name": "IsString",
"power_version": "1.0.0",
"system_name": "VDM.Abstraction.StorageRegistry.Traits.IsString",
"type": "trait",
"use_selection": null,
"namespace": "VDM\\Joomla\\Abstraction.StorageRegistry.Traits.IsString",
"description": "Is String Values\r\n\r\n@since 3.2.0",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\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": ""
}

View File

@ -8,6 +8,7 @@
```
# abstract class BaseConfig (Details)
> namespace: **VDM\Joomla\Abstraction**
> extends: **JoomlaRegistry**
```uml
@startuml
abstract BaseConfig #Orange {

View File

@ -21,6 +21,17 @@
"spk": "Super__0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a__Power",
"guid": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a"
},
"11572d9b-e3d5-4b29-904c-9618d8f2bfd8": {
"name": "Count",
"type": "trait",
"namespace": "VDM\\Joomla\\Abstraction\\StorageRegistry\\Traits",
"code": "src\/11572d9b-e3d5-4b29-904c-9618d8f2bfd8\/code.php",
"power": "src\/11572d9b-e3d5-4b29-904c-9618d8f2bfd8\/code.power",
"settings": "src\/11572d9b-e3d5-4b29-904c-9618d8f2bfd8\/settings.json",
"path": "src\/11572d9b-e3d5-4b29-904c-9618d8f2bfd8",
"spk": "Super__11572d9b_e3d5_4b29_904c_9618d8f2bfd8__Power",
"guid": "11572d9b-e3d5-4b29-904c-9618d8f2bfd8"
},
"1198aecf-84c6-45d2-aea8-d531aa4afdfa": {
"name": "FormHelper",
"type": "abstract class",
@ -54,6 +65,17 @@
"spk": "Super__1f28cb53_60d9_4db1_b517_3c7dc6b429ef__Power",
"guid": "1f28cb53-60d9-4db1-b517-3c7dc6b429ef"
},
"215b35ac-1b26-4838-bbcf-d1fdbbd9353f": {
"name": "InArray",
"type": "trait",
"namespace": "VDM\\Joomla\\Abstraction\\StorageRegistry\\Traits",
"code": "src\/215b35ac-1b26-4838-bbcf-d1fdbbd9353f\/code.php",
"power": "src\/215b35ac-1b26-4838-bbcf-d1fdbbd9353f\/code.power",
"settings": "src\/215b35ac-1b26-4838-bbcf-d1fdbbd9353f\/settings.json",
"path": "src\/215b35ac-1b26-4838-bbcf-d1fdbbd9353f",
"spk": "Super__215b35ac_1b26_4838_bbcf_d1fdbbd9353f__Power",
"guid": "215b35ac-1b26-4838-bbcf-d1fdbbd9353f"
},
"2ad31f74-f579-499d-b98b-c4f54fd615dd": {
"name": "LoadInterface",
"type": "interface",
@ -98,6 +120,17 @@
"spk": "Super__3cf76fbf_fd95_4a33_878e_7aff6d36b7f6__Power",
"guid": "3cf76fbf-fd95-4a33-878e-7aff6d36b7f6"
},
"43134867-5cb8-4280-9be8-309fd2fd135f": {
"name": "ActiveStorageRegistry",
"type": "abstract class",
"namespace": "VDM\\Joomla\\Abstraction",
"code": "src\/43134867-5cb8-4280-9be8-309fd2fd135f\/code.php",
"power": "src\/43134867-5cb8-4280-9be8-309fd2fd135f\/code.power",
"settings": "src\/43134867-5cb8-4280-9be8-309fd2fd135f\/settings.json",
"path": "src\/43134867-5cb8-4280-9be8-309fd2fd135f",
"spk": "Super__43134867_5cb8_4280_9be8_309fd2fd135f__Power",
"guid": "43134867-5cb8-4280-9be8-309fd2fd135f"
},
"44a3367c-f9e4-406b-b396-0f452bde0f03": {
"name": "Mapper",
"type": "abstract class",
@ -109,6 +142,17 @@
"spk": "Super__44a3367c_f9e4_406b_b396_0f452bde0f03__Power",
"guid": "44a3367c-f9e4-406b-b396-0f452bde0f03"
},
"4815e1c7-a433-443d-a112-d1e03d7df84b": {
"name": "Database",
"type": "class",
"namespace": "VDM\\Joomla\\Componentbuilder\\Service",
"code": "src\/4815e1c7-a433-443d-a112-d1e03d7df84b\/code.php",
"power": "src\/4815e1c7-a433-443d-a112-d1e03d7df84b\/code.power",
"settings": "src\/4815e1c7-a433-443d-a112-d1e03d7df84b\/settings.json",
"path": "src\/4815e1c7-a433-443d-a112-d1e03d7df84b",
"spk": "Super__4815e1c7_a433_443d_a112_d1e03d7df84b__Power",
"guid": "4815e1c7-a433-443d-a112-d1e03d7df84b"
},
"4b225c51-d293-48e4-b3f6-5136cf5c3f18": {
"name": "JsonHelper",
"type": "abstract class",
@ -120,6 +164,17 @@
"spk": "Super__4b225c51_d293_48e4_b3f6_5136cf5c3f18__Power",
"guid": "4b225c51-d293-48e4-b3f6-5136cf5c3f18"
},
"4d4e76e9-12d9-4d19-b58c-b88974b2586a": {
"name": "MapperDouble",
"type": "abstract class",
"namespace": "VDM\\Joomla\\Componentbuilder\\Abstraction",
"code": "src\/4d4e76e9-12d9-4d19-b58c-b88974b2586a\/code.php",
"power": "src\/4d4e76e9-12d9-4d19-b58c-b88974b2586a\/code.power",
"settings": "src\/4d4e76e9-12d9-4d19-b58c-b88974b2586a\/settings.json",
"path": "src\/4d4e76e9-12d9-4d19-b58c-b88974b2586a",
"spk": "Super__4d4e76e9_12d9_4d19_b58c_b88974b2586a__Power",
"guid": "4d4e76e9-12d9-4d19-b58c-b88974b2586a"
},
"524eb8f6-38d4-47dc-92ad-98b94e099ac0": {
"name": "Insert",
"type": "final class",
@ -131,6 +186,17 @@
"spk": "Super__524eb8f6_38d4_47dc_92ad_98b94e099ac0__Power",
"guid": "524eb8f6-38d4-47dc-92ad-98b94e099ac0"
},
"52a1d14f-304a-431c-8fa4-411179942db5": {
"name": "VarExport",
"type": "trait",
"namespace": "VDM\\Joomla\\Abstraction\\StorageRegistry\\Traits",
"code": "src\/52a1d14f-304a-431c-8fa4-411179942db5\/code.php",
"power": "src\/52a1d14f-304a-431c-8fa4-411179942db5\/code.power",
"settings": "src\/52a1d14f-304a-431c-8fa4-411179942db5\/settings.json",
"path": "src\/52a1d14f-304a-431c-8fa4-411179942db5",
"spk": "Super__52a1d14f_304a_431c_8fa4_411179942db5__Power",
"guid": "52a1d14f-304a-431c-8fa4-411179942db5"
},
"584747d1-3a86-453d-b7a3-a2219de8d777": {
"name": "Model",
"type": "abstract class",
@ -142,6 +208,17 @@
"spk": "Super__584747d1_3a86_453d_b7a3_a2219de8d777__Power",
"guid": "584747d1-3a86-453d-b7a3-a2219de8d777"
},
"59b1a2ea-d77e-4040-ac8c-e65cd8743e9b": {
"name": "GetString",
"type": "trait",
"namespace": "VDM\\Joomla\\Abstraction\\StorageRegistry\\Traits",
"code": "src\/59b1a2ea-d77e-4040-ac8c-e65cd8743e9b\/code.php",
"power": "src\/59b1a2ea-d77e-4040-ac8c-e65cd8743e9b\/code.power",
"settings": "src\/59b1a2ea-d77e-4040-ac8c-e65cd8743e9b\/settings.json",
"path": "src\/59b1a2ea-d77e-4040-ac8c-e65cd8743e9b",
"spk": "Super__59b1a2ea_d77e_4040_ac8c_e65cd8743e9b__Power",
"guid": "59b1a2ea-d77e-4040-ac8c-e65cd8743e9b"
},
"640b5352-fb09-425f-a26e-cd44eda03f15": {
"name": "Helper",
"type": "abstract class",
@ -153,6 +230,28 @@
"spk": "Super__640b5352_fb09_425f_a26e_cd44eda03f15__Power",
"guid": "640b5352-fb09-425f-a26e-cd44eda03f15"
},
"64a6ff6c-069c-4a11-a76b-db5e36c27690": {
"name": "Base64Helper",
"type": "abstract class",
"namespace": "VDM\\Joomla\\Utilities",
"code": "src\/64a6ff6c-069c-4a11-a76b-db5e36c27690\/code.php",
"power": "src\/64a6ff6c-069c-4a11-a76b-db5e36c27690\/code.power",
"settings": "src\/64a6ff6c-069c-4a11-a76b-db5e36c27690\/settings.json",
"path": "src\/64a6ff6c-069c-4a11-a76b-db5e36c27690",
"spk": "Super__64a6ff6c_069c_4a11_a76b_db5e36c27690__Power",
"guid": "64a6ff6c-069c-4a11-a76b-db5e36c27690"
},
"64e291c2-11f1-423d-a44d-837cc12cc017": {
"name": "Storageregistryinterface",
"type": "interface",
"namespace": "VDM\\Joomla\\Interfaces",
"code": "src\/64e291c2-11f1-423d-a44d-837cc12cc017\/code.php",
"power": "src\/64e291c2-11f1-423d-a44d-837cc12cc017\/code.power",
"settings": "src\/64e291c2-11f1-423d-a44d-837cc12cc017\/settings.json",
"path": "src\/64e291c2-11f1-423d-a44d-837cc12cc017",
"spk": "Super__64e291c2_11f1_423d_a44d_837cc12cc017__Power",
"guid": "64e291c2-11f1-423d-a44d-837cc12cc017"
},
"6cbef8f8-4813-48e3-b05a-65e1aea95171": {
"name": "Database",
"type": "abstract class",
@ -175,6 +274,17 @@
"spk": "Super__7179fde6_1e51_4b51_8545_7ca18f74a0f4__Power",
"guid": "7179fde6-1e51-4b51-8545-7ca18f74a0f4"
},
"7921a2b3-b58c-4184-af3f-f58094f695a8": {
"name": "Mapperdoublejoininterface",
"type": "interface",
"namespace": "VDM\\Joomla\\Componentbuilder\\Interfaces",
"code": "src\/7921a2b3-b58c-4184-af3f-f58094f695a8\/code.php",
"power": "src\/7921a2b3-b58c-4184-af3f-f58094f695a8\/code.power",
"settings": "src\/7921a2b3-b58c-4184-af3f-f58094f695a8\/settings.json",
"path": "src\/7921a2b3-b58c-4184-af3f-f58094f695a8",
"spk": "Super__7921a2b3_b58c_4184_af3f_f58094f695a8__Power",
"guid": "7921a2b3-b58c-4184-af3f-f58094f695a8"
},
"79d765b3-7319-4988-9730-446c7f347020": {
"name": "Utilities",
"type": "trait",
@ -186,6 +296,28 @@
"spk": "Super__79d765b3_7319_4988_9730_446c7f347020__Power",
"guid": "79d765b3-7319-4988-9730-446c7f347020"
},
"7d494d91-ab60-43cd-aecf-d50e07f7f30e": {
"name": "ToString",
"type": "trait",
"namespace": "VDM\\Joomla\\Abstraction\\StorageRegistry\\Traits",
"code": "src\/7d494d91-ab60-43cd-aecf-d50e07f7f30e\/code.php",
"power": "src\/7d494d91-ab60-43cd-aecf-d50e07f7f30e\/code.power",
"settings": "src\/7d494d91-ab60-43cd-aecf-d50e07f7f30e\/settings.json",
"path": "src\/7d494d91-ab60-43cd-aecf-d50e07f7f30e",
"spk": "Super__7d494d91_ab60_43cd_aecf_d50e07f7f30e__Power",
"guid": "7d494d91-ab60-43cd-aecf-d50e07f7f30e"
},
"7e822c03-1b20-41d1-9427-f5b8d5836af7": {
"name": "StorageRegistry",
"type": "abstract class",
"namespace": "VDM\\Joomla\\Abstraction",
"code": "src\/7e822c03-1b20-41d1-9427-f5b8d5836af7\/code.php",
"power": "src\/7e822c03-1b20-41d1-9427-f5b8d5836af7\/code.power",
"settings": "src\/7e822c03-1b20-41d1-9427-f5b8d5836af7\/settings.json",
"path": "src\/7e822c03-1b20-41d1-9427-f5b8d5836af7",
"spk": "Super__7e822c03_1b20_41d1_9427_f5b8d5836af7__Power",
"guid": "7e822c03-1b20-41d1-9427-f5b8d5836af7"
},
"8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff": {
"name": "ModelInterface",
"type": "interface",
@ -263,6 +395,17 @@
"spk": "Super__ad12ca1c_d3ce_4e7f_88c5_c6c92bdedc48__Power",
"guid": "ad12ca1c-d3ce-4e7f-88c5-c6c92bdedc48"
},
"af0eedbe-603b-4671-8e5a-28165d88254b": {
"name": "Activestorageregistryinterface",
"type": "interface",
"namespace": "VDM\\Joomla\\Interfaces",
"code": "src\/af0eedbe-603b-4671-8e5a-28165d88254b\/code.php",
"power": "src\/af0eedbe-603b-4671-8e5a-28165d88254b\/code.power",
"settings": "src\/af0eedbe-603b-4671-8e5a-28165d88254b\/settings.json",
"path": "src\/af0eedbe-603b-4671-8e5a-28165d88254b",
"spk": "Super__af0eedbe_603b_4671_8e5a_28165d88254b__Power",
"guid": "af0eedbe-603b-4671-8e5a-28165d88254b"
},
"b84e947d-2a13-44f7-ac0f-3902ae55ae0c": {
"name": "BaseRegistry",
"type": "abstract class",
@ -362,6 +505,17 @@
"spk": "Super__e0f6ddbe_2a35_4537_942c_faff2ebd04f6__Power",
"guid": "e0f6ddbe-2a35-4537-942c-faff2ebd04f6"
},
"ff7d0111-8f79-42aa-ac14-b53ba2c49369": {
"name": "IsString",
"type": "trait",
"namespace": "VDM\\Joomla\\Abstraction\\StorageRegistry\\Traits",
"code": "src\/ff7d0111-8f79-42aa-ac14-b53ba2c49369\/code.php",
"power": "src\/ff7d0111-8f79-42aa-ac14-b53ba2c49369\/code.power",
"settings": "src\/ff7d0111-8f79-42aa-ac14-b53ba2c49369\/settings.json",
"path": "src\/ff7d0111-8f79-42aa-ac14-b53ba2c49369",
"spk": "Super__ff7d0111_8f79_42aa_ac14_b53ba2c49369__Power",
"guid": "ff7d0111-8f79-42aa-ac14-b53ba2c49369"
},
"ffbd4e1f-a342-4080-ab7d-1de3741bf319": {
"name": "BaseConfig",
"type": "abstract class",