Update 2024-12-16 18:27:10

This commit is contained in:
Robot 2024-12-16 18:27:29 +02:00
parent 293e6f9979
commit 3adb5fab05
Signed by: Robot
GPG Key ID: 14DECD44E7E1BB95
124 changed files with 4522 additions and 324 deletions

View File

@ -25,7 +25,10 @@ This repository contains an index (see below) of all the approved powers within
- **Namespace**: [VDM\Joomla\Componentbuilder\Abstraction](#vdm-joomla-componentbuilder-abstraction)
- **abstract class BaseConfig** | [Details](src/9769f3b2-17bf-4f20-b54b-3a4ebe572b36) | [Code](src/9769f3b2-17bf-4f20-b54b-3a4ebe572b36/code.php) | [Settings](src/9769f3b2-17bf-4f20-b54b-3a4ebe572b36/settings.json) | SPK: `Super---9769f3b2_17bf_4f20_b54b_3a4ebe572b36---Power`
- **abstract class Api** | [Details](src/85e0b652-21b9-4ff7-ba27-dbd72256f0f2) | [Code](src/85e0b652-21b9-4ff7-ba27-dbd72256f0f2/code.php) | [Settings](src/85e0b652-21b9-4ff7-ba27-dbd72256f0f2/settings.json) | SPK: `Super---85e0b652_21b9_4ff7_ba27_dbd72256f0f2---Power`
- **Namespace**: [VDM\Joomla\Componentbuilder\Api](#vdm-joomla-componentbuilder-api)
- **final class Network** | [Details](src/07ca003e-368c-451d-a3d3-ba24e50c7287) | [Code](src/07ca003e-368c-451d-a3d3-ba24e50c7287/code.php) | [Settings](src/07ca003e-368c-451d-a3d3-ba24e50c7287/settings.json) | SPK: `Super---07ca003e_368c_451d_a3d3_ba24e50c7287---Power`
- **Namespace**: [VDM\Joomla\Componentbuilder\Compiler](#vdm-joomla-componentbuilder-compiler)
- **abstract class Factory** | [Details](src/d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac) | [Code](src/d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac/code.php) | [Settings](src/d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac/settings.json) | SPK: `Super---d910d8b8_4c23_4f3e_8cda_438f2d2bd7ac---Power`
@ -52,6 +55,13 @@ 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) | SPK: `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) | SPK: `Super---355bf21a_f859_4528_9110_bcd2c6d05ea7---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) | SPK: `Super---0b821bba_7503_4448_90e7_f3c1bd51dfd6---Power`
- **Namespace**: [VDM\Joomla\Componentbuilder\Network](#vdm-joomla-componentbuilder-network)
- **final class Core** | [Details](src/825ecce9-72ef-4257-bc32-4b05a4c226e9) | [Code](src/825ecce9-72ef-4257-bc32-4b05a4c226e9/code.php) | [Settings](src/825ecce9-72ef-4257-bc32-4b05a4c226e9/settings.json) | SPK: `Super---825ecce9_72ef_4257_bc32_4b05a4c226e9---Power`
- **final class ParsedUrls** | [Details](src/fd3b25c3-cd49-404c-ae82-b6a125863f10) | [Code](src/fd3b25c3-cd49-404c-ae82-b6a125863f10/code.php) | [Settings](src/fd3b25c3-cd49-404c-ae82-b6a125863f10/settings.json) | SPK: `Super---fd3b25c3_cd49_404c_ae82_b6a125863f10---Power`
- **final class Resolve** | [Details](src/a0c143af-3d7d-4c19-91c4-f72060b4c361) | [Code](src/a0c143af-3d7d-4c19-91c4-f72060b4c361/code.php) | [Settings](src/a0c143af-3d7d-4c19-91c4-f72060b4c361/settings.json) | SPK: `Super---a0c143af_3d7d_4c19_91c4_f72060b4c361---Power`
- **final class Status** | [Details](src/809d3077-c105-4e9c-8ac5-8fbee10cf9fc) | [Code](src/809d3077-c105-4e9c-8ac5-8fbee10cf9fc/code.php) | [Settings](src/809d3077-c105-4e9c-8ac5-8fbee10cf9fc/settings.json) | SPK: `Super---809d3077_c105_4e9c_8ac5_8fbee10cf9fc---Power`
- **final class Url** | [Details](src/286f7550-9c22-401c-9e5a-2f9426888133) | [Code](src/286f7550-9c22-401c-9e5a-2f9426888133/code.php) | [Settings](src/286f7550-9c22-401c-9e5a-2f9426888133/settings.json) | SPK: `Super---286f7550_9c22_401c_9e5a_2f9426888133---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) | SPK: `Super---a5734b9e_a72d_494c_bc72_c3bc7506015f---Power`
@ -62,11 +72,17 @@ This repository contains an index (see below) of all the approved powers within
- **class Plantuml** | [Details](src/ff5e9e63-86d0-4691-ab59-d4b9d9154096) | [Code](src/ff5e9e63-86d0-4691-ab59-d4b9d9154096/code.php) | [Settings](src/ff5e9e63-86d0-4691-ab59-d4b9d9154096/settings.json) | SPK: `Super---ff5e9e63_86d0_4691_ab59_d4b9d9154096---Power`
- **Namespace**: [VDM\Joomla\Componentbuilder\Service](#vdm-joomla-componentbuilder-service)
- **class Api** | [Details](src/3c7567d7-b079-4910-b325-7ed5c30cabff) | [Code](src/3c7567d7-b079-4910-b325-7ed5c30cabff/code.php) | [Settings](src/3c7567d7-b079-4910-b325-7ed5c30cabff/settings.json) | SPK: `Super---3c7567d7_b079_4910_b325_7ed5c30cabff---Power`
- **class CoreRules** | [Details](src/f65b52c2-593a-4c35-89d1-4a8e57a1adf0) | [Code](src/f65b52c2-593a-4c35-89d1-4a8e57a1adf0/code.php) | [Settings](src/f65b52c2-593a-4c35-89d1-4a8e57a1adf0/settings.json) | SPK: `Super---f65b52c2_593a_4c35_89d1_4a8e57a1adf0---Power`
- **class Network** | [Details](src/156f449b-ca6c-4a57-a925-be345e751614) | [Code](src/156f449b-ca6c-4a57-a925-be345e751614/code.php) | [Settings](src/156f449b-ca6c-4a57-a925-be345e751614/settings.json) | SPK: `Super---156f449b_ca6c_4a57_a925_be345e751614---Power`
- **class Utilities** | [Details](src/facd1e1c-ff2f-4520-b735-075c45aa55ed) | [Code](src/facd1e1c-ff2f-4520-b735-075c45aa55ed/code.php) | [Settings](src/facd1e1c-ff2f-4520-b735-075c45aa55ed/settings.json) | SPK: `Super---facd1e1c_ff2f_4520_b735_075c45aa55ed---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) | SPK: `Super---cddcac51_9a46_47c4_ba59_105c70453bd6---Power`
- **abstract class RepoHelper** | [Details](src/c6619b00-261c-473b-8094-d4fe9e6bab39) | [Code](src/c6619b00-261c-473b-8094-d4fe9e6bab39/code.php) | [Settings](src/c6619b00-261c-473b-8094-d4fe9e6bab39/settings.json) | SPK: `Super---c6619b00_261c_473b_8094_d4fe9e6bab39---Power`
- **final class Http** | [Details](src/d9ee00d6-eeed-4fc4-af8a-7b5547f508ba) | [Code](src/d9ee00d6-eeed-4fc4-af8a-7b5547f508ba/code.php) | [Settings](src/d9ee00d6-eeed-4fc4-af8a-7b5547f508ba/settings.json) | SPK: `Super---d9ee00d6_eeed_4fc4_af8a_7b5547f508ba---Power`
- **final class Response** | [Details](src/c99e85a0-d120-4f25-bcbf-0940dd7b773b) | [Code](src/c99e85a0-d120-4f25-bcbf-0940dd7b773b/code.php) | [Settings](src/c99e85a0-d120-4f25-bcbf-0940dd7b773b/settings.json) | SPK: `Super---c99e85a0_d120_4f25_bcbf_0940dd7b773b---Power`
- **final class Uri** | [Details](src/1c5bf656-f73a-46ec-bb9d-aa3932d5b3de) | [Code](src/1c5bf656-f73a-46ec-bb9d-aa3932d5b3de/code.php) | [Settings](src/1c5bf656-f73a-46ec-bb9d-aa3932d5b3de/settings.json) | SPK: `Super---1c5bf656_f73a_46ec_bb9d_aa3932d5b3de---Power`
- **class Constantpaths** | [Details](src/e0c8c931-52a0-4171-9909-e8769505bb1f) | [Code](src/e0c8c931-52a0-4171-9909-e8769505bb1f/code.php) | [Settings](src/e0c8c931-52a0-4171-9909-e8769505bb1f/settings.json) | SPK: `Super---e0c8c931_52a0_4171_9909_e8769505bb1f---Power`
- **Namespace**: [VDM\Joomla\Componentbuilder\Compiler\Adminview](#vdm-joomla-componentbuilder-compiler-adminview)

View File

@ -108,6 +108,7 @@ class Power implements ServiceProviderInterface
{
return new Grep(
$container->get('Gitea.Repository.Contents'),
$container->get('Network.Resolve'),
$container->get('Config')->approved_paths,
$container->get('Config')->local_powers_repository_path
);

View File

@ -74,6 +74,7 @@
{
return new Grep(
$container->get('Gitea.Repository.Contents'),
$container->get('Network.Resolve'),
$container->get('Config')->approved_paths,
$container->get('Config')->local_powers_repository_path
);

View File

@ -0,0 +1,59 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# final class Network (Details)
> namespace: **VDM\Joomla\Componentbuilder\Api**
> extends: **Api**
```uml
@startuml
class Network << (F,LightGreen) >> #RoyalBlue {
+ get(?string $target = null, ?int $status = null, ...) : ?object
}
note right of Network::get
Get the network repository statuses
since: 5.0.4
return: ?object
arguments:
?string $target = null
?int $status = null
string $project = 'jcb'
string $system = 'community'
end note
@enduml
```
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
To add this specific Power to your project in JCB:
> simply use this SPK
```
Super---07ca003e_368c_451d_a3d3_ba24e50c7287---Power
```
> remember to replace the `---` with `___` to activate this Power in your code
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,59 @@
<?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\Api;
use VDM\Joomla\Componentbuilder\Abstraction\Api;
/**
* The Joomla Component Builder Network Api
*
* @since 5.0.4
*/
final class Network extends Api
{
/**
* Get the network repository statuses
*
* @param string|null $target The target repositories.
* @param int|null $status The repository status.
* @param string $project The network project. (default: jcb)
* @param string $system The network system. (default: community)
*
* @return object|null The set of status values
* @since 5.0.4
**/
public function get(?string $target = null, ?int $status = null, string $project = 'jcb', string $system = 'community'): ?object
{
// Build the request path.
$path = "/network/{$system}/{$project}";
if (!empty($target))
{
$path .= "/{$target}";
}
if (!empty($status))
{
$path .= "/{$status}";
}
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}
}

View File

@ -0,0 +1,33 @@
/**
* Get the network repository statuses
*
* @param string|null $target The target repositories.
* @param int|null $status The repository status.
* @param string $project The network project. (default: jcb)
* @param string $system The network system. (default: community)
*
* @return object|null The set of status values
* @since 5.0.4
**/
public function get(?string $target = null, ?int $status = null, string $project = 'jcb', string $system = 'community'): ?object
{
// Build the request path.
$path = "/network/{$system}/{$project}";
if (!empty($target))
{
$path .= "/{$target}";
}
if (!empty($status))
{
$path .= "/{$status}";
}
// Send the get request.
return $this->response->get(
$this->http->get(
$this->uri->get($path)
)
);
}

View File

@ -0,0 +1,19 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "85e0b652-21b9-4ff7-ba27-dbd72256f0f2",
"guid": "07ca003e-368c-451d-a3d3-ba24e50c7287",
"implements": null,
"load_selection": null,
"name": "Network",
"power_version": "1.0.0",
"system_name": "Joomla.JCB.Api.Network",
"type": "final class",
"use_selection": null,
"extendsinterfaces": null,
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Api.Network",
"description": "The Joomla Component Builder Network Api\r\n\r\n@since 5.0.4",
"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

@ -12,7 +12,7 @@
namespace VDM\Joomla\Componentbuilder\Compiler\Builder;
use VDM\Joomla\Abstraction\Registry\Traits\ToString;
use VDM\Joomla\Abstraction\Registry\Traits\PathToString;
use VDM\Joomla\Interfaces\Registryinterface;
use VDM\Joomla\Abstraction\Registry;
@ -25,10 +25,10 @@ use VDM\Joomla\Abstraction\Registry;
final class HiddenFields extends Registry implements Registryinterface
{
/**
* To String Values
* Path To String Values
*
* @since 3.2.0
*/
use ToString;
use PathToString;
}

View File

@ -1,6 +1,6 @@
/**
* To String Values
* Path To String Values
*
* @since 3.2.0
*/
use ToString;
use PathToString;

View File

@ -8,7 +8,7 @@
```
# class Config (Details)
> namespace: **VDM\Joomla\Componentbuilder\JoomlaPower**
> extends: **BaseConfig**
> extends: **ComponentConfig**
```uml
@startuml

View File

@ -17,7 +17,7 @@ use Joomla\CMS\Factory as JoomlaFactory;
use VDM\Joomla\Utilities\GetHelper;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Componentbuilder\Utilities\RepoHelper;
use VDM\Joomla\Componentbuilder\Abstraction\BaseConfig;
use VDM\Joomla\Componentbuilder\Abstraction\ComponentConfig;
/**
@ -31,7 +31,7 @@ use VDM\Joomla\Componentbuilder\Abstraction\BaseConfig;
*
* @since 3.2.0
*/
class Config extends BaseConfig
class Config extends ComponentConfig
{
/**
* The Global Joomla Configuration

View File

@ -12,7 +12,7 @@
namespace VDM\Joomla\Componentbuilder\Compiler\Builder;
use VDM\Joomla\Abstraction\Registry\Traits\Count;
use VDM\Joomla\Abstraction\Registry\Traits\PathCount;
use VDM\Joomla\Interfaces\Registryinterface;
use VDM\Joomla\Abstraction\Registry;
@ -25,10 +25,10 @@ use VDM\Joomla\Abstraction\Registry;
final class NewPublishingFields extends Registry implements Registryinterface
{
/**
* Count Values
* Path Count Values
*
* @since 3.2.0
*/
use Count;
use PathCount;
}

View File

@ -1,6 +1,6 @@
/**
* Count Values
* Path Count Values
*
* @since 3.2.0
*/
use Count;
use PathCount;

View File

@ -0,0 +1,92 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# class Network (Details)
> namespace: **VDM\Joomla\Componentbuilder\Service**
```uml
@startuml
class Network #Gold {
+ register(Container $container) : void
+ getResolve(Container $container) : Resolve
+ getStatus(Container $container) : Status
+ getUrl(Container $container) : Url
+ getCore(Container $container) : Core
+ getParsedUrls(Container $container) : ParsedUrls
}
note right of Network::register
Registers the service provider with a DI container.
since: 5.0.4
return: void
end note
note right of Network::getResolve
Get The Resolve Class.
since: 5.0.4
return: Resolve
end note
note right of Network::getStatus
Get The Status Class.
since: 5.0.4
return: Status
end note
note right of Network::getUrl
Get The Url Class.
since: 5.0.4
return: Url
end note
note right of Network::getCore
Get The Core Class.
since: 5.0.4
return: Core
end note
note right of Network::getParsedUrls
Get The ParsedUrls Class.
since: 5.0.4
return: ParsedUrls
end note
@enduml
```
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
To add this specific Power to your project in JCB:
> simply use this SPK
```
Super---156f449b_ca6c_4a57_a925_be345e751614---Power
```
> remember to replace the `---` with `___` to activate this Power in your code
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,131 @@
<?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\Componentbuilder\Network\Resolve;
use VDM\Joomla\Componentbuilder\Network\Status;
use VDM\Joomla\Componentbuilder\Network\Url;
use VDM\Joomla\Componentbuilder\Network\Core;
use VDM\Joomla\Componentbuilder\Network\ParsedUrls;
/**
* The Joomla Component Builder Network Service
*
* @since 5.0.4
*/
class Network implements ServiceProviderInterface
{
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
* @since 5.0.4
*/
public function register(Container $container)
{
$container->alias(Resolve::class, 'Network.Resolve')
->share('Network.Resolve', [$this, 'getResolve'], true);
$container->alias(Status::class, 'Network.Status')
->share('Network.Status', [$this, 'getStatus'], true);
$container->alias(Url::class, 'Network.Url')
->share('Network.Url', [$this, 'getUrl'], true);
$container->alias(Core::class, 'Network.Core')
->share('Network.Core', [$this, 'getCore'], true);
$container->alias(ParsedUrls::class, 'Network.Parsed.Urls')
->share('Network.Parsed.Urls', [$this, 'getParsedUrls'], true);
}
/**
* Get The Resolve Class.
*
* @param Container $container The DI container.
*
* @return Resolve
* @since 5.0.4
*/
public function getResolve(Container $container): Resolve
{
return new Resolve(
$container->get('Network.Url'),
$container->get('Network.Status')
);
}
/**
* Get The Status Class.
*
* @param Container $container The DI container.
*
* @return Status
* @since 5.0.4
*/
public function getStatus(Container $container): Status
{
return new Status(
$container->get('Api.Network'),
$container->get('Network.Core'),
$container->get('Network.Url')
);
}
/**
* Get The Url Class.
*
* @param Container $container The DI container.
*
* @return Url
* @since 5.0.4
*/
public function getUrl(Container $container): Url
{
return new Url(
$container->get('Network.Parsed.Urls')
);
}
/**
* Get The Core Class.
*
* @param Container $container The DI container.
*
* @return Core
* @since 5.0.4
*/
public function getCore(Container $container): Core
{
return new Core();
}
/**
* Get The ParsedUrls Class.
*
* @param Container $container The DI container.
*
* @return ParsedUrls
* @since 5.0.4
*/
public function getParsedUrls(Container $container): ParsedUrls
{
return new ParsedUrls();
}
}

View File

@ -0,0 +1,99 @@
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
* @since 5.0.4
*/
public function register(Container $container)
{
$container->alias(Resolve::class, 'Network.Resolve')
->share('Network.Resolve', [$this, 'getResolve'], true);
$container->alias(Status::class, 'Network.Status')
->share('Network.Status', [$this, 'getStatus'], true);
$container->alias(Url::class, 'Network.Url')
->share('Network.Url', [$this, 'getUrl'], true);
$container->alias(Core::class, 'Network.Core')
->share('Network.Core', [$this, 'getCore'], true);
$container->alias(ParsedUrls::class, 'Network.Parsed.Urls')
->share('Network.Parsed.Urls', [$this, 'getParsedUrls'], true);
}
/**
* Get The Resolve Class.
*
* @param Container $container The DI container.
*
* @return Resolve
* @since 5.0.4
*/
public function getResolve(Container $container): Resolve
{
return new Resolve(
$container->get('Network.Url'),
$container->get('Network.Status')
);
}
/**
* Get The Status Class.
*
* @param Container $container The DI container.
*
* @return Status
* @since 5.0.4
*/
public function getStatus(Container $container): Status
{
return new Status(
$container->get('Api.Network'),
$container->get('Network.Core'),
$container->get('Network.Url')
);
}
/**
* Get The Url Class.
*
* @param Container $container The DI container.
*
* @return Url
* @since 5.0.4
*/
public function getUrl(Container $container): Url
{
return new Url(
$container->get('Network.Parsed.Urls')
);
}
/**
* Get The Core Class.
*
* @param Container $container The DI container.
*
* @return Core
* @since 5.0.4
*/
public function getCore(Container $container): Core
{
return new Core();
}
/**
* Get The ParsedUrls Class.
*
* @param Container $container The DI container.
*
* @return ParsedUrls
* @since 5.0.4
*/
public function getParsedUrls(Container $container): ParsedUrls
{
return new ParsedUrls();
}

View File

@ -0,0 +1,43 @@
{
"add_head": "1",
"add_licensing_template": "2",
"extends": "",
"guid": "156f449b-ca6c-4a57-a925-be345e751614",
"implements": [
"-1"
],
"load_selection": null,
"name": "Network",
"power_version": "1.0.0",
"system_name": "Joomla.JCB.Service.Network",
"type": "class",
"use_selection": {
"use_selection0": {
"use": "a0c143af-3d7d-4c19-91c4-f72060b4c361",
"as": "default"
},
"use_selection1": {
"use": "809d3077-c105-4e9c-8ac5-8fbee10cf9fc",
"as": "default"
},
"use_selection2": {
"use": "286f7550-9c22-401c-9e5a-2f9426888133",
"as": "default"
},
"use_selection3": {
"use": "825ecce9-72ef-4257-bc32-4b05a4c226e9",
"as": "default"
},
"use_selection4": {
"use": "fd3b25c3-cd49-404c-ae82-b6a125863f10",
"as": "default"
}
},
"extendsinterfaces": null,
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Service.Network",
"description": "The Joomla Component Builder Network Service\r\n\r\n@since 5.0.4",
"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

@ -12,7 +12,7 @@
namespace VDM\Joomla\Componentbuilder\Compiler\Builder;
use VDM\Joomla\Abstraction\Registry\Traits\ToString;
use VDM\Joomla\Abstraction\Registry\Traits\PathToString;
use VDM\Joomla\Interfaces\Registryinterface;
use VDM\Joomla\Abstraction\Registry;
@ -25,10 +25,10 @@ use VDM\Joomla\Abstraction\Registry;
final class DynamicFields extends Registry implements Registryinterface
{
/**
* To String Values
* Path To String Values
*
* @since 3.2.0
*/
use ToString;
use PathToString;
}

View File

@ -1,6 +1,6 @@
/**
* To String Values
* Path To String Values
*
* @since 3.2.0
*/
use ToString;
use PathToString;

View File

@ -0,0 +1,97 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# final class Uri (Details)
> namespace: **VDM\Joomla\Componentbuilder\Utilities**
```uml
@startuml
class Uri << (F,LightGreen) >> #RoyalBlue {
- string $version
- string $url
+ __construct(string $url = 'https://api.joomlacomponentbuilder.com', string $version = 'v1')
+ get(string $path) : JoomlaUri
+ api() : string
+ setUrl(string $url) : void
+ getUrl() : ?string
- setVersion(string $version) : void
}
note right of Uri::__construct
Constructor
example: https://api.joomlacomponentbuilder.com
since: 3.2.0
end note
note right of Uri::get
Method to build and return a full request URL for the request. This method will
add appropriate pagination details if necessary and also prepend the API url
to have a complete URL for the request.
since: 3.2.0
return: JoomlaUri
end note
note right of Uri::api
Get the full API URL
since: 3.2.0
return: string
end note
note right of Uri::setUrl
Set the URL of the API
example: https://api.joomlacomponentbuilder.com
since: 3.2.0
return: void
end note
note right of Uri::getUrl
Get the URL of the API
since: 3.2.0
return: ?string
end note
note right of Uri::setVersion
Set the version of the API
since: 3.2.0
return: void
end note
@enduml
```
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
To add this specific Power to your project in JCB:
> simply use this SPK
```
Super---1c5bf656_f73a_46ec_bb9d_aa3932d5b3de---Power
```
> remember to replace the `---` with `___` to activate this Power in your code
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,127 @@
<?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\Utilities;
use Joomla\Uri\Uri as JoomlaUri;
/**
* The Joomla Component Builder Uri
*
* @since 5.0.4
*/
final class Uri
{
/**
* The api version
*
* @var string
* @since 3.2.0
*/
private string $version;
/**
* The api URL
*
* @var string
* @since 3.2.0
*/
private string $url;
/**
* Constructor
*
* @param string $url URL to the api system
* example: https://api.joomlacomponentbuilder.com
* @param string $endpoint Endpoint to the gitea system
* @param string $version Version to the gitea system
*
* @since 3.2.0
**/
public function __construct(
string $url = 'https://api.joomlacomponentbuilder.com',
string $version = 'v1')
{
// set the API details
$this->setUrl($url);
$this->setVersion($version);
}
/**
* Method to build and return a full request URL for the request. This method will
* add appropriate pagination details if necessary and also prepend the API url
* to have a complete URL for the request.
*
* @param string $path URL to inflect
*
* @return JoomlaUri
* @since 3.2.0
**/
public function get(string $path): JoomlaUri
{
// Get a new Uri object focusing the api url and given path.
$uri = new JoomlaUri($this->api() . $path);
return $uri;
}
/**
* Get the full API URL
*
* @return string
* @since 3.2.0
**/
public function api(): string
{
return $this->url . '/' . $this->version;
}
/**
* Set the URL of the API
*
* @param string $url URL to your gitea system
* example: https://api.joomlacomponentbuilder.com
*
* @return void
* @since 3.2.0
**/
public function setUrl(string $url)
{
$this->url = $url;
}
/**
* Get the URL of the API
*
* @return string|null
* @since 3.2.0
**/
public function getUrl(): ?string
{
return $this->url ?? null;
}
/**
* Set the version of the API
*
* @param string $version version to your gitea API
*
* @return void
* @since 3.2.0
**/
private function setVersion($version)
{
$this->version = $version;
}
}

View File

@ -0,0 +1,101 @@
/**
* The api version
*
* @var string
* @since 3.2.0
*/
private string $version;
/**
* The api URL
*
* @var string
* @since 3.2.0
*/
private string $url;
/**
* Constructor
*
* @param string $url URL to the api system
* example: https://api.joomlacomponentbuilder.com
* @param string $endpoint Endpoint to the gitea system
* @param string $version Version to the gitea system
*
* @since 3.2.0
**/
public function __construct(
string $url = 'https://api.joomlacomponentbuilder.com',
string $version = 'v1')
{
// set the API details
$this->setUrl($url);
$this->setVersion($version);
}
/**
* Method to build and return a full request URL for the request. This method will
* add appropriate pagination details if necessary and also prepend the API url
* to have a complete URL for the request.
*
* @param string $path URL to inflect
*
* @return JoomlaUri
* @since 3.2.0
**/
public function get(string $path): JoomlaUri
{
// Get a new Uri object focusing the api url and given path.
$uri = new JoomlaUri($this->api() . $path);
return $uri;
}
/**
* Get the full API URL
*
* @return string
* @since 3.2.0
**/
public function api(): string
{
return $this->url . '/' . $this->version;
}
/**
* Set the URL of the API
*
* @param string $url URL to your gitea system
* example: https://api.joomlacomponentbuilder.com
*
* @return void
* @since 3.2.0
**/
public function setUrl(string $url)
{
$this->url = $url;
}
/**
* Get the URL of the API
*
* @return string|null
* @since 3.2.0
**/
public function getUrl(): ?string
{
return $this->url ?? null;
}
/**
* Set the version of the API
*
* @param string $version version to your gitea API
*
* @return void
* @since 3.2.0
**/
private function setVersion($version)
{
$this->version = $version;
}

View File

@ -0,0 +1,19 @@
{
"add_head": "1",
"add_licensing_template": "2",
"extends": "",
"guid": "1c5bf656-f73a-46ec-bb9d-aa3932d5b3de",
"implements": null,
"load_selection": null,
"name": "Uri",
"power_version": "1.0.0",
"system_name": "Joomla.JCB.Utilities.Uri",
"type": "final class",
"use_selection": null,
"extendsinterfaces": null,
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Utilities.Uri",
"description": "The Joomla Component Builder Uri\r\n\r\n@since 5.0.4",
"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\\Uri\\Uri as JoomlaUri;",
"composer": ""
}

View File

@ -0,0 +1,113 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# final class Url (Details)
> namespace: **VDM\Joomla\Componentbuilder\Network**
```uml
@startuml
class Url << (F,LightGreen) >> #RoyalBlue {
# ParsedUrls $parsedurls
+ __construct(ParsedUrls $parsedurls)
+ parse(string $url) : object
+ base(string $url) : string
+ equal(string $url1, string $url2) : bool
+ equalStrict(string $url1, string $url2) : bool
+ equalRepo(string $url1, string $url2) : bool
- compare(string $url1, string $url2, ...) : bool
}
note right of Url::__construct
Constructor.
since: 5.0.4
end note
note right of Url::parse
Parses a URL and extracts the domain, organization, and repository.
This method takes a URL of the format 'https://[domain]/[organization]/[repository]'
and returns an associative array with keys 'domain', 'organization', and 'repository'.
since: 5.0.4
return: object
end note
note right of Url::base
Extract the base domain from a given URL or domain string.
since: 5.0.4
return: string
end note
note right of Url::equal
Compares two URLs and checks if their domain and repository are the same.
This method returns true if both the domain and repository are identical in both URLs.
since: 5.0.4
return: bool
end note
note right of Url::equalStrict
Compares two URLs strictly and checks if their domain, organization, and repository are the same.
This method returns true if the domain, organization, and repository are identical in both URLs.
since: 5.0.4
return: bool
end note
note right of Url::equalRepo
Compares two URLs and checks if their repositories are the same.
This method returns true if the repository names are identical in both URLs, regardless of domain and organization.
since: 5.0.4
return: bool
end note
note right of Url::compare
Compares two URLs based on specified fields.
This method allows you to compare specific components of two URLs, such as 'domain',
'organization', and 'repository'. It returns true if all specified fields are equal.
or if an invalid field is specified.
since: 5.0.4
return: bool
arguments:
string $url1
string $url2
array $fields
end note
@enduml
```
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
To add this specific Power to your project in JCB:
> simply use this SPK
```
Super---286f7550_9c22_401c_9e5a_2f9426888133---Power
```
> remember to replace the `---` with `___` to activate this Power in your code
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,237 @@
<?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\Network;
use VDM\Joomla\Componentbuilder\Network\ParsedUrls;
/**
* The Network Url
*
* @since 5.0.4
*/
final class Url
{
/**
* The ParsedUrls Class.
*
* @var ParsedUrls
* @since 5.0.4
*/
protected ParsedUrls $parsedurls;
/**
* Constructor.
*
* @param ParsedUrls $parsedurls The ParsedUrls Class.
*
* @since 5.0.4
*/
public function __construct(ParsedUrls $parsedurls)
{
$this->parsedurls = $parsedurls;
}
/**
* Parses a URL and extracts the domain, organization, and repository.
*
* This method takes a URL of the format 'https://[domain]/[organization]/[repository]'
* and returns an associative array with keys 'domain', 'organization', and 'repository'.
*
* @param string $url The URL to parse.
*
* @return object An object with keys 'domain', 'organization', and 'repository'.
* @throws \InvalidArgumentException If the URL is invalid or lacks required components.
* @since 5.0.4
*/
public function parse(string $url): object
{
// Check if the URL has already been parsed and is present in the cache
if (($parsed = $this->parsedurls->get($url)) !== null)
{
return (object) $parsed;
}
// Validate the URL format
if (!filter_var($url, FILTER_VALIDATE_URL))
{
throw new \InvalidArgumentException("Invalid URL format: $url");
}
// Parse the URL and extract its components
$parsedUrl = parse_url($url);
if ($parsedUrl === false)
{
throw new \InvalidArgumentException("Invalid URL provided: $url");
}
// Ensure the URL contains a host (domain)
if (empty($parsedUrl['host']))
{
throw new \InvalidArgumentException("The URL does not contain a valid domain: $url");
}
$domain = $parsedUrl['host'];
// Set the scheme
$scheme = $parsedUrl['scheme'] ?? 'https';
// Ensure the URL contains a path
if (empty($parsedUrl['path']))
{
throw new \InvalidArgumentException("The URL does not contain a valid path: $url");
}
// Remove leading and trailing slashes from the path
$path = trim($parsedUrl['path'], '/');
// Split the path into components
$pathParts = explode('/', $path);
// Ensure the path contains at least two components: organization and repository
if (count($pathParts) < 2)
{
throw new \InvalidArgumentException("The URL must contain both an organization and a repository: $url");
}
$organization = $pathParts[0];
$repository = $pathParts[1];
// Create a new Parsed Url array
$parsed = [
'scheme' => $scheme,
'domain' => $domain,
'organization' => $organization,
'repository' => $repository
];
// Store the parsed URL in the cache
$this->parsedurls->set($url, $parsed);
// Return the parsed URL object
return (object) $parsed;
}
/**
* Extract the base domain from a given URL or domain string.
*
* @param string $url The input URL or domain string.
*
* @return string The core domain (e.g., domain.com).
* @since 5.0.4
*/
public function base(string $url): string
{
// Parse the URL to extract host
$parsedUrl = parse_url($url, PHP_URL_HOST);
// If no host is found, check if the input itself is a domain without protocol
if (!$parsedUrl)
{
$parsedUrl = $url;
}
// Remove any trailing slashes or unnecessary characters
$parsedUrl = rtrim($parsedUrl, '/');
return $parsedUrl;
}
/**
* Compares two URLs and checks if their domain and repository are the same.
*
* This method returns true if both the domain and repository are identical in both URLs.
*
* @param string $url1 The first URL to compare.
* @param string $url2 The second URL to compare.
*
* @return bool Returns true if the domain and repository are the same; false otherwise.
* @throws InvalidArgumentException If any of the URLs are invalid or lack required components.
* @since 5.0.4
*/
public function equal(string $url1, string $url2): bool
{
return $this->compare($url1, $url2, ['domain', 'repository']);
}
/**
* Compares two URLs strictly and checks if their domain, organization, and repository are the same.
*
* This method returns true if the domain, organization, and repository are identical in both URLs.
*
* @param string $url1 The first URL to compare.
* @param string $url2 The second URL to compare.
*
* @return bool Returns true if the domain, organization, and repository are the same; false otherwise.
* @throws \InvalidArgumentException If any of the URLs are invalid or lack required components.
* @since 5.0.4
*/
public function equalStrict(string $url1, string $url2): bool
{
return $this->compare($url1, $url2, ['domain', 'organization', 'repository']);
}
/**
* Compares two URLs and checks if their repositories are the same.
*
* This method returns true if the repository names are identical in both URLs, regardless of domain and organization.
*
* @param string $url1 The first URL to compare.
* @param string $url2 The second URL to compare.
*
* @return bool Returns true if the repositories are the same; false otherwise.
* @throws \InvalidArgumentException If any of the URLs are invalid or lack required components.
* @since 5.0.4
*/
public function equalRepo(string $url1, string $url2): bool
{
return $this->compare($url1, $url2, ['repository']);
}
/**
* Compares two URLs based on specified fields.
*
* This method allows you to compare specific components of two URLs, such as 'domain',
* 'organization', and 'repository'. It returns true if all specified fields are equal.
*
* @param string $url1 The first URL to compare.
* @param string $url2 The second URL to compare.
* @param string[] $fields The fields to compare ('domain', 'organization', 'repository').
*
* @return bool Returns true if all specified fields are equal; false otherwise.
* @throws \InvalidArgumentException If any of the URLs are invalid or lack required components,
* or if an invalid field is specified.
* @since 5.0.4
*/
private function compare(string $url1, string $url2, array $fields): bool
{
$parsedUrl1 = $this->parse($url1);
$parsedUrl2 = $this->parse($url2);
foreach ($fields as $field)
{
if (!property_exists($parsedUrl1, $field) || !property_exists($parsedUrl2, $field))
{
throw new \InvalidArgumentException("Invalid field specified for comparison: $field");
}
if ($parsedUrl1->$field !== $parsedUrl2->$field)
{
return false;
}
}
return true;
}
}

View File

@ -0,0 +1,211 @@
/**
* The ParsedUrls Class.
*
* @var ParsedUrls
* @since 5.0.4
*/
protected ParsedUrls $parsedurls;
/**
* Constructor.
*
* @param ParsedUrls $parsedurls The ParsedUrls Class.
*
* @since 5.0.4
*/
public function __construct(ParsedUrls $parsedurls)
{
$this->parsedurls = $parsedurls;
}
/**
* Parses a URL and extracts the domain, organization, and repository.
*
* This method takes a URL of the format 'https://[domain]/[organization]/[repository]'
* and returns an associative array with keys 'domain', 'organization', and 'repository'.
*
* @param string $url The URL to parse.
*
* @return object An object with keys 'domain', 'organization', and 'repository'.
* @throws \InvalidArgumentException If the URL is invalid or lacks required components.
* @since 5.0.4
*/
public function parse(string $url): object
{
// Check if the URL has already been parsed and is present in the cache
if (($parsed = $this->parsedurls->get($url)) !== null)
{
return (object) $parsed;
}
// Validate the URL format