update 2024-04-12 19:17:27

This commit is contained in:
Robot 2024-04-12 19:17:32 +02:00
parent 4441974faa
commit 668c954e00
Signed by: Robot
GPG Key ID: 14DECD44E7E1BB95
37 changed files with 1096 additions and 50 deletions

View File

@ -49,6 +49,7 @@ This repository contains an index (see below) of all the approved powers within
- **abstract class Factory** | [Details](src/6ee3dc9e-1949-4da5-a74f-d9eb7f14e400) | [Code](src/6ee3dc9e-1949-4da5-a74f-d9eb7f14e400/code.php) | [Settings](src/6ee3dc9e-1949-4da5-a74f-d9eb7f14e400/settings.json) | Super__6ee3dc9e_1949_4da5_a74f_d9eb7f14e400__Power
- **final class Grep** | [Details](src/355bf21a-f859-4528-9110-bcd2c6d05ea7) | [Code](src/355bf21a-f859-4528-9110-bcd2c6d05ea7/code.php) | [Settings](src/355bf21a-f859-4528-9110-bcd2c6d05ea7/settings.json) | Super__355bf21a_f859_4528_9110_bcd2c6d05ea7__Power
- **final class Super** | [Details](src/39a75870-a7f7-45fd-937d-5ba97b85b8ad) | [Code](src/39a75870-a7f7-45fd-937d-5ba97b85b8ad/code.php) | [Settings](src/39a75870-a7f7-45fd-937d-5ba97b85b8ad/settings.json) | Super__39a75870_a7f7_45fd_937d_5ba97b85b8ad__Power
- **class Config** | [Details](src/0b821bba-7503-4448-90e7-f3c1bd51dfd6) | [Code](src/0b821bba-7503-4448-90e7-f3c1bd51dfd6/code.php) | [Settings](src/0b821bba-7503-4448-90e7-f3c1bd51dfd6/settings.json) | Super__0b821bba_7503_4448_90e7_f3c1bd51dfd6__Power
- **Namespace**: [VDM\Joomla\Componentbuilder\Power](#vdm-joomla-componentbuilder-power)
- **abstract class Factory** | [Details](src/a5734b9e-a72d-494c-bc72-c3bc7506015f) | [Code](src/a5734b9e-a72d-494c-bc72-c3bc7506015f/code.php) | [Settings](src/a5734b9e-a72d-494c-bc72-c3bc7506015f/settings.json) | Super__a5734b9e_a72d_494c_bc72_c3bc7506015f__Power
@ -400,6 +401,7 @@ This repository contains an index (see below) of all the approved powers within
- **Namespace**: [VDM\Joomla\Componentbuilder\JoomlaPower\Service](#vdm-joomla-componentbuilder-joomlapower-service)
- **class Database** | [Details](src/a2992a91-eec2-4957-811b-8cde22aa1438) | [Code](src/a2992a91-eec2-4957-811b-8cde22aa1438/code.php) | [Settings](src/a2992a91-eec2-4957-811b-8cde22aa1438/settings.json) | Super__a2992a91_eec2_4957_811b_8cde22aa1438__Power
- **class JoomlaPower** | [Details](src/38e1ca3e-1908-459a-be87-9f83b292058f) | [Code](src/38e1ca3e-1908-459a-be87-9f83b292058f/code.php) | [Settings](src/38e1ca3e-1908-459a-be87-9f83b292058f/settings.json) | Super__38e1ca3e_1908_459a_be87_9f83b292058f__Power
- **Namespace**: [VDM\Joomla\Componentbuilder\Power\Database](#vdm-joomla-componentbuilder-power-database)
- **interface LoadInterface** | [Details](src/99786f53-64b7-4d52-95b0-5306e7386c3f) | [Code](src/99786f53-64b7-4d52-95b0-5306e7386c3f/code.php) | [Settings](src/99786f53-64b7-4d52-95b0-5306e7386c3f/settings.json) | Super__99786f53_64b7_4d52_95b0_5306e7386c3f__Power

View File

@ -8,7 +8,7 @@
```
# final class Load (Details)
> namespace: **VDM\Joomla\Componentbuilder\JoomlaPower\Model**
> extends: **Load**
> extends: **ExtendingLoad**
```uml
@startuml
class Load << (F,LightGreen) >> #RoyalBlue {

View File

@ -13,7 +13,7 @@ namespace VDM\Joomla\Componentbuilder\JoomlaPower\Model;
use VDM\Joomla\Interfaces\ModelInterface;
use VDM\Joomla\Componentbuilder\Power\Model\Load;
use VDM\Joomla\Componentbuilder\Power\Model\Load as ExtendingLoad;
/**
@ -21,7 +21,7 @@ use VDM\Joomla\Componentbuilder\Power\Model\Load;
*
* @since 3.2.0
*/
final class Load extends Load implements ModelInterface
final class Load extends ExtendingLoad implements ModelInterface
{
/**
* Get the current active table

View File

@ -0,0 +1,131 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# class Config (Details)
> namespace: **VDM\Joomla\Componentbuilder\JoomlaPower**
> extends: **BaseConfig**
```uml
@startuml
class Config #Gold {
# JoomlaRegistry $config
+ __construct(?Input $input = null, ?JoomlaRegistry $params = null, ...)
# getGiteatoken() : ?string
# getAddcustomgiteaurl() : int
# getCustomgiteaurl() : ?string
# getCustomgiteatoken() : ?string
# getSuperpowerscoreorganisation() : string
# getSuperpowersinitrepos() : array
# getTmppath() : string
# getAddsuperpowers() : bool
# getAddownpowers() : bool
# getLocalpowersrepositorypath() : string
# getApprovedpaths() : array
}
note right of Config::__construct
Constructor
since: 3.2.0
arguments:
?Input $input = null
?JoomlaRegistry $params = null
?JoomlaRegistry $config = null
end note
note left of Config::getGiteatoken
get Gitea Access Token
since: 3.2.0
return: ?string
end note
note right of Config::getAddcustomgiteaurl
get Add Custom Gitea URL
since: 3.2.0
return: int
end note
note left of Config::getCustomgiteaurl
get Custom Gitea URL
since: 3.2.0
return: ?string
end note
note right of Config::getCustomgiteatoken
get Custom Gitea Access Token
since: 3.2.0
return: ?string
end note
note left of Config::getSuperpowerscoreorganisation
Get super power core organisation
since: 3.2.0
return: string
end note
note right of Config::getSuperpowersinitrepos
Get super power init repos
since: 3.2.0
return: array
end note
note left of Config::getTmppath
get temporary path
since: 3.2.0
return: string
end note
note right of Config::getAddsuperpowers
Get switch to add super powers
since: 3.2.0
return: bool
end note
note left of Config::getAddownpowers
Get switch to add own super powers
since: 3.2.0
return: bool
end note
note right of Config::getLocalpowersrepositorypath
Get local super powers repository path
since: 3.2.0
return: string
end note
note left of Config::getApprovedpaths
Get super power approved paths
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,266 @@
<?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\JoomlaPower;
use Joomla\Registry\Registry as JoomlaRegistry;
use Joomla\CMS\Factory as JoomlaFactory;
use VDM\Joomla\Utilities\GetHelper;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Componentbuilder\Abstraction\BaseConfig;
/**
* Compiler Configurations
*
* All these functions are accessed via the direct name without the get:
* example: $this->component_code_name calls: $this->getComponentcodename()
*
* All values once called are cached, yet can be updated directly:
* example: $this->component_code_name = 'new_code_name'; // be warned!
*
* @since 3.2.0
*/
class Config extends BaseConfig
{
/**
* The Global Joomla Configuration
*
* @var JoomlaRegistry
* @since 3.2.0
*/
protected JoomlaRegistry $config;
/**
* Constructor
*
* @param Input|null $input Input
* @param Registry|null $params The component parameters
* @param Registry|null $config The Joomla configuration
*
* @throws \Exception
* @since 3.2.0
*/
public function __construct(?Input $input = null, ?JoomlaRegistry $params = null, ?JoomlaRegistry $config = null)
{
parent::__construct($input, $params);
$this->config = $config ?: JoomlaFactory::getConfig();
}
/**
* get Gitea Access Token
*
* @return string the access token
* @since 3.2.0
*/
protected function getGiteatoken(): ?string
{
return $this->custom_gitea_token ?? $this->params->get('gitea_token');
}
/**
* get Add Custom Gitea URL
*
* @return int the add switch
* @since 3.2.0
*/
protected function getAddcustomgiteaurl(): int
{
return $this->params->get('add_custom_gitea_url', 1);
}
/**
* get Custom Gitea URL
*
* @return string the custom gitea url
* @since 3.2.0
*/
protected function getCustomgiteaurl(): ?string
{
if ($this->add_custom_gitea_url == 2)
{
return $this->params->get('custom_gitea_url');
}
return null;
}
/**
* get Custom Gitea Access Token
*
* @return string the custom access token
* @since 3.2.0
*/
protected function getCustomgiteatoken(): ?string
{
if ($this->add_custom_gitea_url == 2)
{
return $this->params->get('custom_gitea_token');
}
return null;
}
/**
* Get super power core organisation
*
* @return string The super power core organisation
* @since 3.2.0
*/
protected function getSuperpowerscoreorganisation(): string
{
// the VDM default organisation is [joomla]
$organisation = 'joomla';
if ($this->add_custom_gitea_url == 2)
{
return $this->params->get('super_powers_core_organisation', $organisation);
}
return $organisation;
}
/**
* Get super power init repos
*
* @return array The init repositories on Gitea
* @since 3.2.0
*/
protected function getSuperpowersinitrepos(): array
{
// some defaults repos we need by JCB
$repos = [];
// only add custom init with custom gitea
$paths = null;
if ($this->add_custom_gitea_url == 2)
{
$paths = $this->params->get('super_powers_init_repos');
}
if (!empty($paths) && is_array($paths))
{
foreach ($paths as $path)
{
$owner = $path->owner ?? null;
$repo = $path->repo ?? null;
if ($owner !== null && $repo !== null)
{
// we make sure to get only the objects
$repos = ["{$owner}.{$repo}" => $path] + $repos;
}
}
}
else
{
$repos[$this->super_powers_core_organisation . '.super-powers'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'super-powers', 'branch' => 'master'];
$repos[$this->super_powers_core_organisation . '.gitea'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'gitea', 'branch' => 'master'];
$repos[$this->super_powers_core_organisation . '.openai'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'openai', 'branch' => 'master'];
}
return $repos;
}
/**
* get temporary path
*
* @return string The temporary path
* @since 3.2.0
*/
protected function getTmppath(): string
{
// get the temporary path
return $this->config->get('tmp_path');
}
/**
* Get switch to add super powers
*
* @return bool Switch to add super powers
* @since 3.2.0
*/
protected function getAddsuperpowers(): bool
{
return (bool) $this->params->get('powers_repository', 0);
}
/**
* Get switch to add own super powers
*
* @return bool Switch to add own super powers
* @since 3.2.0
*/
protected function getAddownpowers(): bool
{
if ($this->add_super_powers)
{
return (bool) $this->params->get('super_powers_repositories', 0);
}
return false;
}
/**
* Get local super powers repository path
*
* @return string The path to the local repository
* @since 3.2.0
*/
protected function getLocalpowersrepositorypath(): string
{
$default = $this->tmp_path . '/super_powers';
if (!$this->add_super_powers)
{
return $default;
}
return $this->params->get('local_powers_repository_path', $default);
}
/**
* Get super power approved paths
*
* @return array The approved paths to the repositories on Gitea
* @since 3.2.0
*/
protected function getApprovedpaths(): array
{
// some defaults repos we need by JCB
$approved = $this->super_powers_init_repos;
if (!$this->add_own_powers)
{
return array_values($approved);
}
$paths = $this->params->get('approved_paths');
if (!empty($paths))
{
foreach ($paths as $path)
{
$owner = $path->owner ?? null;
$repo = $path->repo ?? null;
if ($owner !== null && $repo !== null)
{
// we make sure to get only the objects
$approved = ["{$owner}.{$repo}" => $path] + $approved;
}
}
}
return array_values($approved);
}
}

View File

@ -0,0 +1,230 @@
/**
* The Global Joomla Configuration
*
* @var JoomlaRegistry
* @since 3.2.0
*/
protected JoomlaRegistry $config;
/**
* Constructor
*
* @param Input|null $input Input
* @param Registry|null $params The component parameters
* @param Registry|null $config The Joomla configuration
*
* @throws \Exception
* @since 3.2.0
*/
public function __construct(?Input $input = null, ?JoomlaRegistry $params = null, ?JoomlaRegistry $config = null)
{
parent::__construct($input, $params);
$this->config = $config ?: JoomlaFactory::getConfig();
}
/**
* get Gitea Access Token
*
* @return string the access token
* @since 3.2.0
*/
protected function getGiteatoken(): ?string
{
return $this->custom_gitea_token ?? $this->params->get('gitea_token');
}
/**
* get Add Custom Gitea URL
*
* @return int the add switch
* @since 3.2.0
*/
protected function getAddcustomgiteaurl(): int
{
return $this->params->get('add_custom_gitea_url', 1);
}
/**
* get Custom Gitea URL
*
* @return string the custom gitea url
* @since 3.2.0
*/
protected function getCustomgiteaurl(): ?string
{
if ($this->add_custom_gitea_url == 2)
{
return $this->params->get('custom_gitea_url');
}
return null;
}
/**
* get Custom Gitea Access Token
*
* @return string the custom access token
* @since 3.2.0
*/
protected function getCustomgiteatoken(): ?string
{
if ($this->add_custom_gitea_url == 2)
{
return $this->params->get('custom_gitea_token');
}
return null;
}
/**
* Get super power core organisation
*
* @return string The super power core organisation
* @since 3.2.0
*/
protected function getSuperpowerscoreorganisation(): string
{
// the VDM default organisation is [joomla]
$organisation = 'joomla';
if ($this->add_custom_gitea_url == 2)
{
return $this->params->get('super_powers_core_organisation', $organisation);
}
return $organisation;
}
/**
* Get super power init repos
*
* @return array The init repositories on Gitea
* @since 3.2.0
*/
protected function getSuperpowersinitrepos(): array
{
// some defaults repos we need by JCB
$repos = [];
// only add custom init with custom gitea
$paths = null;
if ($this->add_custom_gitea_url == 2)
{
$paths = $this->params->get('super_powers_init_repos');
}
if (!empty($paths) && is_array($paths))
{
foreach ($paths as $path)
{
$owner = $path->owner ?? null;
$repo = $path->repo ?? null;
if ($owner !== null && $repo !== null)
{
// we make sure to get only the objects
$repos = ["{$owner}.{$repo}" => $path] + $repos;
}
}
}
else
{
$repos[$this->super_powers_core_organisation . '.super-powers'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'super-powers', 'branch' => 'master'];
$repos[$this->super_powers_core_organisation . '.gitea'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'gitea', 'branch' => 'master'];
$repos[$this->super_powers_core_organisation . '.openai'] = (object) ['owner' => $this->super_powers_core_organisation, 'repo' => 'openai', 'branch' => 'master'];
}
return $repos;
}
/**
* get temporary path
*
* @return string The temporary path
* @since 3.2.0
*/
protected function getTmppath(): string
{
// get the temporary path
return $this->config->get('tmp_path');
}
/**
* Get switch to add super powers
*
* @return bool Switch to add super powers
* @since 3.2.0
*/
protected function getAddsuperpowers(): bool
{
return (bool) $this->params->get('powers_repository', 0);
}
/**
* Get switch to add own super powers
*
* @return bool Switch to add own super powers
* @since 3.2.0
*/
protected function getAddownpowers(): bool
{
if ($this->add_super_powers)
{
return (bool) $this->params->get('super_powers_repositories', 0);
}
return false;
}
/**
* Get local super powers repository path
*
* @return string The path to the local repository
* @since 3.2.0
*/
protected function getLocalpowersrepositorypath(): string
{
$default = $this->tmp_path . '/super_powers';
if (!$this->add_super_powers)
{
return $default;
}
return $this->params->get('local_powers_repository_path', $default);
}
/**
* Get super power approved paths
*
* @return array The approved paths to the repositories on Gitea
* @since 3.2.0
*/
protected function getApprovedpaths(): array
{
// some defaults repos we need by JCB
$approved = $this->super_powers_init_repos;
if (!$this->add_own_powers)
{
return array_values($approved);
}
$paths = $this->params->get('approved_paths');
if (!empty($paths))
{
foreach ($paths as $path)
{
$owner = $path->owner ?? null;
$repo = $path->repo ?? null;
if ($owner !== null && $repo !== null)
{
// we make sure to get only the objects
$approved = ["{$owner}.{$repo}" => $path] + $approved;
}
}
}
return array_values($approved);
}

View File

@ -0,0 +1,27 @@
{
"add_head": "1",
"add_licensing_template": "2",
"extends": "9769f3b2-17bf-4f20-b54b-3a4ebe572b36",
"guid": "0b821bba-7503-4448-90e7-f3c1bd51dfd6",
"implements": null,
"load_selection": null,
"name": "Config",
"power_version": "1.0.0",
"system_name": "JCB.JoomlaPower.Config",
"type": "class",
"use_selection": {
"use_selection0": {
"use": "db87c339-5bb6-4291-a7ef-2c48ea1b06bc",
"as": "default"
},
"use_selection1": {
"use": "1f28cb53-60d9-4db1-b517-3c7dc6b429ef",
"as": "default"
}
},
"namespace": "VDM\\Joomla\\Componentbuilder.JoomlaPower.Config",
"description": "Compiler Configurations\r\n\r\n\tAll these functions are accessed via the direct name without the get:\r\n\texample: $this->component_code_name calls: $this->getComponentcodename()\r\n\r\n\tAll values once called are cached, yet can be updated directly:\r\n\texample: $this->component_code_name = 'new_code_name'; \/\/ be warned!\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": "use Joomla\\Registry\\Registry as JoomlaRegistry;\r\nuse Joomla\\CMS\\Factory as JoomlaFactory;",
"composer": ""
}

View File

@ -8,7 +8,7 @@
```
# final class Grep (Details)
> namespace: **VDM\Joomla\Componentbuilder\JoomlaPower**
> extends: **Grep**
> extends: **ExtendingGrep**
```uml
@startuml
class Grep << (F,LightGreen) >> #RoyalBlue {

View File

@ -15,7 +15,7 @@ namespace VDM\Joomla\Componentbuilder\JoomlaPower;
use VDM\Joomla\Utilities\FileHelper;
use VDM\Joomla\Utilities\JsonHelper;
use VDM\Joomla\Componentbuilder\Interfaces\GrepInterface;
use VDM\Joomla\Componentbuilder\Power\Grep;
use VDM\Joomla\Componentbuilder\Power\Grep as ExtendingGrep;
/**
@ -28,7 +28,7 @@ use VDM\Joomla\Componentbuilder\Power\Grep;
*
* @since 3.2.1
*/
final class Grep extends Grep implements GrepInterface
final class Grep extends ExtendingGrep implements GrepInterface
{
/**
* Get a local power

View File

@ -0,0 +1,77 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# class JoomlaPower (Details)
> namespace: **VDM\Joomla\Componentbuilder\JoomlaPower\Service**
```uml
@startuml
class JoomlaPower #Gold {
+ register(Container $container) : void
+ getConfig(Container $container) : Config
+ getTable(Container $container) : Table
+ getGrep(Container $container) : Grep
+ getSuperpower(Container $container) : Superpower
+ getParser(Container $container) : Parser
}
note right of JoomlaPower::register
Registers the service provider with a DI container.
since: 3.2.0
return: void
end note
note right of JoomlaPower::getConfig
Get The Config Class.
since: 3.2.0
return: Config
end note
note right of JoomlaPower::getTable
Get The Table Class.
since: 3.2.0
return: Table
end note
note right of JoomlaPower::getGrep
Get The Grep Class.
since: 3.2.0
return: Grep
end note
note right of JoomlaPower::getSuperpower
Get The Super Class.
since: 3.2.0
return: Superpower
end note
note right of JoomlaPower::getParser
Get The Parser Class.
since: 3.2.0
return: Parser
end note
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,130 @@
<?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\JoomlaPower\Service;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use VDM\Joomla\Componentbuilder\JoomlaPower\Config;
use VDM\Joomla\Componentbuilder\Table;
use VDM\Joomla\Componentbuilder\JoomlaPower\Grep;
use VDM\Joomla\Componentbuilder\JoomlaPower\Super as Superpower;
use VDM\Joomla\Componentbuilder\Compiler\Power\Parser;
/**
* Joomla Power Service Provider
*
* @since 3.2.1
*/
class JoomlaPower 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(Config::class, 'Config')
->share('Config', [$this, 'getConfig'], true);
$container->alias(Table::class, 'Table')
->share('Table', [$this, 'getTable'], true);
$container->alias(Grep::class, 'Joomla.Power.Grep')
->share('Joomla.Power.Grep', [$this, 'getGrep'], true);
$container->alias(Superpower::class, 'Joomlapower')
->share('Joomlapower', [$this, 'getSuperpower'], true);
$container->alias(Parser::class, 'Power.Parser')
->share('Power.Parser', [$this, 'getParser'], true);
}
/**
* Get The Config Class.
*
* @param Container $container The DI container.
*
* @return Config
* @since 3.2.0
*/
public function getConfig(Container $container): Config
{
return new Config();
}
/**
* Get The Table Class.
*
* @param Container $container The DI container.
*
* @return Table
* @since 3.2.0
*/
public function getTable(Container $container): Table
{
return new Table();
}
/**
* Get The Grep Class.
*
* @param Container $container The DI container.
*
* @return Grep
* @since 3.2.0
*/
public function getGrep(Container $container): Grep
{
return new Grep(
$container->get('Config')->local_powers_repository_path,
$container->get('Config')->approved_paths,
$container->get('Gitea.Repository.Contents')
);
}
/**
* Get The Super Class.
*
* @param Container $container The DI container.
*
* @return Superpower
* @since 3.2.0
*/
public function getSuperpower(Container $container): Superpower
{
return new Superpower(
$container->get('Joomla.Power.Grep'),
$container->get('Joomla.Power.Database.Insert'),
$container->get('Joomla.Power.Database.Update')
);
}
/**
* Get The Parser Class.
*
* @param Container $container The DI container.
*
* @return Parser
* @since 3.2.0
*/
public function getParser(Container $container): Parser
{
return new Parser();
}
}

View File

@ -0,0 +1,98 @@
/**
* 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(Config::class, 'Config')
->share('Config', [$this, 'getConfig'], true);
$container->alias(Table::class, 'Table')
->share('Table', [$this, 'getTable'], true);
$container->alias(Grep::class, 'Joomla.Power.Grep')
->share('Joomla.Power.Grep', [$this, 'getGrep'], true);
$container->alias(Superpower::class, 'Joomlapower')
->share('Joomlapower', [$this, 'getSuperpower'], true);
$container->alias(Parser::class, 'Power.Parser')
->share('Power.Parser', [$this, 'getParser'], true);
}
/**
* Get The Config Class.
*
* @param Container $container The DI container.
*
* @return Config
* @since 3.2.0
*/
public function getConfig(Container $container): Config
{
return new Config();
}
/**
* Get The Table Class.
*
* @param Container $container The DI container.
*
* @return Table
* @since 3.2.0
*/
public function getTable(Container $container): Table
{
return new Table();
}
/**
* Get The Grep Class.
*
* @param Container $container The DI container.
*
* @return Grep
* @since 3.2.0
*/
public function getGrep(Container $container): Grep
{
return new Grep(
$container->get('Config')->local_powers_repository_path,
$container->get('Config')->approved_paths,
$container->get('Gitea.Repository.Contents')
);
}
/**
* Get The Super Class.
*
* @param Container $container The DI container.
*
* @return Superpower
* @since 3.2.0
*/
public function getSuperpower(Container $container): Superpower
{
return new Superpower(
$container->get('Joomla.Power.Grep'),
$container->get('Joomla.Power.Database.Insert'),
$container->get('Joomla.Power.Database.Update')
);
}
/**
* Get The Parser Class.
*
* @param Container $container The DI container.
*
* @return Parser
* @since 3.2.0
*/
public function getParser(Container $container): Parser
{
return new Parser();
}

View File

@ -0,0 +1,42 @@
{
"add_head": "1",
"add_licensing_template": "2",
"extends": "0",
"guid": "38e1ca3e-1908-459a-be87-9f83b292058f",
"implements": [
"-1"
],
"load_selection": null,
"name": "JoomlaPower",
"power_version": "1.0.0",
"system_name": "JCB.JoomlaPower.Service.JoomlaPower",
"type": "class",
"use_selection": {
"use_selection0": {
"use": "0b821bba-7503-4448-90e7-f3c1bd51dfd6",
"as": "default"
},
"use_selection1": {
"use": "bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8",
"as": "default"
},
"use_selection2": {
"use": "355bf21a-f859-4528-9110-bcd2c6d05ea7",
"as": "default"
},
"use_selection3": {
"use": "39a75870-a7f7-45fd-937d-5ba97b85b8ad",
"as": "Superpower"
},
"use_selection4": {
"use": "95d0e03f-24fd-4412-bc2e-f0899fcc3205",
"as": "default"
}
},
"namespace": "VDM\\Joomla\\Componentbuilder.JoomlaPower.Service.JoomlaPower",
"description": "Joomla Power Service Provider\r\n\r\n@since 3.2.1",
"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

@ -8,7 +8,7 @@
```
# final class Super (Details)
> namespace: **VDM\Joomla\Componentbuilder\JoomlaPower**
> extends: **Super**
> extends: **ExtendingSuper**
```uml
@startuml
class Super << (F,LightGreen) >> #RoyalBlue {

View File

@ -13,7 +13,7 @@ namespace VDM\Joomla\Componentbuilder\JoomlaPower;
use VDM\Joomla\Componentbuilder\Interfaces\SuperInterface;
use VDM\Joomla\Componentbuilder\Power\Super;
use VDM\Joomla\Componentbuilder\Power\Super as ExtendingSuper;
/**
@ -21,7 +21,7 @@ use VDM\Joomla\Componentbuilder\Power\Super;
*
* @since 3.2.0
*/
final class Super extends Super implements SuperInterface
final class Super extends ExtendingSuper implements SuperInterface
{
/**
* Table Name

View File

@ -44,26 +44,26 @@ class JoomlaPower implements ServiceProviderInterface
$container->alias(Powers::class, 'Joomla.Power')
->share('Joomla.Power', [$this, 'getPowers'], true);
$container->alias(Superpower::class, 'Joomla.Superpower')
->share('Joomla.Superpower', [$this, 'getSuperpower'], true);
$container->alias(Superpower::class, 'Joomlapower')
->share('Joomlapower', [$this, 'getSuperpower'], true);
$container->alias(Grep::class, 'Joomla.Power.Grep')
->share('Joomla.Power.Grep', [$this, 'getGrep'], true);
$container->alias(Extractor::class, 'Joomla.Power.Extractor')
->share('Power.Extractor', [$this, 'getExtractor'], true);
->share('Joomla.Power.Extractor', [$this, 'getExtractor'], true);
$container->alias(Injector::class, 'Joomla.Power.Injector')
->share('Power.Injector', [$this, 'getInjector'], true);
->share('Joomla.Power.Injector', [$this, 'getInjector'], true);
$container->alias(Upsert::class, 'Joomla.Power.Model.Upsert')
->share('Power.Model.Upsert', [$this, 'getModelUpsert'], true);
->share('Joomla.Power.Model.Upsert', [$this, 'getModelUpsert'], true);
$container->alias(Insert::class, 'Joomla.Power.Insert')
->share('Power.Insert', [$this, 'getInsert'], true);
->share('Joomla.Power.Insert', [$this, 'getInsert'], true);
$container->alias(Update::class, 'Joomla.Power.Update')
->share('Power.Update', [$this, 'getUpdate'], true);
->share('Joomla.Power.Update', [$this, 'getUpdate'], true);
}
/**

View File

@ -11,26 +11,26 @@
$container->alias(Powers::class, 'Joomla.Power')
->share('Joomla.Power', [$this, 'getPowers'], true);
$container->alias(Superpower::class, 'Joomla.Superpower')
->share('Joomla.Superpower', [$this, 'getSuperpower'], true);
$container->alias(Superpower::class, 'Joomlapower')
->share('Joomlapower', [$this, 'getSuperpower'], true);
$container->alias(Grep::class, 'Joomla.Power.Grep')
->share('Joomla.Power.Grep', [$this, 'getGrep'], true);
$container->alias(Extractor::class, 'Joomla.Power.Extractor')
->share('Power.Extractor', [$this, 'getExtractor'], true);
->share('Joomla.Power.Extractor', [$this, 'getExtractor'], true);
$container->alias(Injector::class, 'Joomla.Power.Injector')
->share('Power.Injector', [$this, 'getInjector'], true);
->share('Joomla.Power.Injector', [$this, 'getInjector'], true);
$container->alias(Upsert::class, 'Joomla.Power.Model.Upsert')
->share('Power.Model.Upsert', [$this, 'getModelUpsert'], true);
->share('Joomla.Power.Model.Upsert', [$this, 'getModelUpsert'], true);
$container->alias(Insert::class, 'Joomla.Power.Insert')
->share('Power.Insert', [$this, 'getInsert'], true);
->share('Joomla.Power.Insert', [$this, 'getInsert'], true);
$container->alias(Update::class, 'Joomla.Power.Update')
->share('Power.Update', [$this, 'getUpdate'], true);
->share('Joomla.Power.Update', [$this, 'getUpdate'], true);
}
/**

View File

@ -8,7 +8,7 @@
```
# final class Update (Details)
> namespace: **VDM\Joomla\Componentbuilder\JoomlaPower\Database**
> extends: **Update**
> extends: **ExtendingUpdate**
```uml
@startuml
class Update << (F,LightGreen) >> #RoyalBlue {

View File

@ -13,7 +13,7 @@ namespace VDM\Joomla\Componentbuilder\JoomlaPower\Database;
use VDM\Joomla\Componentbuilder\Interfaces\Database\UpdateInterface;
use VDM\Joomla\Componentbuilder\Power\Database\Update;
use VDM\Joomla\Componentbuilder\Power\Database\Update as ExtendingUpdate;
/**
@ -21,7 +21,7 @@ use VDM\Joomla\Componentbuilder\Power\Database\Update;
*
* @since 3.2.0
*/
final class Update extends Update implements UpdateInterface
final class Update extends ExtendingUpdate implements UpdateInterface
{
/**
* Table Name

View File

@ -13,7 +13,7 @@ namespace VDM\Joomla\Componentbuilder\JoomlaPower;
use Joomla\DI\Container;
use VDM\Joomla\Componentbuilder\Compiler\Service\JoomlaPower as Power;
use VDM\Joomla\Componentbuilder\JoomlaPower\Service\JoomlaPower as Power;
use VDM\Joomla\Componentbuilder\Service\Database;
use VDM\Joomla\Componentbuilder\JoomlaPower\Service\Database as PowerDatabase;
use VDM\Joomla\Componentbuilder\Service\Gitea;

View File

@ -13,7 +13,7 @@
"type": "abstract class",
"use_selection": {
"use_selection0": {
"use": "5716c79f-a1c9-4059-9d00-8cccb9f9e061",
"use": "38e1ca3e-1908-459a-be87-9f83b292058f",
"as": "Power"
},
"use_selection1": {

View File

@ -8,7 +8,7 @@
```
# final class Extractor (Details)
> namespace: **VDM\Joomla\Componentbuilder\Compiler\JoomlaPower**
> extends: **Extractor**
> extends: **ExtendingExtractor**
```uml
@startuml
class Extractor << (F,LightGreen) >> #RoyalBlue {

View File

@ -13,14 +13,14 @@ namespace VDM\Joomla\Componentbuilder\Compiler\JoomlaPower;
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Power\ExtractorInterface;
use VDM\Joomla\Componentbuilder\Compiler\Power\Extractor;
use VDM\Joomla\Componentbuilder\Compiler\Power\Extractor as ExtendingExtractor;
/**
* Compiler Joomla Power Extractor
* @since 3.2.1
*/
final class Extractor extends Extractor implements ExtractorInterface
final class Extractor extends ExtendingExtractor implements ExtractorInterface
{
/**
* The pattern to get the powers

View File

@ -8,7 +8,7 @@
```
# final class Upsert (Details)
> namespace: **VDM\Joomla\Componentbuilder\JoomlaPower\Model**
> extends: **Upsert**
> extends: **ExtendingUpsert**
```uml
@startuml
class Upsert << (F,LightGreen) >> #RoyalBlue {

View File

@ -13,7 +13,7 @@ namespace VDM\Joomla\Componentbuilder\JoomlaPower\Model;
use VDM\Joomla\Interfaces\ModelInterface;
use VDM\Joomla\Componentbuilder\Power\Model\Upsert;
use VDM\Joomla\Componentbuilder\Power\Model\Upsert as ExtendingUpsert;
/**
@ -21,7 +21,7 @@ use VDM\Joomla\Componentbuilder\Power\Model\Upsert;
*
* @since 3.2.0
*/
final class Upsert extends Upsert implements ModelInterface
final class Upsert extends ExtendingUpsert implements ModelInterface
{
/**
* Get the current active table

View File

@ -8,7 +8,7 @@
```
# final class Insert (Details)
> namespace: **VDM\Joomla\Componentbuilder\JoomlaPower\Database**
> extends: **Insert**
> extends: **ExtendingInsert**
```uml
@startuml
class Insert << (F,LightGreen) >> #RoyalBlue {

View File

@ -13,7 +13,7 @@ namespace VDM\Joomla\Componentbuilder\JoomlaPower\Database;
use VDM\Joomla\Componentbuilder\Interfaces\Database\InsertInterface;
use VDM\Joomla\Componentbuilder\Power\Database\Insert;
use VDM\Joomla\Componentbuilder\Power\Database\Insert as ExtendingInsert;
/**
@ -21,7 +21,7 @@ use VDM\Joomla\Componentbuilder\Power\Database\Insert;
*
* @since 3.2.1
*/
final class Insert extends Insert implements InsertInterface
final class Insert extends ExtendingInsert implements InsertInterface
{
/**
* Table Name

View File

@ -8,7 +8,7 @@
```
# final class Injector (Details)
> namespace: **VDM\Joomla\Componentbuilder\Compiler\JoomlaPower**
> extends: **Injector**
> extends: **ExtendingInjector**
```uml
@startuml
class Injector << (F,LightGreen) >> #RoyalBlue {

View File

@ -13,14 +13,14 @@ namespace VDM\Joomla\Componentbuilder\Compiler\JoomlaPower;
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Power\InjectorInterface;
use VDM\Joomla\Componentbuilder\Compiler\Power\Injector;
use VDM\Joomla\Componentbuilder\Compiler\Power\Injector as ExtendingInjector;
/**
* Compiler Joomla Power Injector
* @since 3.2.0
*/
final class Injector extends Injector implements InjectorInterface
final class Injector extends ExtendingInjector implements InjectorInterface
{
/**
* Update the code

View File

@ -8,7 +8,7 @@
```
# final class Load (Details)
> namespace: **VDM\Joomla\Componentbuilder\JoomlaPower\Database**
> extends: **Load**
> extends: **ExtendingLoad**
```uml
@startuml
class Load << (F,LightGreen) >> #RoyalBlue {

View File

@ -13,7 +13,7 @@ namespace VDM\Joomla\Componentbuilder\JoomlaPower\Database;
use VDM\Joomla\Componentbuilder\Power\Database\LoadInterface;
use VDM\Joomla\Componentbuilder\Power\Database\Load;
use VDM\Joomla\Componentbuilder\Power\Database\Load as ExtendingLoad;
/**
@ -21,7 +21,7 @@ use VDM\Joomla\Componentbuilder\Power\Database\Load;
*
* @since 2.0.1
*/
final class Load extends Load implements LoadInterface
final class Load extends ExtendingLoad implements LoadInterface
{
/**
* Table Name

View File

@ -37,7 +37,7 @@ class Power #Gold {
- setLoadSelection(string $guid) : void
- setComposer(string $guid) : void
- setImplements(string $guid, array $use) : void
- setExtend(string $guid, array $use) : void
- setExtend(string $guid, array $use, ...) : void
- setUseAs(string $guid, array $use, ...) : void
- getCleanNamespace(string $namespace) : string
- getUseNamespace(string $namespace, string $as = 'default') : string
@ -148,6 +148,11 @@ note right of Power::setExtend
since: 3.2.0
return: void
arguments:
string $guid
array $use
array $as
end note
note left of Power::setUseAs

View File

@ -303,7 +303,7 @@ class Power implements PowerInterface
$this->setImplements($guid, $use);
// set extend class
$this->setExtend($guid, $use);
$this->setExtend($guid, $use, $as);
// set GUI mapper
$guiMapper = [
@ -760,11 +760,12 @@ class Power implements PowerInterface
*
* @param string $guid The global unique id of the power
* @param array $use The use array
* @param array $as The use as array
*
* @return void
* @since 3.2.0
*/
private function setExtend(string $guid, array &$use)
private function setExtend(string $guid, array &$use, array &$as)
{
// does this extend something
$this->active[$guid]->extends_name = null;
@ -793,6 +794,13 @@ class Power implements PowerInterface
$this->active[$guid]->extends_name = $this->get($this->active[$guid]->extends, 1)->class_name;
// add to use
$use[] = $this->active[$guid]->extends;
// add padding if the two names are the same
if ($this->active[$guid]->extends_name === $this->active[$guid]->class_name)
{
$this->active[$guid]->extends_name = $as[$this->active[$guid]->extends]
= 'Extending' . $this->active[$guid]->extends_name;
}
}
}
}

View File

@ -264,7 +264,7 @@
$this->setImplements($guid, $use);
// set extend class
$this->setExtend($guid, $use);
$this->setExtend($guid, $use, $as);
// set GUI mapper
$guiMapper = [
@ -721,11 +721,12 @@
*
* @param string $guid The global unique id of the power
* @param array $use The use array
* @param array $as The use as array
*
* @return void
* @since 3.2.0
*/
private function setExtend(string $guid, array &$use)
private function setExtend(string $guid, array &$use, array &$as)
{
// does this extend something
$this->active[$guid]->extends_name = null;
@ -754,6 +755,13 @@
$this->active[$guid]->extends_name = $this->get($this->active[$guid]->extends, 1)->class_name;
// add to use
$use[] = $this->active[$guid]->extends;
// add padding if the two names are the same
if ($this->active[$guid]->extends_name === $this->active[$guid]->class_name)
{
$this->active[$guid]->extends_name = $as[$this->active[$guid]->extends]
= 'Extending' . $this->active[$guid]->extends_name;
}
}
}
}

View File

@ -147,7 +147,7 @@ class Extractor implements ExtractorInterface
* @return void
* @since 3.2.0
*/
public function search(string $code)
public function search(string $code): void
{
$matches = [];
preg_match_all($this->pattern, $code, $matches);

View File

@ -122,7 +122,7 @@
* @return void
* @since 3.2.0
*/
public function search(string $code)
public function search(string $code): void
{
$matches = [];
preg_match_all($this->pattern, $code, $matches);

View File

@ -164,6 +164,17 @@
"spk": "Super__0b45357f_b077_4337_92f3_65c1e19d36cd__Power",
"guid": "0b45357f-b077-4337-92f3-65c1e19d36cd"
},
"0b821bba-7503-4448-90e7-f3c1bd51dfd6": {
"name": "Config",
"type": "class",
"namespace": "VDM\\Joomla\\Componentbuilder\\JoomlaPower",
"code": "src\/0b821bba-7503-4448-90e7-f3c1bd51dfd6\/code.php",
"power": "src\/0b821bba-7503-4448-90e7-f3c1bd51dfd6\/code.power",
"settings": "src\/0b821bba-7503-4448-90e7-f3c1bd51dfd6\/settings.json",
"path": "src\/0b821bba-7503-4448-90e7-f3c1bd51dfd6",
"spk": "Super__0b821bba_7503_4448_90e7_f3c1bd51dfd6__Power",
"guid": "0b821bba-7503-4448-90e7-f3c1bd51dfd6"
},
"0d08c583-04d5-454e-b756-48ca05e1651a": {
"name": "Readme",
"type": "class",
@ -978,6 +989,17 @@
"spk": "Super__380bb7a3_cdcc_4336_a699_5070cbf521a5__Power",
"guid": "380bb7a3-cdcc-4336-a699-5070cbf521a5"
},
"38e1ca3e-1908-459a-be87-9f83b292058f": {
"name": "JoomlaPower",
"type": "class",
"namespace": "VDM\\Joomla\\Componentbuilder\\JoomlaPower\\Service",
"code": "src\/38e1ca3e-1908-459a-be87-9f83b292058f\/code.php",
"power": "src\/38e1ca3e-1908-459a-be87-9f83b292058f\/code.power",
"settings": "src\/38e1ca3e-1908-459a-be87-9f83b292058f\/settings.json",
"path": "src\/38e1ca3e-1908-459a-be87-9f83b292058f",
"spk": "Super__38e1ca3e_1908_459a_be87_9f83b292058f__Power",
"guid": "38e1ca3e-1908-459a-be87-9f83b292058f"
},
"396f9883-4e50-4b65-a1d5-05bd6c23df30": {
"name": "AccessSectionsJoomlaFields",
"type": "final class",