From 3adb5fab050b9eb00e848839f9210e153b4c9ed5 Mon Sep 17 00:00:00 2001 From: aB0t Date: Mon, 16 Dec 2024 18:27:29 +0200 Subject: [PATCH] Update 2024-12-16 18:27:10 --- README.md | 18 +- .../code.php | 1 + .../code.power | 1 + .../README.md | 59 ++++ .../code.php | 59 ++++ .../code.power | 33 +++ .../settings.json | 19 ++ .../code.php | 6 +- .../code.power | 4 +- .../README.md | 2 +- .../code.php | 4 +- .../code.php | 6 +- .../code.power | 4 +- .../README.md | 92 +++++++ .../code.php | 131 +++++++++ .../code.power | 99 +++++++ .../settings.json | 43 +++ .../code.php | 6 +- .../code.power | 4 +- .../README.md | 97 +++++++ .../code.php | 127 +++++++++ .../code.power | 101 +++++++ .../settings.json | 19 ++ .../README.md | 113 ++++++++ .../code.php | 237 ++++++++++++++++ .../code.power | 211 ++++++++++++++ .../settings.json | 24 ++ .../code.php | 4 +- .../code.power | 4 +- .../README.md | 1 + .../code.php | 10 +- .../code.power | 10 +- .../code.php | 1 + .../code.power | 1 + .../README.md | 60 ++++ .../code.php | 58 ++++ .../code.power | 30 ++ .../settings.json | 27 ++ .../code.php | 8 +- .../code.power | 5 +- .../settings.json | 12 + .../code.php | 1 + .../code.power | 1 + .../README.md | 64 +++-- .../code.php | 107 ++++++-- .../code.power | 102 +++++-- .../settings.json | 26 +- .../README.md | 11 + .../code.php | 34 ++- .../code.power | 34 ++- .../code.php | 1 + .../code.power | 1 + .../code.php | 2 +- .../code.power | 2 +- .../code.php | 8 +- .../code.power | 5 +- .../settings.json | 12 + .../code.php | 4 +- .../code.power | 4 +- .../README.md | 119 ++++++++ .../code.php | 258 ++++++++++++++++++ .../code.power | 230 ++++++++++++++++ .../settings.json | 32 +++ .../README.md | 46 ++++ .../code.php | 33 +++ .../code.power | 7 + .../settings.json | 19 ++ .../README.md | 25 +- .../code.php | 67 +++++ .../code.power | 39 +++ .../settings.json | 24 +- .../code.php | 6 +- .../code.power | 4 +- .../code.php | 64 ----- .../code.power | 33 --- .../README.md | 108 ++++++++ .../code.php | 178 ++++++++++++ .../code.power | 150 ++++++++++ .../settings.json | 28 ++ .../code.php | 6 +- .../code.power | 6 +- .../code.php | 6 +- .../code.power | 4 +- .../code.php | 8 +- .../code.power | 5 +- .../settings.json | 12 + .../code.php | 6 +- .../code.power | 4 +- .../code.php | 5 + .../code.power | 5 + .../README.md | 2 +- .../code.php | 4 +- .../README.md | 2 +- .../code.php | 4 +- .../README.md | 73 +++++ .../code.php | 125 +++++++++ .../code.power | 97 +++++++ .../settings.json | 28 ++ .../README.md | 1 + .../code.php | 8 + .../code.power | 8 + .../README.md | 1 + .../code.php | 10 +- .../code.power | 10 +- .../code.php | 4 + .../code.power | 2 + .../settings.json | 94 ++++--- .../README.md | 52 ++++ .../code.php | 49 ++++ .../code.power | 21 ++ .../settings.json | 20 ++ .../code.php | 1 + .../code.power | 1 + .../README.md | 2 +- .../code.php | 4 +- .../README.md | 76 ++++++ .../code.php | 88 ++++++ .../code.power | 58 ++++ .../settings.json | 35 +++ .../README.md | 46 ++++ .../code.php | 33 +++ .../code.power | 7 + .../settings.json | 19 ++ super-powers.json | 154 ++++++++++- 124 files changed, 4522 insertions(+), 324 deletions(-) create mode 100644 src/07ca003e-368c-451d-a3d3-ba24e50c7287/README.md create mode 100644 src/07ca003e-368c-451d-a3d3-ba24e50c7287/code.php create mode 100644 src/07ca003e-368c-451d-a3d3-ba24e50c7287/code.power create mode 100644 src/07ca003e-368c-451d-a3d3-ba24e50c7287/settings.json create mode 100644 src/156f449b-ca6c-4a57-a925-be345e751614/README.md create mode 100644 src/156f449b-ca6c-4a57-a925-be345e751614/code.php create mode 100644 src/156f449b-ca6c-4a57-a925-be345e751614/code.power create mode 100644 src/156f449b-ca6c-4a57-a925-be345e751614/settings.json create mode 100644 src/1c5bf656-f73a-46ec-bb9d-aa3932d5b3de/README.md create mode 100644 src/1c5bf656-f73a-46ec-bb9d-aa3932d5b3de/code.php create mode 100644 src/1c5bf656-f73a-46ec-bb9d-aa3932d5b3de/code.power create mode 100644 src/1c5bf656-f73a-46ec-bb9d-aa3932d5b3de/settings.json create mode 100644 src/286f7550-9c22-401c-9e5a-2f9426888133/README.md create mode 100644 src/286f7550-9c22-401c-9e5a-2f9426888133/code.php create mode 100644 src/286f7550-9c22-401c-9e5a-2f9426888133/code.power create mode 100644 src/286f7550-9c22-401c-9e5a-2f9426888133/settings.json create mode 100644 src/3c7567d7-b079-4910-b325-7ed5c30cabff/README.md create mode 100644 src/3c7567d7-b079-4910-b325-7ed5c30cabff/code.php create mode 100644 src/3c7567d7-b079-4910-b325-7ed5c30cabff/code.power create mode 100644 src/3c7567d7-b079-4910-b325-7ed5c30cabff/settings.json create mode 100644 src/809d3077-c105-4e9c-8ac5-8fbee10cf9fc/README.md create mode 100644 src/809d3077-c105-4e9c-8ac5-8fbee10cf9fc/code.php create mode 100644 src/809d3077-c105-4e9c-8ac5-8fbee10cf9fc/code.power create mode 100644 src/809d3077-c105-4e9c-8ac5-8fbee10cf9fc/settings.json create mode 100644 src/825ecce9-72ef-4257-bc32-4b05a4c226e9/README.md create mode 100644 src/825ecce9-72ef-4257-bc32-4b05a4c226e9/code.php create mode 100644 src/825ecce9-72ef-4257-bc32-4b05a4c226e9/code.power create mode 100644 src/825ecce9-72ef-4257-bc32-4b05a4c226e9/settings.json rename src/{9769f3b2-17bf-4f20-b54b-3a4ebe572b36 => 85e0b652-21b9-4ff7-ba27-dbd72256f0f2}/README.md (86%) create mode 100644 src/85e0b652-21b9-4ff7-ba27-dbd72256f0f2/code.php create mode 100644 src/85e0b652-21b9-4ff7-ba27-dbd72256f0f2/code.power rename src/{9769f3b2-17bf-4f20-b54b-3a4ebe572b36 => 85e0b652-21b9-4ff7-ba27-dbd72256f0f2}/settings.json (62%) delete mode 100644 src/9769f3b2-17bf-4f20-b54b-3a4ebe572b36/code.php delete mode 100644 src/9769f3b2-17bf-4f20-b54b-3a4ebe572b36/code.power create mode 100644 src/a0c143af-3d7d-4c19-91c4-f72060b4c361/README.md create mode 100644 src/a0c143af-3d7d-4c19-91c4-f72060b4c361/code.php create mode 100644 src/a0c143af-3d7d-4c19-91c4-f72060b4c361/code.power create mode 100644 src/a0c143af-3d7d-4c19-91c4-f72060b4c361/settings.json create mode 100644 src/c99e85a0-d120-4f25-bcbf-0940dd7b773b/README.md create mode 100644 src/c99e85a0-d120-4f25-bcbf-0940dd7b773b/code.php create mode 100644 src/c99e85a0-d120-4f25-bcbf-0940dd7b773b/code.power create mode 100644 src/c99e85a0-d120-4f25-bcbf-0940dd7b773b/settings.json create mode 100644 src/d9ee00d6-eeed-4fc4-af8a-7b5547f508ba/README.md create mode 100644 src/d9ee00d6-eeed-4fc4-af8a-7b5547f508ba/code.php create mode 100644 src/d9ee00d6-eeed-4fc4-af8a-7b5547f508ba/code.power create mode 100644 src/d9ee00d6-eeed-4fc4-af8a-7b5547f508ba/settings.json create mode 100644 src/facd1e1c-ff2f-4520-b735-075c45aa55ed/README.md create mode 100644 src/facd1e1c-ff2f-4520-b735-075c45aa55ed/code.php create mode 100644 src/facd1e1c-ff2f-4520-b735-075c45aa55ed/code.power create mode 100644 src/facd1e1c-ff2f-4520-b735-075c45aa55ed/settings.json create mode 100644 src/fd3b25c3-cd49-404c-ae82-b6a125863f10/README.md create mode 100644 src/fd3b25c3-cd49-404c-ae82-b6a125863f10/code.php create mode 100644 src/fd3b25c3-cd49-404c-ae82-b6a125863f10/code.power create mode 100644 src/fd3b25c3-cd49-404c-ae82-b6a125863f10/settings.json diff --git a/README.md b/README.md index e3024ea..99f4d25 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/src/02bc072b-1e89-46c1-9732-4da77b1a9ac9/code.php b/src/02bc072b-1e89-46c1-9732-4da77b1a9ac9/code.php index 2763c2f..e58446f 100644 --- a/src/02bc072b-1e89-46c1-9732-4da77b1a9ac9/code.php +++ b/src/02bc072b-1e89-46c1-9732-4da77b1a9ac9/code.php @@ -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 ); diff --git a/src/02bc072b-1e89-46c1-9732-4da77b1a9ac9/code.power b/src/02bc072b-1e89-46c1-9732-4da77b1a9ac9/code.power index 477976b..749b9ad 100644 --- a/src/02bc072b-1e89-46c1-9732-4da77b1a9ac9/code.power +++ b/src/02bc072b-1e89-46c1-9732-4da77b1a9ac9/code.power @@ -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 ); diff --git a/src/07ca003e-368c-451d-a3d3-ba24e50c7287/README.md b/src/07ca003e-368c-451d-a3d3-ba24e50c7287/README.md new file mode 100644 index 0000000..cd71047 --- /dev/null +++ b/src/07ca003e-368c-451d-a3d3-ba24e50c7287/README.md @@ -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) + diff --git a/src/07ca003e-368c-451d-a3d3-ba24e50c7287/code.php b/src/07ca003e-368c-451d-a3d3-ba24e50c7287/code.php new file mode 100644 index 0000000..995b81a --- /dev/null +++ b/src/07ca003e-368c-451d-a3d3-ba24e50c7287/code.php @@ -0,0 +1,59 @@ + + * @git 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) + ) + ); + } +} + diff --git a/src/07ca003e-368c-451d-a3d3-ba24e50c7287/code.power b/src/07ca003e-368c-451d-a3d3-ba24e50c7287/code.power new file mode 100644 index 0000000..b9eedf7 --- /dev/null +++ b/src/07ca003e-368c-451d-a3d3-ba24e50c7287/code.power @@ -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) + ) + ); + } \ No newline at end of file diff --git a/src/07ca003e-368c-451d-a3d3-ba24e50c7287/settings.json b/src/07ca003e-368c-451d-a3d3-ba24e50c7287/settings.json new file mode 100644 index 0000000..b4cfd3a --- /dev/null +++ b/src/07ca003e-368c-451d-a3d3-ba24e50c7287/settings.json @@ -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 \r\n * @git 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": "" +} \ No newline at end of file diff --git a/src/0b45357f-b077-4337-92f3-65c1e19d36cd/code.php b/src/0b45357f-b077-4337-92f3-65c1e19d36cd/code.php index bfef415..4f67dd7 100644 --- a/src/0b45357f-b077-4337-92f3-65c1e19d36cd/code.php +++ b/src/0b45357f-b077-4337-92f3-65c1e19d36cd/code.php @@ -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; } diff --git a/src/0b45357f-b077-4337-92f3-65c1e19d36cd/code.power b/src/0b45357f-b077-4337-92f3-65c1e19d36cd/code.power index b9696bb..5081704 100644 --- a/src/0b45357f-b077-4337-92f3-65c1e19d36cd/code.power +++ b/src/0b45357f-b077-4337-92f3-65c1e19d36cd/code.power @@ -1,6 +1,6 @@ /** - * To String Values + * Path To String Values * * @since 3.2.0 */ - use ToString; \ No newline at end of file + use PathToString; \ No newline at end of file diff --git a/src/0b821bba-7503-4448-90e7-f3c1bd51dfd6/README.md b/src/0b821bba-7503-4448-90e7-f3c1bd51dfd6/README.md index 05736fc..7ce86b6 100644 --- a/src/0b821bba-7503-4448-90e7-f3c1bd51dfd6/README.md +++ b/src/0b821bba-7503-4448-90e7-f3c1bd51dfd6/README.md @@ -8,7 +8,7 @@ ``` # class Config (Details) > namespace: **VDM\Joomla\Componentbuilder\JoomlaPower** -> extends: **BaseConfig** +> extends: **ComponentConfig** ```uml @startuml diff --git a/src/0b821bba-7503-4448-90e7-f3c1bd51dfd6/code.php b/src/0b821bba-7503-4448-90e7-f3c1bd51dfd6/code.php index a1d52bc..64cd840 100644 --- a/src/0b821bba-7503-4448-90e7-f3c1bd51dfd6/code.php +++ b/src/0b821bba-7503-4448-90e7-f3c1bd51dfd6/code.php @@ -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 diff --git a/src/0f141480-afe6-41fb-996c-2a4e566a2f0d/code.php b/src/0f141480-afe6-41fb-996c-2a4e566a2f0d/code.php index c32d4db..1ef8038 100644 --- a/src/0f141480-afe6-41fb-996c-2a4e566a2f0d/code.php +++ b/src/0f141480-afe6-41fb-996c-2a4e566a2f0d/code.php @@ -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; } diff --git a/src/0f141480-afe6-41fb-996c-2a4e566a2f0d/code.power b/src/0f141480-afe6-41fb-996c-2a4e566a2f0d/code.power index 21bfdb2..642b684 100644 --- a/src/0f141480-afe6-41fb-996c-2a4e566a2f0d/code.power +++ b/src/0f141480-afe6-41fb-996c-2a4e566a2f0d/code.power @@ -1,6 +1,6 @@ /** - * Count Values + * Path Count Values * * @since 3.2.0 */ - use Count; \ No newline at end of file + use PathCount; \ No newline at end of file diff --git a/src/156f449b-ca6c-4a57-a925-be345e751614/README.md b/src/156f449b-ca6c-4a57-a925-be345e751614/README.md new file mode 100644 index 0000000..6153683 --- /dev/null +++ b/src/156f449b-ca6c-4a57-a925-be345e751614/README.md @@ -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) + diff --git a/src/156f449b-ca6c-4a57-a925-be345e751614/code.php b/src/156f449b-ca6c-4a57-a925-be345e751614/code.php new file mode 100644 index 0000000..815fa06 --- /dev/null +++ b/src/156f449b-ca6c-4a57-a925-be345e751614/code.php @@ -0,0 +1,131 @@ + + * @git 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(); + } +} + diff --git a/src/156f449b-ca6c-4a57-a925-be345e751614/code.power b/src/156f449b-ca6c-4a57-a925-be345e751614/code.power new file mode 100644 index 0000000..3fedb46 --- /dev/null +++ b/src/156f449b-ca6c-4a57-a925-be345e751614/code.power @@ -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(); + } \ No newline at end of file diff --git a/src/156f449b-ca6c-4a57-a925-be345e751614/settings.json b/src/156f449b-ca6c-4a57-a925-be345e751614/settings.json new file mode 100644 index 0000000..45fb882 --- /dev/null +++ b/src/156f449b-ca6c-4a57-a925-be345e751614/settings.json @@ -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 \r\n * @git 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": "" +} \ No newline at end of file diff --git a/src/1ae9a8e8-59f7-4844-a08d-9a4dce4be076/code.php b/src/1ae9a8e8-59f7-4844-a08d-9a4dce4be076/code.php index df3982e..c3feed0 100644 --- a/src/1ae9a8e8-59f7-4844-a08d-9a4dce4be076/code.php +++ b/src/1ae9a8e8-59f7-4844-a08d-9a4dce4be076/code.php @@ -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; } diff --git a/src/1ae9a8e8-59f7-4844-a08d-9a4dce4be076/code.power b/src/1ae9a8e8-59f7-4844-a08d-9a4dce4be076/code.power index b9696bb..5081704 100644 --- a/src/1ae9a8e8-59f7-4844-a08d-9a4dce4be076/code.power +++ b/src/1ae9a8e8-59f7-4844-a08d-9a4dce4be076/code.power @@ -1,6 +1,6 @@ /** - * To String Values + * Path To String Values * * @since 3.2.0 */ - use ToString; \ No newline at end of file + use PathToString; \ No newline at end of file diff --git a/src/1c5bf656-f73a-46ec-bb9d-aa3932d5b3de/README.md b/src/1c5bf656-f73a-46ec-bb9d-aa3932d5b3de/README.md new file mode 100644 index 0000000..6aae052 --- /dev/null +++ b/src/1c5bf656-f73a-46ec-bb9d-aa3932d5b3de/README.md @@ -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) + diff --git a/src/1c5bf656-f73a-46ec-bb9d-aa3932d5b3de/code.php b/src/1c5bf656-f73a-46ec-bb9d-aa3932d5b3de/code.php new file mode 100644 index 0000000..4837402 --- /dev/null +++ b/src/1c5bf656-f73a-46ec-bb9d-aa3932d5b3de/code.php @@ -0,0 +1,127 @@ + + * @git 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; + } +} + diff --git a/src/1c5bf656-f73a-46ec-bb9d-aa3932d5b3de/code.power b/src/1c5bf656-f73a-46ec-bb9d-aa3932d5b3de/code.power new file mode 100644 index 0000000..51dd27c --- /dev/null +++ b/src/1c5bf656-f73a-46ec-bb9d-aa3932d5b3de/code.power @@ -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; + } \ No newline at end of file diff --git a/src/1c5bf656-f73a-46ec-bb9d-aa3932d5b3de/settings.json b/src/1c5bf656-f73a-46ec-bb9d-aa3932d5b3de/settings.json new file mode 100644 index 0000000..cf81716 --- /dev/null +++ b/src/1c5bf656-f73a-46ec-bb9d-aa3932d5b3de/settings.json @@ -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 \r\n * @git 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": "" +} \ No newline at end of file diff --git a/src/286f7550-9c22-401c-9e5a-2f9426888133/README.md b/src/286f7550-9c22-401c-9e5a-2f9426888133/README.md new file mode 100644 index 0000000..ec1e68c --- /dev/null +++ b/src/286f7550-9c22-401c-9e5a-2f9426888133/README.md @@ -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) + diff --git a/src/286f7550-9c22-401c-9e5a-2f9426888133/code.php b/src/286f7550-9c22-401c-9e5a-2f9426888133/code.php new file mode 100644 index 0000000..c40ea7a --- /dev/null +++ b/src/286f7550-9c22-401c-9e5a-2f9426888133/code.php @@ -0,0 +1,237 @@ + + * @git 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; + } +} + diff --git a/src/286f7550-9c22-401c-9e5a-2f9426888133/code.power b/src/286f7550-9c22-401c-9e5a-2f9426888133/code.power new file mode 100644 index 0000000..fde68b8 --- /dev/null +++ b/src/286f7550-9c22-401c-9e5a-2f9426888133/code.power @@ -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 + 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; + } \ No newline at end of file diff --git a/src/286f7550-9c22-401c-9e5a-2f9426888133/settings.json b/src/286f7550-9c22-401c-9e5a-2f9426888133/settings.json new file mode 100644 index 0000000..4ad6a1b --- /dev/null +++ b/src/286f7550-9c22-401c-9e5a-2f9426888133/settings.json @@ -0,0 +1,24 @@ +{ + "add_head": "0", + "add_licensing_template": "2", + "extends": "", + "guid": "286f7550-9c22-401c-9e5a-2f9426888133", + "implements": null, + "load_selection": null, + "name": "Url", + "power_version": "1.0.0", + "system_name": "Joomla.JCB.Network.Url", + "type": "final class", + "use_selection": { + "use_selection0": { + "use": "fd3b25c3-cd49-404c-ae82-b6a125863f10", + "as": "default" + } + }, + "extendsinterfaces": null, + "namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Network.Url", + "description": "The Network Url\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 \r\n * @git 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": "" +} \ No newline at end of file diff --git a/src/2bc33733-e900-4a9c-8cb3-c537aa9db785/code.php b/src/2bc33733-e900-4a9c-8cb3-c537aa9db785/code.php index 4d02833..2e2762d 100644 --- a/src/2bc33733-e900-4a9c-8cb3-c537aa9db785/code.php +++ b/src/2bc33733-e900-4a9c-8cb3-c537aa9db785/code.php @@ -181,7 +181,7 @@ final class InputButton implements InputButtonInterface $addButton[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__) . " get the return value."; $addButton[] = Indent::_(4) - . "\$_uri = (string) \Joomla\CMS\Uri\Uri::getInstance();"; + . "\$_uri = (string) Joomla__"."_eecc143e_b5cf_4c33_ba4d_97da1df61422___Power::getInstance();"; $addButton[] = Indent::_(4) . "\$_return = urlencode(base64_encode(\$_uri));"; $addButton[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__) @@ -206,7 +206,7 @@ final class InputButton implements InputButtonInterface $addButton[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__) . " get the return value."; $addButton[] = Indent::_(4) - . "\$_uri = (string) \Joomla\CMS\Uri\Uri::getInstance();"; + . "\$_uri = (string) Joomla__"."_eecc143e_b5cf_4c33_ba4d_97da1df61422___Power::getInstance();"; $addButton[] = Indent::_(4) . "\$_return = urlencode(base64_encode(\$_uri));"; $addButton[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__) diff --git a/src/2bc33733-e900-4a9c-8cb3-c537aa9db785/code.power b/src/2bc33733-e900-4a9c-8cb3-c537aa9db785/code.power index b533ef1..1903ba3 100644 --- a/src/2bc33733-e900-4a9c-8cb3-c537aa9db785/code.power +++ b/src/2bc33733-e900-4a9c-8cb3-c537aa9db785/code.power @@ -150,7 +150,7 @@ $addButton[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__) . " get the return value."; $addButton[] = Indent::_(4) - . "\$_uri = (string) \Joomla\CMS\Uri\Uri::getInstance();"; + . "\$_uri = (string) Joomla__"."_eecc143e_b5cf_4c33_ba4d_97da1df61422___Power::getInstance();"; $addButton[] = Indent::_(4) . "\$_return = urlencode(base64_encode(\$_uri));"; $addButton[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__) @@ -175,7 +175,7 @@ $addButton[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__) . " get the return value."; $addButton[] = Indent::_(4) - . "\$_uri = (string) \Joomla\CMS\Uri\Uri::getInstance();"; + . "\$_uri = (string) Joomla__"."_eecc143e_b5cf_4c33_ba4d_97da1df61422___Power::getInstance();"; $addButton[] = Indent::_(4) . "\$_return = urlencode(base64_encode(\$_uri));"; $addButton[] = Indent::_(4) . "//" . Line::_(__Line__, __Class__) diff --git a/src/355bf21a-f859-4528-9110-bcd2c6d05ea7/README.md b/src/355bf21a-f859-4528-9110-bcd2c6d05ea7/README.md index c5e09bf..cc03bc6 100644 --- a/src/355bf21a-f859-4528-9110-bcd2c6d05ea7/README.md +++ b/src/355bf21a-f859-4528-9110-bcd2c6d05ea7/README.md @@ -13,6 +13,7 @@ ```uml @startuml class Grep << (F,LightGreen) >> #RoyalBlue { + # ?string $target # array $order # searchRemote(string $guid) : ?object # getRemote(object $path, string $guid) : ?object diff --git a/src/355bf21a-f859-4528-9110-bcd2c6d05ea7/code.php b/src/355bf21a-f859-4528-9110-bcd2c6d05ea7/code.php index ec51d2d..9256b94 100644 --- a/src/355bf21a-f859-4528-9110-bcd2c6d05ea7/code.php +++ b/src/355bf21a-f859-4528-9110-bcd2c6d05ea7/code.php @@ -29,6 +29,14 @@ use VDM\Joomla\Abstraction\Grep as ExtendingGrep; */ final class Grep extends ExtendingGrep implements GrepInterface { + /** + * The Grep target [network] + * + * @var string + * @since 5.0.4 + **/ + protected ?string $target = 'joomla-powers'; + /** * Order of global search * @@ -77,7 +85,7 @@ final class Grep extends ExtendingGrep implements GrepInterface $branch = $this->getBranchName($path); // load the base and token if set - $this->contents->load_($path->base ?? null, $path->token ?? null); + $this->loadApi($this->contents, $path->base ?? null, $path->token ?? null); // get the settings if (($power = $this->loadRemoteFile($path->organisation, $path->repository, $path->index->{$guid}->path . '/item.json', $branch)) !== null && diff --git a/src/355bf21a-f859-4528-9110-bcd2c6d05ea7/code.power b/src/355bf21a-f859-4528-9110-bcd2c6d05ea7/code.power index 7a26fa8..515ecfa 100644 --- a/src/355bf21a-f859-4528-9110-bcd2c6d05ea7/code.power +++ b/src/355bf21a-f859-4528-9110-bcd2c6d05ea7/code.power @@ -1,3 +1,11 @@ + /** + * The Grep target [network] + * + * @var string + * @since 5.0.4 + **/ + protected ?string $target = 'joomla-powers'; + /** * Order of global search * @@ -46,7 +54,7 @@ $branch = $this->getBranchName($path); // load the base and token if set - $this->contents->load_($path->base ?? null, $path->token ?? null); + $this->loadApi($this->contents, $path->base ?? null, $path->token ?? null); // get the settings if (($power = $this->loadRemoteFile($path->organisation, $path->repository, $path->index->{$guid}->path . '/item.json', $branch)) !== null && diff --git a/src/38e1ca3e-1908-459a-be87-9f83b292058f/code.php b/src/38e1ca3e-1908-459a-be87-9f83b292058f/code.php index aadc6da..f048c09 100644 --- a/src/38e1ca3e-1908-459a-be87-9f83b292058f/code.php +++ b/src/38e1ca3e-1908-459a-be87-9f83b292058f/code.php @@ -100,6 +100,7 @@ class JoomlaPower implements ServiceProviderInterface { return new Grep( $container->get('Gitea.Repository.Contents'), + $container->get('Network.Resolve'), $container->get('Config')->approved_joomla_paths ); } diff --git a/src/38e1ca3e-1908-459a-be87-9f83b292058f/code.power b/src/38e1ca3e-1908-459a-be87-9f83b292058f/code.power index 6219836..59a2bc1 100644 --- a/src/38e1ca3e-1908-459a-be87-9f83b292058f/code.power +++ b/src/38e1ca3e-1908-459a-be87-9f83b292058f/code.power @@ -68,6 +68,7 @@ { return new Grep( $container->get('Gitea.Repository.Contents'), + $container->get('Network.Resolve'), $container->get('Config')->approved_joomla_paths ); } diff --git a/src/3c7567d7-b079-4910-b325-7ed5c30cabff/README.md b/src/3c7567d7-b079-4910-b325-7ed5c30cabff/README.md new file mode 100644 index 0000000..d125455 --- /dev/null +++ b/src/3c7567d7-b079-4910-b325-7ed5c30cabff/README.md @@ -0,0 +1,60 @@ +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# class Api (Details) +> namespace: **VDM\Joomla\Componentbuilder\Service** + +```uml +@startuml +class Api #Gold { + + register(Container $container) : void + + getNetwork(Container $container) : Network +} + +note right of Api::register + Registers the service provider with a DI container. + + since: 5.0.4 + return: void +end note + +note right of Api::getNetwork + Get The Network Class. + + since: 5.0.4 + return: Network +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---3c7567d7_b079_4910_b325_7ed5c30cabff---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) + diff --git a/src/3c7567d7-b079-4910-b325-7ed5c30cabff/code.php b/src/3c7567d7-b079-4910-b325-7ed5c30cabff/code.php new file mode 100644 index 0000000..1165575 --- /dev/null +++ b/src/3c7567d7-b079-4910-b325-7ed5c30cabff/code.php @@ -0,0 +1,58 @@ + + * @git 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\Api\Network; + + +/** + * The Joomla Component Builder Api Service + * + * @since 5.0.4 + */ +class Api 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(Network::class, 'Api.Network') + ->share('Api.Network', [$this, 'getNetwork'], true); + } + + /** + * Get The Network Class. + * + * @param Container $container The DI container. + * + * @return Network + * @since 5.0.4 + */ + public function getNetwork(Container $container): Network + { + return new Network( + $container->get('Utilities.Http'), + $container->get('Utilities.Uri'), + $container->get('Utilities.Response') + ); + } +} + diff --git a/src/3c7567d7-b079-4910-b325-7ed5c30cabff/code.power b/src/3c7567d7-b079-4910-b325-7ed5c30cabff/code.power new file mode 100644 index 0000000..d030063 --- /dev/null +++ b/src/3c7567d7-b079-4910-b325-7ed5c30cabff/code.power @@ -0,0 +1,30 @@ + /** + * 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(Network::class, 'Api.Network') + ->share('Api.Network', [$this, 'getNetwork'], true); + } + + /** + * Get The Network Class. + * + * @param Container $container The DI container. + * + * @return Network + * @since 5.0.4 + */ + public function getNetwork(Container $container): Network + { + return new Network( + $container->get('Utilities.Http'), + $container->get('Utilities.Uri'), + $container->get('Utilities.Response') + ); + } \ No newline at end of file diff --git a/src/3c7567d7-b079-4910-b325-7ed5c30cabff/settings.json b/src/3c7567d7-b079-4910-b325-7ed5c30cabff/settings.json new file mode 100644 index 0000000..b5e8d9b --- /dev/null +++ b/src/3c7567d7-b079-4910-b325-7ed5c30cabff/settings.json @@ -0,0 +1,27 @@ +{ + "add_head": "1", + "add_licensing_template": "2", + "extends": "", + "guid": "3c7567d7-b079-4910-b325-7ed5c30cabff", + "implements": [ + "-1" + ], + "load_selection": null, + "name": "Api", + "power_version": "1.0.0", + "system_name": "Joomla.JCB.Service.Api", + "type": "class", + "use_selection": { + "use_selection0": { + "use": "07ca003e-368c-451d-a3d3-ba24e50c7287", + "as": "default" + } + }, + "extendsinterfaces": null, + "namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Service.Api", + "description": "The Joomla Component Builder Api 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 \r\n * @git 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": "" +} \ No newline at end of file diff --git a/src/469608a8-72ba-4bad-8233-80a4127c72a8/code.php b/src/469608a8-72ba-4bad-8233-80a4127c72a8/code.php index 7d5a35e..120423a 100644 --- a/src/469608a8-72ba-4bad-8233-80a4127c72a8/code.php +++ b/src/469608a8-72ba-4bad-8233-80a4127c72a8/code.php @@ -20,6 +20,9 @@ use VDM\Joomla\Service\Data; use VDM\Joomla\Componentbuilder\Service\Gitea; use VDM\Joomla\Componentbuilder\Power\Service\Gitea as GiteaPower; use VDM\Joomla\Gitea\Service\Utilities as GiteaUtilities; +use VDM\Joomla\Componentbuilder\Service\Api; +use VDM\Joomla\Componentbuilder\Service\Network; +use VDM\Joomla\Componentbuilder\Service\Utilities; use VDM\Joomla\Interfaces\FactoryInterface; use VDM\Joomla\Abstraction\Factory as ExtendingFactory; @@ -54,7 +57,10 @@ abstract class Factory extends ExtendingFactory implements FactoryInterface ->registerServiceProvider(new Data()) ->registerServiceProvider(new Gitea()) ->registerServiceProvider(new GiteaPower()) - ->registerServiceProvider(new GiteaUtilities()); + ->registerServiceProvider(new GiteaUtilities()) + ->registerServiceProvider(new Api()) + ->registerServiceProvider(new Network()) + ->registerServiceProvider(new Utilities()); } } diff --git a/src/469608a8-72ba-4bad-8233-80a4127c72a8/code.power b/src/469608a8-72ba-4bad-8233-80a4127c72a8/code.power index 52bcc55..1c78001 100644 --- a/src/469608a8-72ba-4bad-8233-80a4127c72a8/code.power +++ b/src/469608a8-72ba-4bad-8233-80a4127c72a8/code.power @@ -21,5 +21,8 @@ ->registerServiceProvider(new Data()) ->registerServiceProvider(new Gitea()) ->registerServiceProvider(new GiteaPower()) - ->registerServiceProvider(new GiteaUtilities()); + ->registerServiceProvider(new GiteaUtilities()) + ->registerServiceProvider(new Api()) + ->registerServiceProvider(new Network()) + ->registerServiceProvider(new Utilities()); } \ No newline at end of file diff --git a/src/469608a8-72ba-4bad-8233-80a4127c72a8/settings.json b/src/469608a8-72ba-4bad-8233-80a4127c72a8/settings.json index e0ef279..19b000e 100644 --- a/src/469608a8-72ba-4bad-8233-80a4127c72a8/settings.json +++ b/src/469608a8-72ba-4bad-8233-80a4127c72a8/settings.json @@ -39,6 +39,18 @@ "use_selection6": { "use": "6edf0cf3-c2b0-45c9-84d2-c6ef1c5d434c", "as": "GiteaUtilities" + }, + "use_selection9": { + "use": "3c7567d7-b079-4910-b325-7ed5c30cabff", + "as": "default" + }, + "use_selection8": { + "use": "156f449b-ca6c-4a57-a925-be345e751614", + "as": "default" + }, + "use_selection7": { + "use": "facd1e1c-ff2f-4520-b735-075c45aa55ed", + "as": "default" } }, "extendsinterfaces": null, diff --git a/src/4adfb171-2580-4d57-8fbb-fb92cfd11046/code.php b/src/4adfb171-2580-4d57-8fbb-fb92cfd11046/code.php index 669f522..19873bb 100644 --- a/src/4adfb171-2580-4d57-8fbb-fb92cfd11046/code.php +++ b/src/4adfb171-2580-4d57-8fbb-fb92cfd11046/code.php @@ -100,6 +100,7 @@ class Fieldtype implements ServiceProviderInterface { return new Grep( $container->get('Gitea.Repository.Contents'), + $container->get('Network.Resolve'), $container->get('Config')->approved_joomla_paths ); } diff --git a/src/4adfb171-2580-4d57-8fbb-fb92cfd11046/code.power b/src/4adfb171-2580-4d57-8fbb-fb92cfd11046/code.power index c5d644a..10f0fbf 100644 --- a/src/4adfb171-2580-4d57-8fbb-fb92cfd11046/code.power +++ b/src/4adfb171-2580-4d57-8fbb-fb92cfd11046/code.power @@ -68,6 +68,7 @@ { return new Grep( $container->get('Gitea.Repository.Contents'), + $container->get('Network.Resolve'), $container->get('Config')->approved_joomla_paths ); } diff --git a/src/516f93b8-5fff-41c6-aeaf-2d93180a12cc/README.md b/src/516f93b8-5fff-41c6-aeaf-2d93180a12cc/README.md index be1d7e2..0833323 100644 --- a/src/516f93b8-5fff-41c6-aeaf-2d93180a12cc/README.md +++ b/src/516f93b8-5fff-41c6-aeaf-2d93180a12cc/README.md @@ -19,11 +19,14 @@ class Utilities #Gold { + getCounter(Container $container) : Counter + getPaths(Container $container) : Paths + getFiles(Container $container) : Files - + getConstantpaths(Container $container) : Constantpaths + getDynamicpath(Container $container) : Dynamicpath + getPathfix(Container $container) : Pathfix + getStructure(Container $container) : Structure + getXml(Container $container) : Xml + + getConstantpaths(Container $container) : Constantpaths + + getUri(Container $container) : Uri + + getHttp(Container $container) : Http + + getResponse(Container $container) : Response } note right of Utilities::register @@ -75,6 +78,34 @@ note right of Utilities::getFiles return: Files end note +note left of Utilities::getDynamicpath + Get the Compiler Dynamic Path + + since: 3.2.0 + return: Dynamicpath +end note + +note right of Utilities::getPathfix + Get the Compiler Path Fixer + + since: 3.2.0 + return: Pathfix +end note + +note left of Utilities::getStructure + Get the Compiler Structure Dynamic Builder + + since: 3.2.0 + return: Structure +end note + +note right of Utilities::getXml + Get the Compiler Xml Helper + + since: 3.2.0 + return: Xml +end note + note left of Utilities::getConstantpaths Get the Constant Paths @@ -82,32 +113,25 @@ note left of Utilities::getConstantpaths return: Constantpaths end note -note right of Utilities::getDynamicpath - Get the Compiler Dynamic Path +note right of Utilities::getUri + Get The Uri Class. - since: 3.2.0 - return: Dynamicpath + since: 5.0.4 + return: Uri end note -note left of Utilities::getPathfix - Get the Compiler Path Fixer +note left of Utilities::getHttp + Get The Http Class. - since: 3.2.0 - return: Pathfix + since: 5.0.4 + return: Http end note -note right of Utilities::getStructure - Get the Compiler Structure Dynamic Builder +note right of Utilities::getResponse + Get The Response Class. - since: 3.2.0 - return: Structure -end note - -note left of Utilities::getXml - Get the Compiler Xml Helper - - since: 3.2.0 - return: Xml + since: 5.0.4 + return: Response end note @enduml diff --git a/src/516f93b8-5fff-41c6-aeaf-2d93180a12cc/code.php b/src/516f93b8-5fff-41c6-aeaf-2d93180a12cc/code.php index bf14861..5d1641f 100644 --- a/src/516f93b8-5fff-41c6-aeaf-2d93180a12cc/code.php +++ b/src/516f93b8-5fff-41c6-aeaf-2d93180a12cc/code.php @@ -21,11 +21,14 @@ use VDM\Joomla\Componentbuilder\Compiler\Utilities\FileInjector; use VDM\Joomla\Componentbuilder\Compiler\Utilities\Paths; use VDM\Joomla\Componentbuilder\Compiler\Utilities\Counter; use VDM\Joomla\Componentbuilder\Compiler\Utilities\Files; -use VDM\Joomla\Componentbuilder\Utilities\Constantpaths; use VDM\Joomla\Componentbuilder\Compiler\Utilities\Dynamicpath; use VDM\Joomla\Componentbuilder\Compiler\Utilities\Pathfix; use VDM\Joomla\Componentbuilder\Compiler\Utilities\Structure; use VDM\Joomla\Componentbuilder\Compiler\Utilities\Xml; +use VDM\Joomla\Componentbuilder\Utilities\Constantpaths; +use VDM\Joomla\Componentbuilder\Utilities\Uri; +use VDM\Joomla\Componentbuilder\Utilities\Http; +use VDM\Joomla\Componentbuilder\Utilities\Response; /** @@ -41,7 +44,7 @@ class Utilities implements ServiceProviderInterface * @param Container $container The DI container. * * @return void - * @since 3.2.0 + * @since 3.2.0 */ public function register(Container $container) { @@ -63,9 +66,6 @@ class Utilities implements ServiceProviderInterface $container->alias(Files::class, 'Utilities.Files') ->share('Utilities.Files', [$this, 'getFiles'], true); - $container->alias(Constantpaths::class, 'Utilities.Constantpaths') - ->share('Utilities.Constantpaths', [$this, 'getConstantpaths'], true); - $container->alias(Dynamicpath::class, 'Utilities.Dynamicpath') ->share('Utilities.Dynamicpath', [$this, 'getDynamicpath'], true); @@ -77,6 +77,18 @@ class Utilities implements ServiceProviderInterface $container->alias(Xml::class, 'Utilities.Xml') ->share('Utilities.Xml', [$this, 'getXml'], true); + + $container->alias(Constantpaths::class, 'Utilities.Constantpaths') + ->share('Utilities.Constantpaths', [$this, 'getConstantpaths'], true); + + $container->alias(Uri::class, 'Utilities.Uri') + ->share('Utilities.Uri', [$this, 'getUri'], true); + + $container->alias(Http::class, 'Utilities.Http') + ->share('Utilities.Http', [$this, 'getHttp'], true); + + $container->alias(Response::class, 'Utilities.Response') + ->share('Utilities.Response', [$this, 'getResponse'], true); } /** @@ -85,7 +97,7 @@ class Utilities implements ServiceProviderInterface * @param Container $container The DI container. * * @return Folder - * @since 3.2.0 + * @since 3.2.0 */ public function getFolder(Container $container): Folder { @@ -101,7 +113,7 @@ class Utilities implements ServiceProviderInterface * @param Container $container The DI container. * * @return File - * @since 3.2.0 + * @since 3.2.0 */ public function getFile(Container $container): File { @@ -116,7 +128,7 @@ class Utilities implements ServiceProviderInterface * @param Container $container The DI container. * * @return FileInjector - * @since 3.2.0 + * @since 3.2.0 */ public function getFileInjector(Container $container): FileInjector { @@ -132,7 +144,7 @@ class Utilities implements ServiceProviderInterface * @param Container $container The DI container. * * @return Counter - * @since 3.2.0 + * @since 3.2.0 */ public function getCounter(Container $container): Counter { @@ -147,7 +159,7 @@ class Utilities implements ServiceProviderInterface * @param Container $container The DI container. * * @return Paths - * @since 3.2.0 + * @since 3.2.0 */ public function getPaths(Container $container): Paths { @@ -163,33 +175,20 @@ class Utilities implements ServiceProviderInterface * @param Container $container The DI container. * * @return Files - * @since 3.2.0 + * @since 3.2.0 */ public function getFiles(Container $container): Files { return new Files(); } - /** - * Get the Constant Paths - * - * @param Container $container The DI container. - * - * @return Constantpaths - * @since 3.2.0 - */ - public function getConstantpaths(Container $container): Constantpaths - { - return new Constantpaths(); - } - /** * Get the Compiler Dynamic Path * * @param Container $container The DI container. * * @return Dynamicpath - * @since 3.2.0 + * @since 3.2.0 */ public function getDynamicpath(Container $container): Dynamicpath { @@ -205,7 +204,7 @@ class Utilities implements ServiceProviderInterface * @param Container $container The DI container. * * @return Pathfix - * @since 3.2.0 + * @since 3.2.0 */ public function getPathfix(Container $container): Pathfix { @@ -218,7 +217,7 @@ class Utilities implements ServiceProviderInterface * @param Container $container The DI container. * * @return Structure - * @since 3.2.0 + * @since 3.2.0 */ public function getStructure(Container $container): Structure { @@ -238,13 +237,65 @@ class Utilities implements ServiceProviderInterface * @param Container $container The DI container. * * @return Xml - * @since 3.2.0 + * @since 3.2.0 */ public function getXml(Container $container): Xml { return new Xml( $container->get('Config') ); + } + + /** + * Get the Constant Paths + * + * @param Container $container The DI container. + * + * @return Constantpaths + * @since 3.2.0 + */ + public function getConstantpaths(Container $container): Constantpaths + { + return new Constantpaths(); + } + + /** + * Get The Uri Class. + * + * @param Container $container The DI container. + * + * @return Uri + * @since 5.0.4 + */ + public function getUri(Container $container): Uri + { + return new Uri(); + } + + /** + * Get The Http Class. + * + * @param Container $container The DI container. + * + * @return Http + * @since 5.0.4 + */ + public function getHttp(Container $container): Http + { + return new Http(); + } + + /** + * Get The Response Class. + * + * @param Container $container The DI container. + * + * @return Response + * @since 5.0.4 + */ + public function getResponse(Container $container): Response + { + return new Response(); } } diff --git a/src/516f93b8-5fff-41c6-aeaf-2d93180a12cc/code.power b/src/516f93b8-5fff-41c6-aeaf-2d93180a12cc/code.power index 3ec4950..843edec 100644 --- a/src/516f93b8-5fff-41c6-aeaf-2d93180a12cc/code.power +++ b/src/516f93b8-5fff-41c6-aeaf-2d93180a12cc/code.power @@ -4,7 +4,7 @@ * @param Container $container The DI container. * * @return void - * @since 3.2.0 + * @since 3.2.0 */ public function register(Container $container) { @@ -26,9 +26,6 @@ $container->alias(Files::class, 'Utilities.Files') ->share('Utilities.Files', [$this, 'getFiles'], true); - $container->alias(Constantpaths::class, 'Utilities.Constantpaths') - ->share('Utilities.Constantpaths', [$this, 'getConstantpaths'], true); - $container->alias(Dynamicpath::class, 'Utilities.Dynamicpath') ->share('Utilities.Dynamicpath', [$this, 'getDynamicpath'], true); @@ -40,6 +37,18 @@ $container->alias(Xml::class, 'Utilities.Xml') ->share('Utilities.Xml', [$this, 'getXml'], true); + + $container->alias(Constantpaths::class, 'Utilities.Constantpaths') + ->share('Utilities.Constantpaths', [$this, 'getConstantpaths'], true); + + $container->alias(Uri::class, 'Utilities.Uri') + ->share('Utilities.Uri', [$this, 'getUri'], true); + + $container->alias(Http::class, 'Utilities.Http') + ->share('Utilities.Http', [$this, 'getHttp'], true); + + $container->alias(Response::class, 'Utilities.Response') + ->share('Utilities.Response', [$this, 'getResponse'], true); } /** @@ -48,7 +57,7 @@ * @param Container $container The DI container. * * @return Folder - * @since 3.2.0 + * @since 3.2.0 */ public function getFolder(Container $container): Folder { @@ -64,7 +73,7 @@ * @param Container $container The DI container. * * @return File - * @since 3.2.0 + * @since 3.2.0 */ public function getFile(Container $container): File { @@ -79,7 +88,7 @@ * @param Container $container The DI container. * * @return FileInjector - * @since 3.2.0 + * @since 3.2.0 */ public function getFileInjector(Container $container): FileInjector { @@ -95,7 +104,7 @@ * @param Container $container The DI container. * * @return Counter - * @since 3.2.0 + * @since 3.2.0 */ public function getCounter(Container $container): Counter { @@ -110,7 +119,7 @@ * @param Container $container The DI container. * * @return Paths - * @since 3.2.0 + * @since 3.2.0 */ public function getPaths(Container $container): Paths { @@ -126,33 +135,20 @@ * @param Container $container The DI container. * * @return Files - * @since 3.2.0 + * @since 3.2.0 */ public function getFiles(Container $container): Files { return new Files(); } - /** - * Get the Constant Paths - * - * @param Container $container The DI container. - * - * @return Constantpaths - * @since 3.2.0 - */ - public function getConstantpaths(Container $container): Constantpaths - { - return new Constantpaths(); - } - /** * Get the Compiler Dynamic Path * * @param Container $container The DI container. * * @return Dynamicpath - * @since 3.2.0 + * @since 3.2.0 */ public function getDynamicpath(Container $container): Dynamicpath { @@ -168,7 +164,7 @@ * @param Container $container The DI container. * * @return Pathfix - * @since 3.2.0 + * @since 3.2.0 */ public function getPathfix(Container $container): Pathfix { @@ -181,7 +177,7 @@ * @param Container $container The DI container. * * @return Structure - * @since 3.2.0 + * @since 3.2.0 */ public function getStructure(Container $container): Structure { @@ -201,11 +197,63 @@ * @param Container $container The DI container. * * @return Xml - * @since 3.2.0 + * @since 3.2.0 */ public function getXml(Container $container): Xml { return new Xml( $container->get('Config') ); + } + + /** + * Get the Constant Paths + * + * @param Container $container The DI container. + * + * @return Constantpaths + * @since 3.2.0 + */ + public function getConstantpaths(Container $container): Constantpaths + { + return new Constantpaths(); + } + + /** + * Get The Uri Class. + * + * @param Container $container The DI container. + * + * @return Uri + * @since 5.0.4 + */ + public function getUri(Container $container): Uri + { + return new Uri(); + } + + /** + * Get The Http Class. + * + * @param Container $container The DI container. + * + * @return Http + * @since 5.0.4 + */ + public function getHttp(Container $container): Http + { + return new Http(); + } + + /** + * Get The Response Class. + * + * @param Container $container The DI container. + * + * @return Response + * @since 5.0.4 + */ + public function getResponse(Container $container): Response + { + return new Response(); } \ No newline at end of file diff --git a/src/516f93b8-5fff-41c6-aeaf-2d93180a12cc/settings.json b/src/516f93b8-5fff-41c6-aeaf-2d93180a12cc/settings.json index 99e2cf8..562e6a4 100644 --- a/src/516f93b8-5fff-41c6-aeaf-2d93180a12cc/settings.json +++ b/src/516f93b8-5fff-41c6-aeaf-2d93180a12cc/settings.json @@ -41,24 +41,36 @@ "as": "default" }, "use_selection7": { - "use": "e0c8c931-52a0-4171-9909-e8769505bb1f", - "as": "default" - }, - "use_selection8": { "use": "268b85ef-49f3-4c39-8187-bb12e38d19ee", "as": "default" }, - "use_selection9": { + "use_selection8": { "use": "cdc9b06d-8333-4fa7-ab4d-b810dd90f95f", "as": "default" }, - "use_selection10": { + "use_selection9": { "use": "1efdded5-d6c8-452c-8f37-0374483a7b3f", "as": "default" }, - "use_selection11": { + "use_selection10": { "use": "f6ba34a2-0cd7-4dc1-ab67-75e962a5045b", "as": "default" + }, + "use_selection11": { + "use": "e0c8c931-52a0-4171-9909-e8769505bb1f", + "as": "default" + }, + "use_selection12": { + "use": "1c5bf656-f73a-46ec-bb9d-aa3932d5b3de", + "as": "default" + }, + "use_selection13": { + "use": "d9ee00d6-eeed-4fc4-af8a-7b5547f508ba", + "as": "default" + }, + "use_selection14": { + "use": "c99e85a0-d120-4f25-bcbf-0940dd7b773b", + "as": "default" } }, "extendsinterfaces": null, diff --git a/src/55278140-80d5-4168-8241-d64515c4b35e/README.md b/src/55278140-80d5-4168-8241-d64515c4b35e/README.md index 2b5a82f..48970d6 100644 --- a/src/55278140-80d5-4168-8241-d64515c4b35e/README.md +++ b/src/55278140-80d5-4168-8241-d64515c4b35e/README.md @@ -63,6 +63,7 @@ class Builders << (F,LightGreen) >> #RoyalBlue { + __construct(Config $config, Power $power, ...) + set(string $langLabel, string $langView, ...) : void - normalizeDatabaseValues(string $nameSingleCode, string $name, ...) : ?array + - setLinkerRelations(array $link) : ?array } note right of Builders::__construct @@ -155,6 +156,16 @@ to types based on the 'length' field. It removes unnecessary fields from the res string $uniquekey string $iskey end note + +note right of Builders::setLinkerRelations + Sets the linker relations for a field based on the provided link data. +The method determines the type of link relation based on the presence of a table. +If no table is provided, it assigns a type 2 with a null table, otherwise it assigns type 1. +It also extracts additional values from the input array, such as component, entity, value, and key. + + since: 5.0.3 + return: ?array +end note @enduml ``` diff --git a/src/55278140-80d5-4168-8241-d64515c4b35e/code.php b/src/55278140-80d5-4168-8241-d64515c4b35e/code.php index ec5b422..b8e655f 100644 --- a/src/55278140-80d5-4168-8241-d64515c4b35e/code.php +++ b/src/55278140-80d5-4168-8241-d64515c4b35e/code.php @@ -1306,7 +1306,8 @@ final class Builders 'list' => $nameListCode, 'store' => (isset($field['store'])) ? $field['store'] : null, 'tab_name' => $tabName, - 'db' => $this->normalizeDatabaseValues($nameSingleCode, $name, $databaseuniquekey, $databasekey) + 'db' => $this->normalizeDatabaseValues($nameSingleCode, $name, $databaseuniquekey, $databasekey), + 'link' => $this->setLinkerRelations($custom ?? []) ] ); } @@ -1360,6 +1361,37 @@ final class Builders unset($db_values['ID'], $db_values['lenght'], $db_values['lenght_other'], $db_values['other']); return $db_values; + } + + /** + * Sets the linker relations for a field based on the provided link data. + * + * The method determines the type of link relation based on the presence of a table. + * If no table is provided, it assigns a type 2 with a null table, otherwise it assigns type 1. + * It also extracts additional values from the input array, such as component, entity, value, and key. + * + * @param array $link The link data which may contain 'table', 'component', 'view', 'text', and 'id'. + * + * @return array|null The structured linker relation array, or null if input is an empty array. + * @since 5.0.3 + */ + private function setLinkerRelations(array $link): ?array + { + if ($link === []) + { + return null; + } + + $linker = [ + 'type' => empty($link['table']) ? 2 : 1, + 'table' => $link['table'] ?? null, + 'component' => $link['component'] ?? null, + 'entity' => $link['view'] ?? null, + 'value' => $link['text'] ?? null, + 'key' => $link['id'] ?? null + ]; + + return $linker; } } diff --git a/src/55278140-80d5-4168-8241-d64515c4b35e/code.power b/src/55278140-80d5-4168-8241-d64515c4b35e/code.power index 0f18c2a..8feb984 100644 --- a/src/55278140-80d5-4168-8241-d64515c4b35e/code.power +++ b/src/55278140-80d5-4168-8241-d64515c4b35e/code.power @@ -1229,7 +1229,8 @@ 'list' => $nameListCode, 'store' => (isset($field['store'])) ? $field['store'] : null, 'tab_name' => $tabName, - 'db' => $this->normalizeDatabaseValues($nameSingleCode, $name, $databaseuniquekey, $databasekey) + 'db' => $this->normalizeDatabaseValues($nameSingleCode, $name, $databaseuniquekey, $databasekey), + 'link' => $this->setLinkerRelations($custom ?? []) ] ); } @@ -1283,4 +1284,35 @@ unset($db_values['ID'], $db_values['lenght'], $db_values['lenght_other'], $db_values['other']); return $db_values; + } + + /** + * Sets the linker relations for a field based on the provided link data. + * + * The method determines the type of link relation based on the presence of a table. + * If no table is provided, it assigns a type 2 with a null table, otherwise it assigns type 1. + * It also extracts additional values from the input array, such as component, entity, value, and key. + * + * @param array $link The link data which may contain 'table', 'component', 'view', 'text', and 'id'. + * + * @return array|null The structured linker relation array, or null if input is an empty array. + * @since 5.0.3 + */ + private function setLinkerRelations(array $link): ?array + { + if ($link === []) + { + return null; + } + + $linker = [ + 'type' => empty($link['table']) ? 2 : 1, + 'table' => $link['table'] ?? null, + 'component' => $link['component'] ?? null, + 'entity' => $link['view'] ?? null, + 'value' => $link['text'] ?? null, + 'key' => $link['id'] ?? null + ]; + + return $linker; } \ No newline at end of file diff --git a/src/5716c79f-a1c9-4059-9d00-8cccb9f9e061/code.php b/src/5716c79f-a1c9-4059-9d00-8cccb9f9e061/code.php index d6c5964..e8cac51 100644 --- a/src/5716c79f-a1c9-4059-9d00-8cccb9f9e061/code.php +++ b/src/5716c79f-a1c9-4059-9d00-8cccb9f9e061/code.php @@ -101,6 +101,7 @@ class JoomlaPower implements ServiceProviderInterface { return new Grep( $container->get('Gitea.Repository.Contents'), + $container->get('Network.Resolve'), $container->get('Config')->approved_joomla_paths ); } diff --git a/src/5716c79f-a1c9-4059-9d00-8cccb9f9e061/code.power b/src/5716c79f-a1c9-4059-9d00-8cccb9f9e061/code.power index d149e62..f442afa 100644 --- a/src/5716c79f-a1c9-4059-9d00-8cccb9f9e061/code.power +++ b/src/5716c79f-a1c9-4059-9d00-8cccb9f9e061/code.power @@ -71,6 +71,7 @@ { return new Grep( $container->get('Gitea.Repository.Contents'), + $container->get('Network.Resolve'), $container->get('Config')->approved_joomla_paths ); } diff --git a/src/6784dd52-0909-451a-a872-9a942a023c68/code.php b/src/6784dd52-0909-451a-a872-9a942a023c68/code.php index 2b93cdd..53ad475 100644 --- a/src/6784dd52-0909-451a-a872-9a942a023c68/code.php +++ b/src/6784dd52-0909-451a-a872-9a942a023c68/code.php @@ -131,7 +131,7 @@ final class Grep extends ExtendingGrep implements GrepInterface $branch = $this->getBranchName($path); // load the base and token if set - $this->contents->load_($path->base ?? null, $path->token ?? null); + $this->loadApi($this->contents, $path->base ?? null, $path->token ?? null); // get the settings if (($power = $this->loadRemoteFile($path->organisation, $path->repository, $path->index->{$guid}->settings, $branch)) !== null && diff --git a/src/6784dd52-0909-451a-a872-9a942a023c68/code.power b/src/6784dd52-0909-451a-a872-9a942a023c68/code.power index 44d8b96..82effc9 100644 --- a/src/6784dd52-0909-451a-a872-9a942a023c68/code.power +++ b/src/6784dd52-0909-451a-a872-9a942a023c68/code.power @@ -98,7 +98,7 @@ $branch = $this->getBranchName($path); // load the base and token if set - $this->contents->load_($path->base ?? null, $path->token ?? null); + $this->loadApi($this->contents, $path->base ?? null, $path->token ?? null); // get the settings if (($power = $this->loadRemoteFile($path->organisation, $path->repository, $path->index->{$guid}->settings, $branch)) !== null && diff --git a/src/6ee3dc9e-1949-4da5-a74f-d9eb7f14e400/code.php b/src/6ee3dc9e-1949-4da5-a74f-d9eb7f14e400/code.php index 0ced368..3b12dca 100644 --- a/src/6ee3dc9e-1949-4da5-a74f-d9eb7f14e400/code.php +++ b/src/6ee3dc9e-1949-4da5-a74f-d9eb7f14e400/code.php @@ -20,6 +20,9 @@ use VDM\Joomla\Service\Data; use VDM\Joomla\Componentbuilder\Service\Gitea; use VDM\Joomla\Componentbuilder\Power\Service\Gitea as GiteaPower; use VDM\Joomla\Gitea\Service\Utilities as GiteaUtilities; +use VDM\Joomla\Componentbuilder\Service\Network; +use VDM\Joomla\Componentbuilder\Service\Api; +use VDM\Joomla\Componentbuilder\Service\Utilities; use VDM\Joomla\Interfaces\FactoryInterface; use VDM\Joomla\Abstraction\Factory as ExtendingFactory; @@ -54,7 +57,10 @@ abstract class Factory extends ExtendingFactory implements FactoryInterface ->registerServiceProvider(new Data()) ->registerServiceProvider(new Gitea()) ->registerServiceProvider(new GiteaPower()) - ->registerServiceProvider(new GiteaUtilities()); + ->registerServiceProvider(new GiteaUtilities()) + ->registerServiceProvider(new Network()) + ->registerServiceProvider(new Api()) + ->registerServiceProvider(new Utilities()); } } diff --git a/src/6ee3dc9e-1949-4da5-a74f-d9eb7f14e400/code.power b/src/6ee3dc9e-1949-4da5-a74f-d9eb7f14e400/code.power index ed21fa6..f9eaa34 100644 --- a/src/6ee3dc9e-1949-4da5-a74f-d9eb7f14e400/code.power +++ b/src/6ee3dc9e-1949-4da5-a74f-d9eb7f14e400/code.power @@ -21,5 +21,8 @@ ->registerServiceProvider(new Data()) ->registerServiceProvider(new Gitea()) ->registerServiceProvider(new GiteaPower()) - ->registerServiceProvider(new GiteaUtilities()); + ->registerServiceProvider(new GiteaUtilities()) + ->registerServiceProvider(new Network()) + ->registerServiceProvider(new Api()) + ->registerServiceProvider(new Utilities()); } \ No newline at end of file diff --git a/src/6ee3dc9e-1949-4da5-a74f-d9eb7f14e400/settings.json b/src/6ee3dc9e-1949-4da5-a74f-d9eb7f14e400/settings.json index 496ee03..1de4627 100644 --- a/src/6ee3dc9e-1949-4da5-a74f-d9eb7f14e400/settings.json +++ b/src/6ee3dc9e-1949-4da5-a74f-d9eb7f14e400/settings.json @@ -39,6 +39,18 @@ "use_selection6": { "use": "6edf0cf3-c2b0-45c9-84d2-c6ef1c5d434c", "as": "GiteaUtilities" + }, + "use_selection7": { + "use": "156f449b-ca6c-4a57-a925-be345e751614", + "as": "default" + }, + "use_selection8": { + "use": "3c7567d7-b079-4910-b325-7ed5c30cabff", + "as": "default" + }, + "use_selection9": { + "use": "facd1e1c-ff2f-4520-b735-075c45aa55ed", + "as": "default" } }, "extendsinterfaces": null, diff --git a/src/6f20369a-8536-4870-a1a3-cda254c939c8/code.php b/src/6f20369a-8536-4870-a1a3-cda254c939c8/code.php index f4a7104..f92aa5c 100644 --- a/src/6f20369a-8536-4870-a1a3-cda254c939c8/code.php +++ b/src/6f20369a-8536-4870-a1a3-cda254c939c8/code.php @@ -75,13 +75,13 @@ class Paths extends Registry /** * getting any valid paths * - * @param string $key The value's key/path name + * @param string $key The value's key/path name * * @return string The path found as a string * @since 3.2.0 * @throws \InvalidArgumentException If $key is not a valid function name. */ - public function __get(string $key): string + public function __get($key) { // check if it has been set if ($this->exists($key)) diff --git a/src/6f20369a-8536-4870-a1a3-cda254c939c8/code.power b/src/6f20369a-8536-4870-a1a3-cda254c939c8/code.power index eecb12f..5380bab 100644 --- a/src/6f20369a-8536-4870-a1a3-cda254c939c8/code.power +++ b/src/6f20369a-8536-4870-a1a3-cda254c939c8/code.power @@ -49,13 +49,13 @@ /** * getting any valid paths * - * @param string $key The value's key/path name + * @param string $key The value's key/path name * * @return string The path found as a string * @since 3.2.0 * @throws \InvalidArgumentException If $key is not a valid function name. */ - public function __get(string $key): string + public function __get($key) { // check if it has been set if ($this->exists($key)) diff --git a/src/809d3077-c105-4e9c-8ac5-8fbee10cf9fc/README.md b/src/809d3077-c105-4e9c-8ac5-8fbee10cf9fc/README.md new file mode 100644 index 0000000..61fc1c3 --- /dev/null +++ b/src/809d3077-c105-4e9c-8ac5-8fbee10cf9fc/README.md @@ -0,0 +1,119 @@ +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# final class Status (Details) +> namespace: **VDM\Joomla\Componentbuilder\Network** + +```uml +@startuml +class Status << (F,LightGreen) >> #RoyalBlue { + # Network $network + # Core $core + # Url $url + + __construct(Network $network, Core $core, ...) + + get(string $target, string $domain, ...) : int + + active(string $target, ?array $excludeDomains = ['git.vdm.dev']) : ?object + + network(string $target, ?string $domain = null, ...) : ?object + - getDomainData(array $network, string $domain, ...) : ?object + - fetchNetworkData(string $target) : object +} + +note right of Status::__construct + Constructor. + + since: 5.0.4 + + arguments: + Network $network + Core $core + Url $url +end note + +note right of Status::get + Retrieves the status for the given network target, utilizing caching via the Core registry. + + since: 5.0.4 + return: int + + arguments: + string $target + string $domain + string $repository + string $organization = 'joomla' +end note + +note right of Status::active + Retrieves a random active repository target, excluding the specified domain. + + since: 5.0.4 + return: ?object +end note + +note right of Status::network + Retrieves the data for the given network target, utilizing caching via the Core registry. +If the data for the target is already cached in the Core registry, it returns that data. +Otherwise, it fetches the data from the Network, caches it, and returns it. + + since: 5.0.4 + return: ?object + + arguments: + string $target + ?string $domain = null + ?string $organization = null + ?string $repository +end note + +note right of Status::getDomainData + Retrieves the data filtered by domain, organization, and optionally repository. + + since: 5.0.4 + return: ?object + + arguments: + array $network + string $domain + ?string $organization = null + ?string $repository = null +end note + +note right of Status::fetchNetworkData + Fetches and caches the network data for a given target. + + since: 5.0.4 + return: object +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---809d3077_c105_4e9c_8ac5_8fbee10cf9fc---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) + diff --git a/src/809d3077-c105-4e9c-8ac5-8fbee10cf9fc/code.php b/src/809d3077-c105-4e9c-8ac5-8fbee10cf9fc/code.php new file mode 100644 index 0000000..abce673 --- /dev/null +++ b/src/809d3077-c105-4e9c-8ac5-8fbee10cf9fc/code.php @@ -0,0 +1,258 @@ + + * @git 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\Api\Network; +use VDM\Joomla\Componentbuilder\Network\Core; +use VDM\Joomla\Componentbuilder\Network\Url; + + +/** + * The Network Status + * + * @since 5.0.4 + */ +final class Status +{ + /** + * The Network Class. + * + * @var Network + * @since 5.0.4 + */ + protected Network $network; + + /** + * The Core Class. + * + * @var Core + * @since 5.0.4 + */ + protected Core $core; + + /** + * The Url Class. + * + * @var Url + * @since 5.0.4 + */ + protected Url $url; + + /** + * Constructor. + * + * @param Network $network The Network Class. + * @param Core $core The Core Class. + * @param Url $url The Url Class. + * + * @since 5.0.4 + */ + public function __construct(Network $network, Core $core, Url $url) + { + $this->network = $network; + $this->core = $core; + $this->url = $url; + } + + /** + * Retrieves the status for the given network target, utilizing caching via the Core registry. + * + * @param string $target The target network. + * @param string $domain The domain to retrieve [example: codeberg.org]. + * @param string $repository The repository name. + * @param string $organization The target repository organization. (default: joomla) + * + * @return int Will return 1 if active, 0 if not, and -1 if not part of the core. + * + * @since 5.0.4 + */ + public function get(string $target, string $domain, string $repository, string $organization = 'joomla'): int + { + try { + $repo = $this->network($target, $repository, $organization, $domain); + + if ($repo === null) + { + // Domain not found in the network data + return -1; + } + + // Check if the repository is active + if (isset($repo->status) && is_numeric($repo->status)) + { + return (int) $repo->status; + } + else + { + // 'status' property not found or not numeric + return -1; + } + } + catch (\Exception $e) + { + // In case of any exception, return -1 + return -1; + } + } + + /** + * Retrieves a random active repository target, excluding the specified domain. + * + * @param string $target The target network name. + * @param array|null $excludeDomains The domain to exclude [default: ['git.vdm.dev']]. + * + * @return object|null The randomly selected active repository, or null if none found. + * @since 5.0.4 + */ + public function active(string $target, ?array $excludeDomains = ['git.vdm.dev']): ?object + { + try { + // Get the network data for the target + $data = $this->network($target); + + // Filter active repositories excluding the specified domain + $activeRepos = array_filter($data->network, function ($repo) use ($excludeDomains) { + $parsed = $this->url->parse($repo->url); + return isset($repo->status) && + $repo->status == 1 && + !in_array($parsed->domain, $excludeDomains); + }); + + // Reindex the array to ensure array_rand works correctly + $activeRepos = array_values($activeRepos); + + // If there are active repositories, select one at random + if (!empty($activeRepos)) + { + return $activeRepos[array_rand($activeRepos)]; + } + else + { + // No active repositories found excluding the specified domain + return null; + } + } + catch (\Exception $e) + { + // In case of any exception, return null + return null; + } + } + + /** + * Retrieves the data for the given network target, utilizing caching via the Core registry. + * + * If the data for the target is already cached in the Core registry, it returns that data. + * Otherwise, it fetches the data from the Network, caches it, and returns it. + * + * @param string $target The target network name. + * @param string|null $domain The domain to retrieve [example: codeberg.org]. + * @param string|null $organization The target repository organization. + * @param string|null $repository The repository name. + * + * @return object|null The data retrieved for the target. + * @throws \Exception If an error occurs during the network call or if the result contains an 'error' key. + * @since 5.0.4 + */ + public function network(string $target, ?string $domain = null, ?string $organization = null, ?string $repository): ?object + { + $networkData = $this->fetchNetworkData($target); + + if ($domain !== null) + { + return $this->getDomainData($networkData->network, $domain, $organization, $repository); + } + + return $networkData; + } + + /** + * Retrieves the data filtered by domain, organization, and optionally repository. + * + * @param array $network The network data array. + * @param string $domain The domain to filter by. + * @param string|null $organization The organization to filter by. + * @param string|null $repository The repository to filter by. + * + * @return object|null The filtered data, or null if no match is found. + * @since 5.0.4 + */ + private function getDomainData(array $network, string $domain, ?string $organization = null, ?string $repository = null): ?object + { + $domainBase = $this->url->base($domain); + + foreach ($network as $repo) + { + $parsedUrl = $this->url->parse($repo->url); + + if ($parsedUrl->domain === $domainBase) + { + if ($organization !== null && $parsedUrl->organization !== $organization) + { + continue; + } + + if ($repository !== null && $parsedUrl->repository !== $repository) + { + continue; + } + + return $repo; + } + } + + return null; + } + + /** + * Fetches and caches the network data for a given target. + * + * @param string $target The target network name. + * + * @return object The cached or freshly fetched network data. + * @throws \Exception If an error occurs during the network call. + * @since 5.0.4 + */ + private function fetchNetworkData(string $target): object + { + // Check if data is cached + if (($cachedData = $this->core->get($target)) !== null) + { + return $cachedData; + } + + try { + // Fetch data from the network + $networkData = $this->network->get($target); + } catch (\Exception $e) { + throw new \Exception('Network error: ' . $e->getMessage(), 0, $e); + } + + // Validate the fetched data + if (!is_object($networkData) || !property_exists($networkData, 'network')) + { + throw new \Exception('Invalid network data: Missing "network" property.'); + } + + if (property_exists($networkData, 'error')) + { + throw new \Exception('Network error: ' . $networkData->error); + } + + // Cache the result + $this->core->set($target, $networkData); + + return $networkData; + } +} + diff --git a/src/809d3077-c105-4e9c-8ac5-8fbee10cf9fc/code.power b/src/809d3077-c105-4e9c-8ac5-8fbee10cf9fc/code.power new file mode 100644 index 0000000..ae91544 --- /dev/null +++ b/src/809d3077-c105-4e9c-8ac5-8fbee10cf9fc/code.power @@ -0,0 +1,230 @@ + /** + * The Network Class. + * + * @var Network + * @since 5.0.4 + */ + protected Network $network; + + /** + * The Core Class. + * + * @var Core + * @since 5.0.4 + */ + protected Core $core; + + /** + * The Url Class. + * + * @var Url + * @since 5.0.4 + */ + protected Url $url; + + /** + * Constructor. + * + * @param Network $network The Network Class. + * @param Core $core The Core Class. + * @param Url $url The Url Class. + * + * @since 5.0.4 + */ + public function __construct(Network $network, Core $core, Url $url) + { + $this->network = $network; + $this->core = $core; + $this->url = $url; + } + + /** + * Retrieves the status for the given network target, utilizing caching via the Core registry. + * + * @param string $target The target network. + * @param string $domain The domain to retrieve [example: codeberg.org]. + * @param string $repository The repository name. + * @param string $organization The target repository organization. (default: joomla) + * + * @return int Will return 1 if active, 0 if not, and -1 if not part of the core. + * + * @since 5.0.4 + */ + public function get(string $target, string $domain, string $repository, string $organization = 'joomla'): int + { + try { + $repo = $this->network($target, $repository, $organization, $domain); + + if ($repo === null) + { + // Domain not found in the network data + return -1; + } + + // Check if the repository is active + if (isset($repo->status) && is_numeric($repo->status)) + { + return (int) $repo->status; + } + else + { + // 'status' property not found or not numeric + return -1; + } + } + catch (\Exception $e) + { + // In case of any exception, return -1 + return -1; + } + } + + /** + * Retrieves a random active repository target, excluding the specified domain. + * + * @param string $target The target network name. + * @param array|null $excludeDomains The domain to exclude [default: ['git.vdm.dev']]. + * + * @return object|null The randomly selected active repository, or null if none found. + * @since 5.0.4 + */ + public function active(string $target, ?array $excludeDomains = ['git.vdm.dev']): ?object + { + try { + // Get the network data for the target + $data = $this->network($target); + + // Filter active repositories excluding the specified domain + $activeRepos = array_filter($data->network, function ($repo) use ($excludeDomains) { + $parsed = $this->url->parse($repo->url); + return isset($repo->status) && + $repo->status == 1 && + !in_array($parsed->domain, $excludeDomains); + }); + + // Reindex the array to ensure array_rand works correctly + $activeRepos = array_values($activeRepos); + + // If there are active repositories, select one at random + if (!empty($activeRepos)) + { + return $activeRepos[array_rand($activeRepos)]; + } + else + { + // No active repositories found excluding the specified domain + return null; + } + } + catch (\Exception $e) + { + // In case of any exception, return null + return null; + } + } + + /** + * Retrieves the data for the given network target, utilizing caching via the Core registry. + * + * If the data for the target is already cached in the Core registry, it returns that data. + * Otherwise, it fetches the data from the Network, caches it, and returns it. + * + * @param string $target The target network name. + * @param string|null $domain The domain to retrieve [example: codeberg.org]. + * @param string|null $organization The target repository organization. + * @param string|null $repository The repository name. + * + * @return object|null The data retrieved for the target. + * @throws \Exception If an error occurs during the network call or if the result contains an 'error' key. + * @since 5.0.4 + */ + public function network(string $target, ?string $domain = null, ?string $organization = null, ?string $repository): ?object + { + $networkData = $this->fetchNetworkData($target); + + if ($domain !== null) + { + return $this->getDomainData($networkData->network, $domain, $organization, $repository); + } + + return $networkData; + } + + /** + * Retrieves the data filtered by domain, organization, and optionally repository. + * + * @param array $network The network data array. + * @param string $domain The domain to filter by. + * @param string|null $organization The organization to filter by. + * @param string|null $repository The repository to filter by. + * + * @return object|null The filtered data, or null if no match is found. + * @since 5.0.4 + */ + private function getDomainData(array $network, string $domain, ?string $organization = null, ?string $repository = null): ?object + { + $domainBase = $this->url->base($domain); + + foreach ($network as $repo) + { + $parsedUrl = $this->url->parse($repo->url); + + if ($parsedUrl->domain === $domainBase) + { + if ($organization !== null && $parsedUrl->organization !== $organization) + { + continue; + } + + if ($repository !== null && $parsedUrl->repository !== $repository) + { + continue; + } + + return $repo; + } + } + + return null; + } + + /** + * Fetches and caches the network data for a given target. + * + * @param string $target The target network name. + * + * @return object The cached or freshly fetched network data. + * @throws \Exception If an error occurs during the network call. + * @since 5.0.4 + */ + private function fetchNetworkData(string $target): object + { + // Check if data is cached + if (($cachedData = $this->core->get($target)) !== null) + { + return $cachedData; + } + + try { + // Fetch data from the network + $networkData = $this->network->get($target); + } catch (\Exception $e) { + throw new \Exception('Network error: ' . $e->getMessage(), 0, $e); + } + + // Validate the fetched data + if (!is_object($networkData) || !property_exists($networkData, 'network')) + { + throw new \Exception('Invalid network data: Missing "network" property.'); + } + + if (property_exists($networkData, 'error')) + { + throw new \Exception('Network error: ' . $networkData->error); + } + + // Cache the result + $this->core->set($target, $networkData); + + return $networkData; + } \ No newline at end of file diff --git a/src/809d3077-c105-4e9c-8ac5-8fbee10cf9fc/settings.json b/src/809d3077-c105-4e9c-8ac5-8fbee10cf9fc/settings.json new file mode 100644 index 0000000..60d8682 --- /dev/null +++ b/src/809d3077-c105-4e9c-8ac5-8fbee10cf9fc/settings.json @@ -0,0 +1,32 @@ +{ + "add_head": "0", + "add_licensing_template": "2", + "extends": "", + "guid": "809d3077-c105-4e9c-8ac5-8fbee10cf9fc", + "implements": null, + "load_selection": null, + "name": "Status", + "power_version": "1.0.0", + "system_name": "Joomla.JCB.Network.Status", + "type": "final class", + "use_selection": { + "use_selection0": { + "use": "07ca003e-368c-451d-a3d3-ba24e50c7287", + "as": "default" + }, + "use_selection1": { + "use": "825ecce9-72ef-4257-bc32-4b05a4c226e9", + "as": "default" + }, + "use_selection2": { + "use": "286f7550-9c22-401c-9e5a-2f9426888133", + "as": "default" + } + }, + "extendsinterfaces": null, + "namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Network.Status", + "description": "The Network Status\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 \r\n * @git 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": "" +} \ No newline at end of file diff --git a/src/825ecce9-72ef-4257-bc32-4b05a4c226e9/README.md b/src/825ecce9-72ef-4257-bc32-4b05a4c226e9/README.md new file mode 100644 index 0000000..a8ce7ad --- /dev/null +++ b/src/825ecce9-72ef-4257-bc32-4b05a4c226e9/README.md @@ -0,0 +1,46 @@ +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# final class Core (Details) +> namespace: **VDM\Joomla\Componentbuilder\Network** +> extends: **Registry** + +```uml +@startuml +class Core << (F,LightGreen) >> #RoyalBlue { + # ?string $separator +} + +@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---825ecce9_72ef_4257_bc32_4b05a4c226e9---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) + diff --git a/src/825ecce9-72ef-4257-bc32-4b05a4c226e9/code.php b/src/825ecce9-72ef-4257-bc32-4b05a4c226e9/code.php new file mode 100644 index 0000000..e6d58ac --- /dev/null +++ b/src/825ecce9-72ef-4257-bc32-4b05a4c226e9/code.php @@ -0,0 +1,33 @@ + + * @git 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\Abstraction\Registry; + + +/** + * The Network Core + * + * @since 5.0.4 + */ +final class Core extends Registry +{ + /** + * Path separator + * + * @var string|null + * @since 3.2.0 + */ + protected ?string $separator = '|'; +} + diff --git a/src/825ecce9-72ef-4257-bc32-4b05a4c226e9/code.power b/src/825ecce9-72ef-4257-bc32-4b05a4c226e9/code.power new file mode 100644 index 0000000..0825688 --- /dev/null +++ b/src/825ecce9-72ef-4257-bc32-4b05a4c226e9/code.power @@ -0,0 +1,7 @@ + /** + * Path separator + * + * @var string|null + * @since 3.2.0 + */ + protected ?string $separator = '|'; \ No newline at end of file diff --git a/src/825ecce9-72ef-4257-bc32-4b05a4c226e9/settings.json b/src/825ecce9-72ef-4257-bc32-4b05a4c226e9/settings.json new file mode 100644 index 0000000..0667fd2 --- /dev/null +++ b/src/825ecce9-72ef-4257-bc32-4b05a4c226e9/settings.json @@ -0,0 +1,19 @@ +{ + "add_head": "0", + "add_licensing_template": "2", + "extends": "7e822c03-1b20-41d1-9427-f5b8d5836af7", + "guid": "825ecce9-72ef-4257-bc32-4b05a4c226e9", + "implements": null, + "load_selection": null, + "name": "Core", + "power_version": "1.0.0", + "system_name": "Joomla.JCB.Network.Core", + "type": "final class", + "use_selection": null, + "extendsinterfaces": null, + "namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Network.Core", + "description": "The Network Core\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 \r\n * @git 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": "" +} \ No newline at end of file diff --git a/src/9769f3b2-17bf-4f20-b54b-3a4ebe572b36/README.md b/src/85e0b652-21b9-4ff7-ba27-dbd72256f0f2/README.md similarity index 86% rename from src/9769f3b2-17bf-4f20-b54b-3a4ebe572b36/README.md rename to src/85e0b652-21b9-4ff7-ba27-dbd72256f0f2/README.md index 9359acf..0ceddbe 100644 --- a/src/9769f3b2-17bf-4f20-b54b-3a4ebe572b36/README.md +++ b/src/85e0b652-21b9-4ff7-ba27-dbd72256f0f2/README.md @@ -6,22 +6,27 @@ ██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ ╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ ``` -# abstract class BaseConfig (Details) +# abstract class Api (Details) > namespace: **VDM\Joomla\Componentbuilder\Abstraction** -> extends: **ExtendingBaseConfig** ```uml @startuml -abstract BaseConfig #Orange { - # Input $input - # JoomlaRegistry $params - + __construct(?Input $input = null, ?JoomlaRegistry $params = null) +abstract Api #Orange { + # Http $http + # Uri $uri + # Response $response + + __construct(Http $http, Uri $uri, ...) } -note right of BaseConfig::__construct - Constructor +note right of Api::__construct + Constructor. - since: 3.2.0 + since: 5.0.4 + + arguments: + Http $http + Uri $uri + Response $response end note @enduml @@ -37,7 +42,7 @@ To add this specific Power to your project in JCB: > simply use this SPK ``` -Super---9769f3b2_17bf_4f20_b54b_3a4ebe572b36---Power +Super---85e0b652_21b9_4ff7_ba27_dbd72256f0f2---Power ``` > remember to replace the `---` with `___` to activate this Power in your code diff --git a/src/85e0b652-21b9-4ff7-ba27-dbd72256f0f2/code.php b/src/85e0b652-21b9-4ff7-ba27-dbd72256f0f2/code.php new file mode 100644 index 0000000..9db072c --- /dev/null +++ b/src/85e0b652-21b9-4ff7-ba27-dbd72256f0f2/code.php @@ -0,0 +1,67 @@ + + * @git 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\Utilities\Http; +use VDM\Joomla\Componentbuilder\Utilities\Uri; +use VDM\Joomla\Componentbuilder\Utilities\Response; + + +/** + * The Joomla Component Builder Api + * + * @since 5.0.4 + */ +abstract class Api +{ + /** + * The Http Class. + * + * @var Http + * @since 5.0.4 + */ + protected Http $http; + + /** + * The Uri Class. + * + * @var Uri + * @since 5.0.4 + */ + protected Uri $uri; + + /** + * The Response Class. + * + * @var Response + * @since 5.0.4 + */ + protected Response $response; + + /** + * Constructor. + * + * @param Http $http The Http Class. + * @param Uri $uri The Uri Class. + * @param Response $response The Response Class. + * + * @since 5.0.4 + */ + public function __construct(Http $http, Uri $uri, Response $response) + { + $this->http = $http; + $this->uri = $uri; + $this->response = $response; + } +} + diff --git a/src/85e0b652-21b9-4ff7-ba27-dbd72256f0f2/code.power b/src/85e0b652-21b9-4ff7-ba27-dbd72256f0f2/code.power new file mode 100644 index 0000000..e98b10a --- /dev/null +++ b/src/85e0b652-21b9-4ff7-ba27-dbd72256f0f2/code.power @@ -0,0 +1,39 @@ + /** + * The Http Class. + * + * @var Http + * @since 5.0.4 + */ + protected Http $http; + + /** + * The Uri Class. + * + * @var Uri + * @since 5.0.4 + */ + protected Uri $uri; + + /** + * The Response Class. + * + * @var Response + * @since 5.0.4 + */ + protected Response $response; + + /** + * Constructor. + * + * @param Http $http The Http Class. + * @param Uri $uri The Uri Class. + * @param Response $response The Response Class. + * + * @since 5.0.4 + */ + public function __construct(Http $http, Uri $uri, Response $response) + { + $this->http = $http; + $this->uri = $uri; + $this->response = $response; + } \ No newline at end of file diff --git a/src/9769f3b2-17bf-4f20-b54b-3a4ebe572b36/settings.json b/src/85e0b652-21b9-4ff7-ba27-dbd72256f0f2/settings.json similarity index 62% rename from src/9769f3b2-17bf-4f20-b54b-3a4ebe572b36/settings.json rename to src/85e0b652-21b9-4ff7-ba27-dbd72256f0f2/settings.json index a9f331f..6e80da3 100644 --- a/src/9769f3b2-17bf-4f20-b54b-3a4ebe572b36/settings.json +++ b/src/85e0b652-21b9-4ff7-ba27-dbd72256f0f2/settings.json @@ -1,28 +1,32 @@ { - "add_head": "1", + "add_head": "0", "add_licensing_template": "2", - "extends": "ffbd4e1f-a342-4080-ab7d-1de3741bf319", - "guid": "9769f3b2-17bf-4f20-b54b-3a4ebe572b36", + "extends": "", + "guid": "85e0b652-21b9-4ff7-ba27-dbd72256f0f2", "implements": null, "load_selection": null, - "name": "BaseConfig", + "name": "Api", "power_version": "1.0.0", - "system_name": "JCB.Abstraction.BaseConfig", + "system_name": "Joomla.JCB.Abstraction.Api", "type": "abstract class", "use_selection": { + "use_selection0": { + "use": "d9ee00d6-eeed-4fc4-af8a-7b5547f508ba", + "as": "default" + }, "use_selection1": { - "use": "640b5352-fb09-425f-a26e-cd44eda03f15", + "use": "1c5bf656-f73a-46ec-bb9d-aa3932d5b3de", "as": "default" }, "use_selection2": { - "use": "30c5b4c2-f75f-4d15-869a-f8bfedd87358", + "use": "c99e85a0-d120-4f25-bcbf-0940dd7b773b", "as": "default" } }, "extendsinterfaces": null, - "namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Abstraction.BaseConfig", - "description": "Config\r\n\r\n@since 3.2.0", + "namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Abstraction.Api", + "description": "The Joomla Component Builder 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 \r\n * @git 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;\r\nuse Joomla\\Input\\Input;", + "head": "", "composer": "" } \ No newline at end of file diff --git a/src/952423ba-015a-4104-89a4-030695aa4d15/code.php b/src/952423ba-015a-4104-89a4-030695aa4d15/code.php index 37135ac..4a6f20d 100644 --- a/src/952423ba-015a-4104-89a4-030695aa4d15/code.php +++ b/src/952423ba-015a-4104-89a4-030695aa4d15/code.php @@ -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 IntegerFields extends Registry implements Registryinterface { /** - * To String Values + * Path To String Values * * @since 3.2.0 */ - use ToString; + use PathToString; } diff --git a/src/952423ba-015a-4104-89a4-030695aa4d15/code.power b/src/952423ba-015a-4104-89a4-030695aa4d15/code.power index b9696bb..5081704 100644 --- a/src/952423ba-015a-4104-89a4-030695aa4d15/code.power +++ b/src/952423ba-015a-4104-89a4-030695aa4d15/code.power @@ -1,6 +1,6 @@ /** - * To String Values + * Path To String Values * * @since 3.2.0 */ - use ToString; \ No newline at end of file + use PathToString; \ No newline at end of file diff --git a/src/9769f3b2-17bf-4f20-b54b-3a4ebe572b36/code.php b/src/9769f3b2-17bf-4f20-b54b-3a4ebe572b36/code.php deleted file mode 100644 index 0d4de7d..0000000 --- a/src/9769f3b2-17bf-4f20-b54b-3a4ebe572b36/code.php +++ /dev/null @@ -1,64 +0,0 @@ - - * @git 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 Joomla\Registry\Registry as JoomlaRegistry; -use Joomla\CMS\Factory; -use Joomla\Input\Input; -use VDM\Joomla\Utilities\Component\Helper; -use VDM\Joomla\Utilities\String\ClassfunctionHelper; -use VDM\Joomla\Abstraction\BaseConfig as ExtendingBaseConfig; - - -/** - * Config - * - * @since 3.2.0 - */ -abstract class BaseConfig extends ExtendingBaseConfig -{ - /** - * Hold a JInput object for easier access to the input variables. - * - * @var Input - * @since 3.2.0 - */ - protected Input $input; - - /** - * The Params - * - * @var JoomlaRegistry - * @since 3.2.0 - */ - protected JoomlaRegistry $params; - - /** - * Constructor - * - * @param Input|null $input Input - * @param Registry|null $params The component parameters - * - * @throws \Exception - * @since 3.2.0 - */ - public function __construct(?Input $input = null, ?JoomlaRegistry $params = null) - { - $this->input = $input ?: Factory::getApplication()->input; - $this->params = $params ?: Helper::getParams('com_componentbuilder'); - - // run parent constructor - parent::__construct(); - } -} - diff --git a/src/9769f3b2-17bf-4f20-b54b-3a4ebe572b36/code.power b/src/9769f3b2-17bf-4f20-b54b-3a4ebe572b36/code.power deleted file mode 100644 index 86a86ff..0000000 --- a/src/9769f3b2-17bf-4f20-b54b-3a4ebe572b36/code.power +++ /dev/null @@ -1,33 +0,0 @@ - /** - * Hold a JInput object for easier access to the input variables. - * - * @var Input - * @since 3.2.0 - */ - protected Input $input; - - /** - * The Params - * - * @var JoomlaRegistry - * @since 3.2.0 - */ - protected JoomlaRegistry $params; - - /** - * Constructor - * - * @param Input|null $input Input - * @param Registry|null $params The component parameters - * - * @throws \Exception - * @since 3.2.0 - */ - public function __construct(?Input $input = null, ?JoomlaRegistry $params = null) - { - $this->input = $input ?: Factory::getApplication()->input; - $this->params = $params ?: Helper::getParams('com_componentbuilder'); - - // run parent constructor - parent::__construct(); - } \ No newline at end of file diff --git a/src/a0c143af-3d7d-4c19-91c4-f72060b4c361/README.md b/src/a0c143af-3d7d-4c19-91c4-f72060b4c361/README.md new file mode 100644 index 0000000..e7b022a --- /dev/null +++ b/src/a0c143af-3d7d-4c19-91c4-f72060b4c361/README.md @@ -0,0 +1,108 @@ +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# final class Resolve (Details) +> namespace: **VDM\Joomla\Componentbuilder\Network** + +```uml +@startuml +class Resolve << (F,LightGreen) >> #RoyalBlue { + # Url $url + # Status $status + + __construct(Url $url, Status $status) + + api(string $target, $domain, ...) : void + - resolve(string $target, $domain, ...) : void + - active(string $target) : ?object + - logInfo(string $message) : void + - logError(\Exception $exception, string $message) : void +} + +note right of Resolve::__construct + Constructor. + + since: 5.0.4 +end note + +note right of Resolve::api + Resolves the API for a repository if it is part of the core network. +This method attempts to verify the status of the API and resolve an active URL if the current one is inactive. + + since: 5.0.4 + return: void + + arguments: + string $target + $domain + $organisation + $repository +end note + +note right of Resolve::resolve + Resolves an active API URL if the current API is inactive. +Updates the `$domain`, `$organisation`, and `$repository` parameters to point to an active API URL. + + since: 5.0.4 + return: void + + arguments: + string $target + $domain + $organisation + $repository +end note + +note right of Resolve::active + Retrieves a random active repository target, excluding the specified domain. + + since: 5.0.4 + return: ?object +end note + +note right of Resolve::logInfo + Logs an info custom message. + + since: 5.0.4 + return: void +end note + +note right of Resolve::logError + Logs an error with a custom message. +This method is a placeholder for your actual logging mechanism. + + since: 5.0.4 + 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---a0c143af_3d7d_4c19_91c4_f72060b4c361---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) + diff --git a/src/a0c143af-3d7d-4c19-91c4-f72060b4c361/code.php b/src/a0c143af-3d7d-4c19-91c4-f72060b4c361/code.php new file mode 100644 index 0000000..c6ba622 --- /dev/null +++ b/src/a0c143af-3d7d-4c19-91c4-f72060b4c361/code.php @@ -0,0 +1,178 @@ + + * @git 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 Joomla\CMS\Log\Log; +use VDM\Joomla\Componentbuilder\Network\Url; +use VDM\Joomla\Componentbuilder\Network\Status; + + +/** + * The Network Resolver + * + * @since 5.0.4 + */ +final class Resolve +{ + /** + * The Url Class. + * + * @var Url + * @since 5.0.4 + */ + protected Url $url; + + /** + * The Status Class. + * + * @var Status + * @since 5.0.4 + */ + protected Status $status; + + /** + * Constructor. + * + * @param Url $url The Url Class. + * @param Status $status The Status Class. + * + * @since 5.0.4 + */ + public function __construct(Url $url, Status $status) + { + $this->url = $url; + $this->status = $status; + } + + /** + * Resolves the API for a repository if it is part of the core network. + * + * This method attempts to verify the status of the API and resolve an active URL if the current one is inactive. + * + * @param string $target The target network. + * @param string &$domain The API base domain (passed by reference). + * @param string &$organisation The repository organisation (passed by reference). + * @param string &$repository The repository name (passed by reference). + * + * @return void + * @since 5.0.4 + */ + public function api(string $target, string &$domain, string &$organisation, string &$repository): void + { + try { + // Check the status of the current API + $status = $this->status->get($target, $domain, $repository, $organisation); + + // If the API is inactive, attempt to find another active URL + if ($status === 0) + { + $this->resolve($target, $domain, $organisation, $repository); + } + } catch (\Exception $e) { + // ignore any none [in]active urls + $this->logError($e, 'Failed to resolve API status.'); + } + } + + /** + * Resolves an active API URL if the current API is inactive. + * + * Updates the `$domain`, `$organisation`, and `$repository` parameters to point to an active API URL. + * + * @param string $target The target network. + * @param string &$domain The API base domain (passed by reference). + * @param string &$organisation The repository organisation (passed by reference). + * @param string &$repository The repository name (passed by reference). + * + * @return void + * @since 5.0.4 + */ + private function resolve(string $target, string &$domain, string &$organisation, string &$repository): void + { + $activeRepo = $this->active($target); + + if ($activeRepo === null) { + // No active API found, log or handle this case as needed + throw new \Exception('No active API found for the target: ' . $target); + } + + try { + // Parse the active repository's URL and update the references + $parsedUrl = $this->url->parse($activeRepo->url); + + $noneActiveDomain = "{$domain}/{$organisation}/{$repository}"; + $activeDomain = "{$parsedUrl->scheme}://{$parsedUrl->domain}/{$parsedUrl->organisation}/{$parsedUrl->repository}"; + + // update the values passed by reference + $domain = $parsedUrl->scheme . '://' . $parsedUrl->domain; + $organisation = $parsedUrl->organisation ?? $organisation; + $repository = $parsedUrl->repository ?? $repository; + + // add info + $this->logInfo("Resolved [{$noneActiveDomain}] to [{$activeDomain}]"); + } catch (\Exception $e) { + // ignore any none [in]active urls + $this->logError($e, 'Failed to parse active repository URL.'); + } + } + + /** + * Retrieves a random active repository target, excluding the specified domain. + * + * @param string $target The target network. + * + * @return object|null The randomly selected active repository, or null if none found. + * @since 5.0.4 + */ + private function active(string $target): ?object + { + try { + $activeRepo = $this->status->active($target); + } catch (\Exception $e) { + // ignore any none [in]active urls + $this->logError($e, "Failed to get an [{$target}] active repository."); + } + + return $activeRepo; + } + + /** + * Logs an info custom message. + * + * @param string $message A custom message to include with the log entry. + * + * @return void + * @since 5.0.4 + */ + private function logInfo(string $message): void + { + Log::add($message, Log::INFO, 'jcb-network-resolve'); + } + + /** + * Logs an error with a custom message. + * + * This method is a placeholder for your actual logging mechanism. + * + * @param \Exception $exception The exception to log. + * @param string $message A custom message to include with the log entry. + * + * @return void + * @since 5.0.4 + */ + private function logError(\Exception $exception, string $message): void + { + Log::add($message . ' Exception: ' . $exception->getMessage(), Log::ERROR, 'jcb-network-resolve'); + } +} + diff --git a/src/a0c143af-3d7d-4c19-91c4-f72060b4c361/code.power b/src/a0c143af-3d7d-4c19-91c4-f72060b4c361/code.power new file mode 100644 index 0000000..037ed23 --- /dev/null +++ b/src/a0c143af-3d7d-4c19-91c4-f72060b4c361/code.power @@ -0,0 +1,150 @@ + /** + * The Url Class. + * + * @var Url + * @since 5.0.4 + */ + protected Url $url; + + /** + * The Status Class. + * + * @var Status + * @since 5.0.4 + */ + protected Status $status; + + /** + * Constructor. + * + * @param Url $url The Url Class. + * @param Status $status The Status Class. + * + * @since 5.0.4 + */ + public function __construct(Url $url, Status $status) + { + $this->url = $url; + $this->status = $status; + } + + /** + * Resolves the API for a repository if it is part of the core network. + * + * This method attempts to verify the status of the API and resolve an active URL if the current one is inactive. + * + * @param string $target The target network. + * @param string &$domain The API base domain (passed by reference). + * @param string &$organisation The repository organisation (passed by reference). + * @param string &$repository The repository name (passed by reference). + * + * @return void + * @since 5.0.4 + */ + public function api(string $target, string &$domain, string &$organisation, string &$repository): void + { + try { + // Check the status of the current API + $status = $this->status->get($target, $domain, $repository, $organisation); + + // If the API is inactive, attempt to find another active URL + if ($status === 0) + { + $this->resolve($target, $domain, $organisation, $repository); + } + } catch (\Exception $e) { + // ignore any none [in]active urls + $this->logError($e, 'Failed to resolve API status.'); + } + } + + /** + * Resolves an active API URL if the current API is inactive. + * + * Updates the `$domain`, `$organisation`, and `$repository` parameters to point to an active API URL. + * + * @param string $target The target network. + * @param string &$domain The API base domain (passed by reference). + * @param string &$organisation The repository organisation (passed by reference). + * @param string &$repository The repository name (passed by reference). + * + * @return void + * @since 5.0.4 + */ + private function resolve(string $target, string &$domain, string &$organisation, string &$repository): void + { + $activeRepo = $this->active($target); + + if ($activeRepo === null) { + // No active API found, log or handle this case as needed + throw new \Exception('No active API found for the target: ' . $target); + } + + try { + // Parse the active repository's URL and update the references + $parsedUrl = $this->url->parse($activeRepo->url); + + $noneActiveDomain = "{$domain}/{$organisation}/{$repository}"; + $activeDomain = "{$parsedUrl->scheme}://{$parsedUrl->domain}/{$parsedUrl->organisation}/{$parsedUrl->repository}"; + + // update the values passed by reference + $domain = $parsedUrl->scheme . '://' . $parsedUrl->domain; + $organisation = $parsedUrl->organisation ?? $organisation; + $repository = $parsedUrl->repository ?? $repository; + + // add info + $this->logInfo("Resolved [{$noneActiveDomain}] to [{$activeDomain}]"); + } catch (\Exception $e) { + // ignore any none [in]active urls + $this->logError($e, 'Failed to parse active repository URL.'); + } + } + + /** + * Retrieves a random active repository target, excluding the specified domain. + * + * @param string $target The target network. + * + * @return object|null The randomly selected active repository, or null if none found. + * @since 5.0.4 + */ + private function active(string $target): ?object + { + try { + $activeRepo = $this->status->active($target); + } catch (\Exception $e) { + // ignore any none [in]active urls + $this->logError($e, "Failed to get an [{$target}] active repository."); + } + + return $activeRepo; + } + + /** + * Logs an info custom message. + * + * @param string $message A custom message to include with the log entry. + * + * @return void + * @since 5.0.4 + */ + private function logInfo(string $message): void + { + Log::add($message, Log::INFO, 'jcb-network-resolve'); + } + + /** + * Logs an error with a custom message. + * + * This method is a placeholder for your actual logging mechanism. + * + * @param \Exception $exception The exception to log. + * @param string $message A custom message to include with the log entry. + * + * @return void + * @since 5.0.4 + */ + private function logError(\Exception $exception, string $message): void + { + Log::add($message . ' Exception: ' . $exception->getMessage(), Log::ERROR, 'jcb-network-resolve'); + } \ No newline at end of file diff --git a/src/a0c143af-3d7d-4c19-91c4-f72060b4c361/settings.json b/src/a0c143af-3d7d-4c19-91c4-f72060b4c361/settings.json new file mode 100644 index 0000000..1356dec --- /dev/null +++ b/src/a0c143af-3d7d-4c19-91c4-f72060b4c361/settings.json @@ -0,0 +1,28 @@ +{ + "add_head": "1", + "add_licensing_template": "2", + "extends": "", + "guid": "a0c143af-3d7d-4c19-91c4-f72060b4c361", + "implements": null, + "load_selection": null, + "name": "Resolve", + "power_version": "1.0.0", + "system_name": "Joomla.JCB.Network.Resolve", + "type": "final class", + "use_selection": { + "use_selection0": { + "use": "286f7550-9c22-401c-9e5a-2f9426888133", + "as": "default" + }, + "use_selection1": { + "use": "809d3077-c105-4e9c-8ac5-8fbee10cf9fc", + "as": "default" + } + }, + "extendsinterfaces": null, + "namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Network.Resolve", + "description": "The Network Resolver\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 \r\n * @git 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\\CMS\\Log\\Log;", + "composer": "" +} \ No newline at end of file diff --git a/src/a0f032db-2242-41df-8e4a-5e9e6f88201d/code.php b/src/a0f032db-2242-41df-8e4a-5e9e6f88201d/code.php index 77047ed..2eccc96 100644 --- a/src/a0f032db-2242-41df-8e4a-5e9e6f88201d/code.php +++ b/src/a0f032db-2242-41df-8e4a-5e9e6f88201d/code.php @@ -139,7 +139,7 @@ final class Layout if ($this->layout->exists($nameSingleCode . '.' . $tabName . '.' . $field['alignment'] . '.' . $field['order_edit'])) { - $size = $this->layout->count($nameSingleCode . '.' . $tabName . '.' + $size = $this->layout->pathCount($nameSingleCode . '.' . $tabName . '.' . $field['alignment']) + 1; while ($this->layout->exists($nameSingleCode . '.' . $tabName . '.' . $field['alignment'] . '.' . $size)) @@ -168,7 +168,7 @@ final class Layout if ($this->newpublishingfields->exists($nameSingleCode . '.' . $field['alignment'] . '.' . $field['order_edit'])) { - $size = $this->newpublishingfields->count($nameSingleCode . '.' . + $size = $this->newpublishingfields->pathCount($nameSingleCode . '.' . $field['alignment']) + 1; while ($this->newpublishingfields->exists($nameSingleCode . '.' . $field['alignment'] . '.' . $size)) @@ -191,7 +191,7 @@ final class Layout if ($this->layout->exists($nameSingleCode . '.Details.' . $field['alignment'] . '.' . $field['order_edit'])) { - $size = $this->layout->count($nameSingleCode . '.Details.' + $size = $this->layout->pathCount($nameSingleCode . '.Details.' . $field['alignment']) + 1; while ($this->layout->exists($nameSingleCode . '.Details.' . $field['alignment'] . '.' . $size)) diff --git a/src/a0f032db-2242-41df-8e4a-5e9e6f88201d/code.power b/src/a0f032db-2242-41df-8e4a-5e9e6f88201d/code.power index 2f14485..a54765e 100644 --- a/src/a0f032db-2242-41df-8e4a-5e9e6f88201d/code.power +++ b/src/a0f032db-2242-41df-8e4a-5e9e6f88201d/code.power @@ -109,7 +109,7 @@ if ($this->layout->exists($nameSingleCode . '.' . $tabName . '.' . $field['alignment'] . '.' . $field['order_edit'])) { - $size = $this->layout->count($nameSingleCode . '.' . $tabName . '.' + $size = $this->layout->pathCount($nameSingleCode . '.' . $tabName . '.' . $field['alignment']) + 1; while ($this->layout->exists($nameSingleCode . '.' . $tabName . '.' . $field['alignment'] . '.' . $size)) @@ -138,7 +138,7 @@ if ($this->newpublishingfields->exists($nameSingleCode . '.' . $field['alignment'] . '.' . $field['order_edit'])) { - $size = $this->newpublishingfields->count($nameSingleCode . '.' . + $size = $this->newpublishingfields->pathCount($nameSingleCode . '.' . $field['alignment']) + 1; while ($this->newpublishingfields->exists($nameSingleCode . '.' . $field['alignment'] . '.' . $size)) @@ -161,7 +161,7 @@ if ($this->layout->exists($nameSingleCode . '.Details.' . $field['alignment'] . '.' . $field['order_edit'])) { - $size = $this->layout->count($nameSingleCode . '.Details.' + $size = $this->layout->pathCount($nameSingleCode . '.Details.' . $field['alignment']) + 1; while ($this->layout->exists($nameSingleCode . '.Details.' . $field['alignment'] . '.' . $size)) diff --git a/src/a4857c60-680c-4e0c-ae8f-9250a7b5e317/code.php b/src/a4857c60-680c-4e0c-ae8f-9250a7b5e317/code.php index df81be4..a2bf223 100644 --- a/src/a4857c60-680c-4e0c-ae8f-9250a7b5e317/code.php +++ b/src/a4857c60-680c-4e0c-ae8f-9250a7b5e317/code.php @@ -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 CustomFieldLinks extends Registry implements Registryinterface { /** - * To String Values + * Path To String Values * * @since 3.2.0 */ - use ToString; + use PathToString; } diff --git a/src/a4857c60-680c-4e0c-ae8f-9250a7b5e317/code.power b/src/a4857c60-680c-4e0c-ae8f-9250a7b5e317/code.power index b9696bb..5081704 100644 --- a/src/a4857c60-680c-4e0c-ae8f-9250a7b5e317/code.power +++ b/src/a4857c60-680c-4e0c-ae8f-9250a7b5e317/code.power @@ -1,6 +1,6 @@ /** - * To String Values + * Path To String Values * * @since 3.2.0 */ - use ToString; \ No newline at end of file + use PathToString; \ No newline at end of file diff --git a/src/a5734b9e-a72d-494c-bc72-c3bc7506015f/code.php b/src/a5734b9e-a72d-494c-bc72-c3bc7506015f/code.php index cea2a05..ad63834 100644 --- a/src/a5734b9e-a72d-494c-bc72-c3bc7506015f/code.php +++ b/src/a5734b9e-a72d-494c-bc72-c3bc7506015f/code.php @@ -21,6 +21,9 @@ use VDM\Joomla\Componentbuilder\Power\Service\Generator; use VDM\Joomla\Componentbuilder\Service\Gitea; use VDM\Joomla\Componentbuilder\Power\Service\Gitea as GiteaPower; use VDM\Joomla\Gitea\Service\Utilities as GiteaUtilities; +use VDM\Joomla\Componentbuilder\Service\Network; +use VDM\Joomla\Componentbuilder\Service\Api; +use VDM\Joomla\Componentbuilder\Service\Utilities; use VDM\Joomla\Interfaces\FactoryInterface; use VDM\Joomla\Abstraction\Factory as ExtendingFactory; @@ -56,7 +59,10 @@ abstract class Factory extends ExtendingFactory implements FactoryInterface ->registerServiceProvider(new Generator()) ->registerServiceProvider(new Gitea()) ->registerServiceProvider(new GiteaPower()) - ->registerServiceProvider(new GiteaUtilities()); + ->registerServiceProvider(new GiteaUtilities()) + ->registerServiceProvider(new Api()) + ->registerServiceProvider(new Network()) + ->registerServiceProvider(new Utilities()); } } diff --git a/src/a5734b9e-a72d-494c-bc72-c3bc7506015f/code.power b/src/a5734b9e-a72d-494c-bc72-c3bc7506015f/code.power index 83e3cdd..bdc84f7 100644 --- a/src/a5734b9e-a72d-494c-bc72-c3bc7506015f/code.power +++ b/src/a5734b9e-a72d-494c-bc72-c3bc7506015f/code.power @@ -22,5 +22,8 @@ ->registerServiceProvider(new Generator()) ->registerServiceProvider(new Gitea()) ->registerServiceProvider(new GiteaPower()) - ->registerServiceProvider(new GiteaUtilities()); + ->registerServiceProvider(new GiteaUtilities()) + ->registerServiceProvider(new Api()) + ->registerServiceProvider(new Network()) + ->registerServiceProvider(new Utilities()); } \ No newline at end of file diff --git a/src/a5734b9e-a72d-494c-bc72-c3bc7506015f/settings.json b/src/a5734b9e-a72d-494c-bc72-c3bc7506015f/settings.json index 9fc36e3..a95e9e2 100644 --- a/src/a5734b9e-a72d-494c-bc72-c3bc7506015f/settings.json +++ b/src/a5734b9e-a72d-494c-bc72-c3bc7506015f/settings.json @@ -43,6 +43,18 @@ "use_selection7": { "use": "6edf0cf3-c2b0-45c9-84d2-c6ef1c5d434c", "as": "GiteaUtilities" + }, + "use_selection8": { + "use": "156f449b-ca6c-4a57-a925-be345e751614", + "as": "default" + }, + "use_selection9": { + "use": "3c7567d7-b079-4910-b325-7ed5c30cabff", + "as": "default" + }, + "use_selection10": { + "use": "facd1e1c-ff2f-4520-b735-075c45aa55ed", + "as": "default" } }, "extendsinterfaces": null, diff --git a/src/a90a2495-9c26-446c-867e-9ee8f42fb6af/code.php b/src/a90a2495-9c26-446c-867e-9ee8f42fb6af/code.php index cd5074b..cb37494 100644 --- a/src/a90a2495-9c26-446c-867e-9ee8f42fb6af/code.php +++ b/src/a90a2495-9c26-446c-867e-9ee8f42fb6af/code.php @@ -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 Layout extends Registry implements Registryinterface { /** - * Count Values + * Path Count Values * * @since 3.2.0 */ - use Count; + use PathCount; } diff --git a/src/a90a2495-9c26-446c-867e-9ee8f42fb6af/code.power b/src/a90a2495-9c26-446c-867e-9ee8f42fb6af/code.power index 21bfdb2..642b684 100644 --- a/src/a90a2495-9c26-446c-867e-9ee8f42fb6af/code.power +++ b/src/a90a2495-9c26-446c-867e-9ee8f42fb6af/code.power @@ -1,6 +1,6 @@ /** - * Count Values + * Path Count Values * * @since 3.2.0 */ - use Count; \ No newline at end of file + use PathCount; \ No newline at end of file diff --git a/src/af5beb21-214a-44f6-9090-7ea24c22e649/code.php b/src/af5beb21-214a-44f6-9090-7ea24c22e649/code.php index 378ca87..2569d4c 100644 --- a/src/af5beb21-214a-44f6-9090-7ea24c22e649/code.php +++ b/src/af5beb21-214a-44f6-9090-7ea24c22e649/code.php @@ -32,6 +32,11 @@ class Whmcs */ public function set(object &$item) { + if (!isset($item->add_license)) + { + return; + } + if (1 == $item->add_license && (!isset($item->whmcs_buy_link) || !StringHelper::check( diff --git a/src/af5beb21-214a-44f6-9090-7ea24c22e649/code.power b/src/af5beb21-214a-44f6-9090-7ea24c22e649/code.power index 6c79a8b..202b525 100644 --- a/src/af5beb21-214a-44f6-9090-7ea24c22e649/code.power +++ b/src/af5beb21-214a-44f6-9090-7ea24c22e649/code.power @@ -8,6 +8,11 @@ */ public function set(object &$item) { + if (!isset($item->add_license)) + { + return; + } + if (1 == $item->add_license && (!isset($item->whmcs_buy_link) || !StringHelper::check( diff --git a/src/baf83354-0be5-410e-80f9-2b64b052e482/README.md b/src/baf83354-0be5-410e-80f9-2b64b052e482/README.md index 31d642d..b5c67e8 100644 --- a/src/baf83354-0be5-410e-80f9-2b64b052e482/README.md +++ b/src/baf83354-0be5-410e-80f9-2b64b052e482/README.md @@ -8,7 +8,7 @@ ``` # class Config (Details) > namespace: **VDM\Joomla\Componentbuilder\Fieldtype** -> extends: **BaseConfig** +> extends: **ComponentConfig** ```uml @startuml diff --git a/src/baf83354-0be5-410e-80f9-2b64b052e482/code.php b/src/baf83354-0be5-410e-80f9-2b64b052e482/code.php index d5a163f..893c162 100644 --- a/src/baf83354-0be5-410e-80f9-2b64b052e482/code.php +++ b/src/baf83354-0be5-410e-80f9-2b64b052e482/code.php @@ -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 5.0.3 */ -class Config extends BaseConfig +class Config extends ComponentConfig { /** * The Global Joomla Configuration diff --git a/src/be4ccfae-65a9-401e-bdbe-637d8c226954/README.md b/src/be4ccfae-65a9-401e-bdbe-637d8c226954/README.md index 24158a3..693d4a5 100644 --- a/src/be4ccfae-65a9-401e-bdbe-637d8c226954/README.md +++ b/src/be4ccfae-65a9-401e-bdbe-637d8c226954/README.md @@ -8,7 +8,7 @@ ``` # class Config (Details) > namespace: **VDM\Joomla\Componentbuilder\Power** -> extends: **BaseConfig** +> extends: **ComponentConfig** ```uml @startuml diff --git a/src/be4ccfae-65a9-401e-bdbe-637d8c226954/code.php b/src/be4ccfae-65a9-401e-bdbe-637d8c226954/code.php index d5e6243..75a4ef9 100644 --- a/src/be4ccfae-65a9-401e-bdbe-637d8c226954/code.php +++ b/src/be4ccfae-65a9-401e-bdbe-637d8c226954/code.php @@ -18,7 +18,7 @@ use Joomla\Input\Input; 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; /** @@ -32,7 +32,7 @@ use VDM\Joomla\Componentbuilder\Abstraction\BaseConfig; * * @since 3.2.0 */ -class Config extends BaseConfig +class Config extends ComponentConfig { /** * The Global Joomla Configuration diff --git a/src/c99e85a0-d120-4f25-bcbf-0940dd7b773b/README.md b/src/c99e85a0-d120-4f25-bcbf-0940dd7b773b/README.md new file mode 100644 index 0000000..345bae6 --- /dev/null +++ b/src/c99e85a0-d120-4f25-bcbf-0940dd7b773b/README.md @@ -0,0 +1,73 @@ +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# final class Response (Details) +> namespace: **VDM\Joomla\Componentbuilder\Utilities** + +```uml +@startuml +class Response << (F,LightGreen) >> #RoyalBlue { + + get(JoomlaResponse $response, int $expectedCode = 200, ...) : mixed + # getBody(JoomlaResponse $response, mixed $default = null) : mixed + # error(JoomlaResponse $response) : string +} + +note right of Response::get + Process the response and decode it. + + since: 2.0.1 + return: mixed + + arguments: + JoomlaResponse $response + int $expectedCode = 200 + mixed $default = null +end note + +note right of Response::getBody + Return the body from the response + + since: 2.0.1 + return: mixed +end note + +note right of Response::error + Get the error message from the System API response + + since: 2.0.1 + return: string +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---c99e85a0_d120_4f25_bcbf_0940dd7b773b---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) + diff --git a/src/c99e85a0-d120-4f25-bcbf-0940dd7b773b/code.php b/src/c99e85a0-d120-4f25-bcbf-0940dd7b773b/code.php new file mode 100644 index 0000000..b44ec9e --- /dev/null +++ b/src/c99e85a0-d120-4f25-bcbf-0940dd7b773b/code.php @@ -0,0 +1,125 @@ + + * @git 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\CMS\Http\Response as JoomlaResponse; +use VDM\Joomla\Utilities\JsonHelper; +use VDM\Joomla\Utilities\StringHelper; + + +/** + * The Response + * + * @since 2.0.1 + */ +final class Response +{ + /** + * Process the response and decode it. + * + * @param JoomlaResponse $response The response. + * @param integer $expectedCode The expected "good" code. + * @param mixed $default The default if body not have length + * + * @return mixed + * + * @since 2.0.1 + * @throws \DomainException + **/ + public function get($response, int $expectedCode = 200, $default = null) + { + // Validate the response code. + if ($response->code != $expectedCode) + { + // Decode the error response and throw an exception. + $message = $this->error($response); + + // Throw an exception with the error message and code. + throw new \DomainException($message, $response->code); + } + + return $this->getBody($response, $default); + } + + /** + * Return the body from the response + * + * @param JoomlaResponse $response The response. + * @param mixed $default The default if body not have length + * + * @return mixed + * @since 2.0.1 + **/ + protected function getBody($response, $default = null) + { + $body = $response->body ?? null; + // check that we have a body + if (StringHelper::check($body)) + { + // if it's JSON, decode it + if (JsonHelper::check($body)) + { + return json_decode((string) $body); + } + + // if it's XML, convert it to an object + libxml_use_internal_errors(true); + $xml = simplexml_load_string($body); + if ($xml !== false) + { + return $xml; + } + + // if it's neither JSON nor XML, return as is + return $body; + } + + return $default; + } + + /** + * Get the error message from the System API response + * + * @param JoomlaResponse $response The response. + * + * @return string + * @since 2.0.1 + **/ + protected function error($response): string + { + $body = $response->body ?? null; + // do we have a json string + if (JsonHelper::check($body)) + { + $error = json_decode($body); + } + else + { + return 'Invalid or empty response body.'; + } + + // check if system returned an error object + if (isset($error->Error)) + { + // error object found, extract message and code + $errorMessage = isset($error->Error->Message) ? $error->Error->Message : 'Unknown error.'; + $errorCode = isset($error->Error->Code) ? $error->Error->Code : 'Unknown error code.'; + + // return formatted error message + return 'Error: ' . $errorMessage . ' Code: ' . $errorCode; + } + + return 'No error information found in response.'; + } +} + diff --git a/src/c99e85a0-d120-4f25-bcbf-0940dd7b773b/code.power b/src/c99e85a0-d120-4f25-bcbf-0940dd7b773b/code.power new file mode 100644 index 0000000..875c2ab --- /dev/null +++ b/src/c99e85a0-d120-4f25-bcbf-0940dd7b773b/code.power @@ -0,0 +1,97 @@ + /** + * Process the response and decode it. + * + * @param JoomlaResponse $response The response. + * @param integer $expectedCode The expected "good" code. + * @param mixed $default The default if body not have length + * + * @return mixed + * + * @since 2.0.1 + * @throws \DomainException + **/ + public function get($response, int $expectedCode = 200, $default = null) + { + // Validate the response code. + if ($response->code != $expectedCode) + { + // Decode the error response and throw an exception. + $message = $this->error($response); + + // Throw an exception with the error message and code. + throw new \DomainException($message, $response->code); + } + + return $this->getBody($response, $default); + } + + /** + * Return the body from the response + * + * @param JoomlaResponse $response The response. + * @param mixed $default The default if body not have length + * + * @return mixed + * @since 2.0.1 + **/ + protected function getBody($response, $default = null) + { + $body = $response->body ?? null; + // check that we have a body + if (StringHelper::check($body)) + { + // if it's JSON, decode it + if (JsonHelper::check($body)) + { + return json_decode((string) $body); + } + + // if it's XML, convert it to an object + libxml_use_internal_errors(true); + $xml = simplexml_load_string($body); + if ($xml !== false) + { + return $xml; + } + + // if it's neither JSON nor XML, return as is + return $body; + } + + return $default; + } + + /** + * Get the error message from the System API response + * + * @param JoomlaResponse $response The response. + * + * @return string + * @since 2.0.1 + **/ + protected function error($response): string + { + $body = $response->body ?? null; + // do we have a json string + if (JsonHelper::check($body)) + { + $error = json_decode($body); + } + else + { + return 'Invalid or empty response body.'; + } + + // check if system returned an error object + if (isset($error->Error)) + { + // error object found, extract message and code + $errorMessage = isset($error->Error->Message) ? $error->Error->Message : 'Unknown error.'; + $errorCode = isset($error->Error->Code) ? $error->Error->Code : 'Unknown error code.'; + + // return formatted error message + return 'Error: ' . $errorMessage . ' Code: ' . $errorCode; + } + + return 'No error information found in response.'; + } \ No newline at end of file diff --git a/src/c99e85a0-d120-4f25-bcbf-0940dd7b773b/settings.json b/src/c99e85a0-d120-4f25-bcbf-0940dd7b773b/settings.json new file mode 100644 index 0000000..0b99198 --- /dev/null +++ b/src/c99e85a0-d120-4f25-bcbf-0940dd7b773b/settings.json @@ -0,0 +1,28 @@ +{ + "add_head": "1", + "add_licensing_template": "2", + "extends": "", + "guid": "c99e85a0-d120-4f25-bcbf-0940dd7b773b", + "implements": null, + "load_selection": null, + "name": "Response", + "power_version": "1.0.0", + "system_name": "Joomla.Utilities.Response", + "type": "final class", + "use_selection": { + "use_selection0": { + "use": "4b225c51-d293-48e4-b3f6-5136cf5c3f18", + "as": "default" + }, + "use_selection1": { + "use": "1f28cb53-60d9-4db1-b517-3c7dc6b429ef", + "as": "default" + } + }, + "extendsinterfaces": null, + "namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Utilities.Response", + "description": "The Response\r\n\r\n@since 2.0.1", + "licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe \r\n * @git 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\\CMS\\Http\\Response as JoomlaResponse;", + "composer": "" +} \ No newline at end of file diff --git a/src/cef2815b-f72b-402a-b769-f028f676692d/README.md b/src/cef2815b-f72b-402a-b769-f028f676692d/README.md index 7b9d4c2..8b4ca75 100644 --- a/src/cef2815b-f72b-402a-b769-f028f676692d/README.md +++ b/src/cef2815b-f72b-402a-b769-f028f676692d/README.md @@ -12,6 +12,7 @@ ```uml @startuml class Data #Gold { + # array $data # Config $config # Event $event # Placeholder $placeholder diff --git a/src/cef2815b-f72b-402a-b769-f028f676692d/code.php b/src/cef2815b-f72b-402a-b769-f028f676692d/code.php index 5012669..a390dd4 100644 --- a/src/cef2815b-f72b-402a-b769-f028f676692d/code.php +++ b/src/cef2815b-f72b-402a-b769-f028f676692d/code.php @@ -47,6 +47,14 @@ use VDM\Joomla\Utilities\ArrayHelper; */ class Data { + /** + * The cache + * + * @var array + * @since 3.2.0 + */ + protected array $data; + /** * The Config Class. * diff --git a/src/cef2815b-f72b-402a-b769-f028f676692d/code.power b/src/cef2815b-f72b-402a-b769-f028f676692d/code.power index cffba30..559f49e 100644 --- a/src/cef2815b-f72b-402a-b769-f028f676692d/code.power +++ b/src/cef2815b-f72b-402a-b769-f028f676692d/code.power @@ -1,3 +1,11 @@ + /** + * The cache + * + * @var array + * @since 3.2.0 + */ + protected array $data; + /** * The Config Class. * diff --git a/src/d8d35836-60f2-4464-a306-097f079c4f13/README.md b/src/d8d35836-60f2-4464-a306-097f079c4f13/README.md index 5d882c7..fe3ccf7 100644 --- a/src/d8d35836-60f2-4464-a306-097f079c4f13/README.md +++ b/src/d8d35836-60f2-4464-a306-097f079c4f13/README.md @@ -13,6 +13,7 @@ ```uml @startuml class Grep << (F,LightGreen) >> #RoyalBlue { + # ?string $target # array $order # searchRemote(string $guid) : ?object # getRemote(object $path, string $guid) : ?object diff --git a/src/d8d35836-60f2-4464-a306-097f079c4f13/code.php b/src/d8d35836-60f2-4464-a306-097f079c4f13/code.php index b0e1ac1..526e7d4 100644 --- a/src/d8d35836-60f2-4464-a306-097f079c4f13/code.php +++ b/src/d8d35836-60f2-4464-a306-097f079c4f13/code.php @@ -29,6 +29,14 @@ use VDM\Joomla\Abstraction\Grep as ExtendingGrep; */ final class Grep extends ExtendingGrep implements GrepInterface { + /** + * The Grep target [network] + * + * @var string + * @since 5.0.4 + **/ + protected ?string $target = 'joomla-fieldtypes'; + /** * Order of global search * @@ -77,7 +85,7 @@ final class Grep extends ExtendingGrep implements GrepInterface $branch = $this->getBranchName($path); // load the base and token if set - $this->contents->load_($path->base ?? null, $path->token ?? null); + $this->loadApi($this->contents, $path->base ?? null, $path->token ?? null); // get the settings if (($power = $this->loadRemoteFile($path->organisation, $path->repository, $path->index->{$guid}->path . '/item.json', $branch)) !== null && diff --git a/src/d8d35836-60f2-4464-a306-097f079c4f13/code.power b/src/d8d35836-60f2-4464-a306-097f079c4f13/code.power index 62eb596..b8fc920 100644 --- a/src/d8d35836-60f2-4464-a306-097f079c4f13/code.power +++ b/src/d8d35836-60f2-4464-a306-097f079c4f13/code.power @@ -1,3 +1,11 @@ + /** + * The Grep target [network] + * + * @var string + * @since 5.0.4 + **/ + protected ?string $target = 'joomla-fieldtypes'; + /** * Order of global search * @@ -46,7 +54,7 @@ $branch = $this->getBranchName($path); // load the base and token if set - $this->contents->load_($path->base ?? null, $path->token ?? null); + $this->loadApi($this->contents, $path->base ?? null, $path->token ?? null); // get the settings if (($power = $this->loadRemoteFile($path->organisation, $path->repository, $path->index->{$guid}->path . '/item.json', $branch)) !== null && diff --git a/src/d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac/code.php b/src/d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac/code.php index 9184813..d3c799a 100644 --- a/src/d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac/code.php +++ b/src/d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac/code.php @@ -15,6 +15,8 @@ namespace VDM\Joomla\Componentbuilder\Compiler; use Joomla\DI\Container; use VDM\Joomla\Componentbuilder\Service\Crypt; use VDM\Joomla\Componentbuilder\Service\Server; +use VDM\Joomla\Componentbuilder\Service\Api; +use VDM\Joomla\Componentbuilder\Service\Network; use VDM\Joomla\Service\Database; use VDM\Joomla\Service\Model as BaseModel; use VDM\Joomla\Service\Data; @@ -124,6 +126,8 @@ abstract class Factory extends ExtendingFactory implements FactoryInterface return (new Container()) ->registerServiceProvider(new Crypt()) ->registerServiceProvider(new Server()) + ->registerServiceProvider(new Api()) + ->registerServiceProvider(new Network()) ->registerServiceProvider(new Database()) ->registerServiceProvider(new BaseModel()) ->registerServiceProvider(new Data()) diff --git a/src/d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac/code.power b/src/d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac/code.power index 2d3c475..10f3279 100644 --- a/src/d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac/code.power +++ b/src/d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac/code.power @@ -54,6 +54,8 @@ return (new Container()) ->registerServiceProvider(new Crypt()) ->registerServiceProvider(new Server()) + ->registerServiceProvider(new Api()) + ->registerServiceProvider(new Network()) ->registerServiceProvider(new Database()) ->registerServiceProvider(new BaseModel()) ->registerServiceProvider(new Data()) diff --git a/src/d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac/settings.json b/src/d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac/settings.json index 3d309cb..c771832 100644 --- a/src/d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac/settings.json +++ b/src/d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac/settings.json @@ -21,170 +21,178 @@ "as": "default" }, "use_selection2": { - "use": "4815e1c7-a433-443d-a112-d1e03d7df84b", + "use": "3c7567d7-b079-4910-b325-7ed5c30cabff", "as": "default" }, "use_selection3": { - "use": "2dcedd6c-c95b-4a37-9cac-95d28faedca3", - "as": "BaseModel" + "use": "156f449b-ca6c-4a57-a925-be345e751614", + "as": "default" }, "use_selection4": { - "use": "a5daf189-3345-4b13-8716-c51f686f545b", + "use": "4815e1c7-a433-443d-a112-d1e03d7df84b", "as": "default" }, "use_selection5": { - "use": "0601fee8-d51e-4af0-9ad3-b5f8700c4a45", - "as": "default" + "use": "2dcedd6c-c95b-4a37-9cac-95d28faedca3", + "as": "BaseModel" }, "use_selection6": { - "use": "ea5ed06e-72ae-4906-9167-1cc0fa32fe69", + "use": "a5daf189-3345-4b13-8716-c51f686f545b", "as": "default" }, "use_selection7": { - "use": "b94aaedb-6774-4739-a63f-8f87141a85db", + "use": "0601fee8-d51e-4af0-9ad3-b5f8700c4a45", "as": "default" }, "use_selection8": { - "use": "36d49d4a-8d0e-435f-ab4c-8f247d96fd4d", + "use": "ea5ed06e-72ae-4906-9167-1cc0fa32fe69", "as": "default" }, "use_selection9": { - "use": "63782f74-7b03-4745-aa40-0adf8ed4e704", + "use": "b94aaedb-6774-4739-a63f-8f87141a85db", "as": "default" }, "use_selection10": { - "use": "9f00e793-86f8-4ef9-b775-a3eb129f83c0", + "use": "36d49d4a-8d0e-435f-ab4c-8f247d96fd4d", "as": "default" }, "use_selection11": { - "use": "2f7b1998-bb93-4055-ae82-aa659ce8a37f", + "use": "63782f74-7b03-4745-aa40-0adf8ed4e704", "as": "default" }, "use_selection12": { - "use": "a74ac3b7-bb79-4639-8f14-54a8021be68b", + "use": "9f00e793-86f8-4ef9-b775-a3eb129f83c0", "as": "default" }, "use_selection13": { - "use": "de01527a-6586-46ea-92e7-11ea3de1cedb", + "use": "2f7b1998-bb93-4055-ae82-aa659ce8a37f", "as": "default" }, "use_selection14": { - "use": "5716c79f-a1c9-4059-9d00-8cccb9f9e061", + "use": "a74ac3b7-bb79-4639-8f14-54a8021be68b", "as": "default" }, "use_selection15": { - "use": "8a63e87b-b39b-4a15-8044-9b2a2f4fb61c", + "use": "de01527a-6586-46ea-92e7-11ea3de1cedb", "as": "default" }, "use_selection16": { - "use": "2dd1289a-4000-43cc-8c62-77ff32de56bf", + "use": "5716c79f-a1c9-4059-9d00-8cccb9f9e061", "as": "default" }, "use_selection17": { - "use": "253317c7-3c3b-48a0-aec8-8af5e7a86504", + "use": "8a63e87b-b39b-4a15-8044-9b2a2f4fb61c", "as": "default" }, "use_selection18": { - "use": "87faa133-4cac-4816-ae41-5c3f9a2f76aa", + "use": "2dd1289a-4000-43cc-8c62-77ff32de56bf", "as": "default" }, "use_selection19": { - "use": "fff3255d-c493-4c21-a48f-73b3ebf8ba05", + "use": "253317c7-3c3b-48a0-aec8-8af5e7a86504", "as": "default" }, "use_selection20": { - "use": "ed9591cb-0a03-400a-bf47-eaf78ab19b9d", + "use": "87faa133-4cac-4816-ae41-5c3f9a2f76aa", "as": "default" }, "use_selection21": { - "use": "f65b52c2-593a-4c35-89d1-4a8e57a1adf0", + "use": "fff3255d-c493-4c21-a48f-73b3ebf8ba05", "as": "default" }, "use_selection22": { - "use": "c6c30d66-3106-44eb-9272-b2cf7ec74613", + "use": "ed9591cb-0a03-400a-bf47-eaf78ab19b9d", "as": "default" }, "use_selection23": { - "use": "295186de-5954-4a65-a4c1-2f79ef305743", + "use": "f65b52c2-593a-4c35-89d1-4a8e57a1adf0", "as": "default" }, "use_selection24": { - "use": "9eba241c-af90-42dd-ae05-92ff4d8391d3", + "use": "c6c30d66-3106-44eb-9272-b2cf7ec74613", "as": "default" }, "use_selection25": { - "use": "516f93b8-5fff-41c6-aeaf-2d93180a12cc", + "use": "295186de-5954-4a65-a4c1-2f79ef305743", "as": "default" }, "use_selection26": { - "use": "c7230c8c-ea88-4d8d-8c53-6136133195b7", + "use": "9eba241c-af90-42dd-ae05-92ff4d8391d3", "as": "default" }, "use_selection27": { - "use": "2c76c06e-a371-4b73-9fbe-b4d9b4df55d7", + "use": "516f93b8-5fff-41c6-aeaf-2d93180a12cc", "as": "default" }, "use_selection28": { - "use": "8fdd604f-53e7-4a91-9935-afcfd2f6ac1b", + "use": "c7230c8c-ea88-4d8d-8c53-6136133195b7", "as": "default" }, "use_selection29": { - "use": "8cd3c4aa-8daf-4e40-a943-456f46112c7b", + "use": "2c76c06e-a371-4b73-9fbe-b4d9b4df55d7", "as": "default" }, "use_selection30": { - "use": "56ba30f5-a5c4-4c4c-be6f-a56f7f9cbc60", + "use": "8fdd604f-53e7-4a91-9935-afcfd2f6ac1b", "as": "default" }, "use_selection31": { - "use": "bbd36fbf-d905-47e8-8e67-9ea6ec734712", + "use": "8cd3c4aa-8daf-4e40-a943-456f46112c7b", "as": "default" }, "use_selection32": { - "use": "98ac432d-df19-4c40-bb12-8104ea4362c8", + "use": "56ba30f5-a5c4-4c4c-be6f-a56f7f9cbc60", "as": "default" }, "use_selection33": { - "use": "71acf8d6-32b8-4173-8277-eb9cda29fd64", + "use": "bbd36fbf-d905-47e8-8e67-9ea6ec734712", "as": "default" }, "use_selection34": { + "use": "98ac432d-df19-4c40-bb12-8104ea4362c8", + "as": "default" + }, + "use_selection35": { + "use": "71acf8d6-32b8-4173-8277-eb9cda29fd64", + "as": "default" + }, + "use_selection36": { "use": "6edf0cf3-c2b0-45c9-84d2-c6ef1c5d434c", "as": "GiteaUtilities" }, - "use_selection35": { + "use_selection37": { "use": "f4d00907-c94a-49b7-8727-d64c1fa74cf5", "as": "GiteaSettings" }, - "use_selection36": { + "use_selection38": { "use": "3d25ea99-4f33-489a-934c-0e42027e6114", "as": "GiteaOrg" }, - "use_selection37": { + "use_selection39": { "use": "0a69cfc5-3223-4afb-8c9a-75f4bacf3c0e", "as": "GiteaUser" }, - "use_selection38": { + "use_selection40": { "use": "0bb2b72f-ebcd-46fe-844b-ac5fe715c230", "as": "GiteaRepo" }, - "use_selection39": { + "use_selection41": { "use": "808da4eb-b467-46cf-a767-e7e714f46b5a", "as": "GiteaPackage" }, - "use_selection40": { + "use_selection42": { "use": "44396eb8-e14c-47d9-9bdc-8205c0fd2bba", "as": "GiteaIssue" }, - "use_selection41": { + "use_selection43": { "use": "be57f70f-1214-4d69-8d33-7cd4e312ff70", "as": "GiteNotifi" }, - "use_selection42": { + "use_selection44": { "use": "012af7d0-3436-4cae-b856-be49bdc39a3e", "as": "GiteaMisc" }, - "use_selection43": { + "use_selection45": { "use": "ddced4c5-667d-4559-873d-d716c17fd85b", "as": "GiteaAdmin" } diff --git a/src/d9ee00d6-eeed-4fc4-af8a-7b5547f508ba/README.md b/src/d9ee00d6-eeed-4fc4-af8a-7b5547f508ba/README.md new file mode 100644 index 0000000..7cebc8c --- /dev/null +++ b/src/d9ee00d6-eeed-4fc4-af8a-7b5547f508ba/README.md @@ -0,0 +1,52 @@ +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# final class Http (Details) +> namespace: **VDM\Joomla\Componentbuilder\Utilities** +> extends: **JoomlaHttp** + +```uml +@startuml +class Http << (F,LightGreen) >> #RoyalBlue { + + __construct() +} + +note right of Http::__construct + Constructor. + + since: 5.0.4 +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---d9ee00d6_eeed_4fc4_af8a_7b5547f508ba---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) + diff --git a/src/d9ee00d6-eeed-4fc4-af8a-7b5547f508ba/code.php b/src/d9ee00d6-eeed-4fc4-af8a-7b5547f508ba/code.php new file mode 100644 index 0000000..4c84cca --- /dev/null +++ b/src/d9ee00d6-eeed-4fc4-af8a-7b5547f508ba/code.php @@ -0,0 +1,49 @@ + + * @git 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\CMS\Http\Http as JoomlaHttp; +use Joomla\Registry\Registry; + + + +/** + * The Joomla Component Builder Http + * + * @since 5.0.4 + */ +final class Http extends JoomlaHttp +{ + /** + * Constructor. + * + * @since 5.0.4 + * @throws \InvalidArgumentException + **/ + public function __construct() + { + // setup config + $config = [ + 'userAgent' => 'JCB/5.0', + 'headers' => [ + 'Content-Type' => 'application/json' + ] + ]; + + $options = new Registry($config); + + // run parent constructor + parent::__construct($options); + } +} + diff --git a/src/d9ee00d6-eeed-4fc4-af8a-7b5547f508ba/code.power b/src/d9ee00d6-eeed-4fc4-af8a-7b5547f508ba/code.power new file mode 100644 index 0000000..1fb275a --- /dev/null +++ b/src/d9ee00d6-eeed-4fc4-af8a-7b5547f508ba/code.power @@ -0,0 +1,21 @@ + /** + * Constructor. + * + * @since 5.0.4 + * @throws \InvalidArgumentException + **/ + public function __construct() + { + // setup config + $config = [ + 'userAgent' => 'JCB/5.0', + 'headers' => [ + 'Content-Type' => 'application/json' + ] + ]; + + $options = new Registry($config); + + // run parent constructor + parent::__construct($options); + } \ No newline at end of file diff --git a/src/d9ee00d6-eeed-4fc4-af8a-7b5547f508ba/settings.json b/src/d9ee00d6-eeed-4fc4-af8a-7b5547f508ba/settings.json new file mode 100644 index 0000000..ceefbdc --- /dev/null +++ b/src/d9ee00d6-eeed-4fc4-af8a-7b5547f508ba/settings.json @@ -0,0 +1,20 @@ +{ + "add_head": "1", + "add_licensing_template": "2", + "extends": "-1", + "guid": "d9ee00d6-eeed-4fc4-af8a-7b5547f508ba", + "implements": null, + "load_selection": null, + "name": "Http", + "power_version": "1.0.0", + "system_name": "Joomla.JCB.Utilities.Http", + "type": "final class", + "use_selection": null, + "extendsinterfaces": null, + "namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Utilities.Http", + "description": "The Joomla Component Builder Http\r\n\r\n@since 5.0.4", + "extends_custom": "JoomlaHttp", + "licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe \r\n * @git 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\\CMS\\Http\\Http as JoomlaHttp;\r\nuse Joomla\\Registry\\Registry;\r\n", + "composer": "" +} \ No newline at end of file diff --git a/src/de01527a-6586-46ea-92e7-11ea3de1cedb/code.php b/src/de01527a-6586-46ea-92e7-11ea3de1cedb/code.php index 48e58c9..1aeedc2 100644 --- a/src/de01527a-6586-46ea-92e7-11ea3de1cedb/code.php +++ b/src/de01527a-6586-46ea-92e7-11ea3de1cedb/code.php @@ -129,6 +129,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 ); diff --git a/src/de01527a-6586-46ea-92e7-11ea3de1cedb/code.power b/src/de01527a-6586-46ea-92e7-11ea3de1cedb/code.power index 56e1d5b..84eaa47 100644 --- a/src/de01527a-6586-46ea-92e7-11ea3de1cedb/code.power +++ b/src/de01527a-6586-46ea-92e7-11ea3de1cedb/code.power @@ -92,6 +92,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 ); diff --git a/src/fa4bf18e-301e-42e3-91fb-6e0096c07adc/README.md b/src/fa4bf18e-301e-42e3-91fb-6e0096c07adc/README.md index 9b5bd8d..260aebd 100644 --- a/src/fa4bf18e-301e-42e3-91fb-6e0096c07adc/README.md +++ b/src/fa4bf18e-301e-42e3-91fb-6e0096c07adc/README.md @@ -8,7 +8,7 @@ ``` # class Config (Details) > namespace: **VDM\Joomla\Componentbuilder\Compiler** -> extends: **BaseConfig** +> extends: **ComponentConfig** ```uml @startuml diff --git a/src/fa4bf18e-301e-42e3-91fb-6e0096c07adc/code.php b/src/fa4bf18e-301e-42e3-91fb-6e0096c07adc/code.php index 1c23e07..62cb53e 100644 --- a/src/fa4bf18e-301e-42e3-91fb-6e0096c07adc/code.php +++ b/src/fa4bf18e-301e-42e3-91fb-6e0096c07adc/code.php @@ -18,7 +18,7 @@ use Joomla\Input\Input; 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; /** @@ -32,7 +32,7 @@ use VDM\Joomla\Componentbuilder\Abstraction\BaseConfig; * * @since 3.2.0 */ -class Config extends BaseConfig +class Config extends ComponentConfig { /** * The Global Joomla Configuration diff --git a/src/facd1e1c-ff2f-4520-b735-075c45aa55ed/README.md b/src/facd1e1c-ff2f-4520-b735-075c45aa55ed/README.md new file mode 100644 index 0000000..68952c4 --- /dev/null +++ b/src/facd1e1c-ff2f-4520-b735-075c45aa55ed/README.md @@ -0,0 +1,76 @@ +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# class Utilities (Details) +> namespace: **VDM\Joomla\Componentbuilder\Service** + +```uml +@startuml +class Utilities #Gold { + + register(Container $container) : void + + getUri(Container $container) : Uri + + getHttp(Container $container) : Http + + getResponse(Container $container) : Response +} + +note right of Utilities::register + Registers the service provider with a DI container. + + since: 5.0.4 + return: void +end note + +note right of Utilities::getUri + Get The Uri Class. + + since: 5.0.4 + return: Uri +end note + +note right of Utilities::getHttp + Get The Http Class. + + since: 5.0.4 + return: Http +end note + +note right of Utilities::getResponse + Get The Response Class. + + since: 5.0.4 + return: Response +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---facd1e1c_ff2f_4520_b735_075c45aa55ed---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) + diff --git a/src/facd1e1c-ff2f-4520-b735-075c45aa55ed/code.php b/src/facd1e1c-ff2f-4520-b735-075c45aa55ed/code.php new file mode 100644 index 0000000..40842c2 --- /dev/null +++ b/src/facd1e1c-ff2f-4520-b735-075c45aa55ed/code.php @@ -0,0 +1,88 @@ + + * @git 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\Utilities\Uri; +use VDM\Joomla\Componentbuilder\Utilities\Http; +use VDM\Joomla\Componentbuilder\Utilities\Response; + + +/** + * The Joomla Component Builder Utilities Service + * + * @since 5.0.4 + */ +class Utilities 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(Uri::class, 'Utilities.Uri') + ->share('Utilities.Uri', [$this, 'getUri'], true); + + $container->alias(Http::class, 'Utilities.Http') + ->share('Utilities.Http', [$this, 'getHttp'], true); + + $container->alias(Response::class, 'Utilities.Response') + ->share('Utilities.Response', [$this, 'getResponse'], true); + } + + /** + * Get The Uri Class. + * + * @param Container $container The DI container. + * + * @return Uri + * @since 5.0.4 + */ + public function getUri(Container $container): Uri + { + return new Uri(); + } + + /** + * Get The Http Class. + * + * @param Container $container The DI container. + * + * @return Http + * @since 5.0.4 + */ + public function getHttp(Container $container): Http + { + return new Http(); + } + + /** + * Get The Response Class. + * + * @param Container $container The DI container. + * + * @return Response + * @since 5.0.4 + */ + public function getResponse(Container $container): Response + { + return new Response(); + } +} + diff --git a/src/facd1e1c-ff2f-4520-b735-075c45aa55ed/code.power b/src/facd1e1c-ff2f-4520-b735-075c45aa55ed/code.power new file mode 100644 index 0000000..71928e5 --- /dev/null +++ b/src/facd1e1c-ff2f-4520-b735-075c45aa55ed/code.power @@ -0,0 +1,58 @@ + /** + * 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(Uri::class, 'Utilities.Uri') + ->share('Utilities.Uri', [$this, 'getUri'], true); + + $container->alias(Http::class, 'Utilities.Http') + ->share('Utilities.Http', [$this, 'getHttp'], true); + + $container->alias(Response::class, 'Utilities.Response') + ->share('Utilities.Response', [$this, 'getResponse'], true); + } + + /** + * Get The Uri Class. + * + * @param Container $container The DI container. + * + * @return Uri + * @since 5.0.4 + */ + public function getUri(Container $container): Uri + { + return new Uri(); + } + + /** + * Get The Http Class. + * + * @param Container $container The DI container. + * + * @return Http + * @since 5.0.4 + */ + public function getHttp(Container $container): Http + { + return new Http(); + } + + /** + * Get The Response Class. + * + * @param Container $container The DI container. + * + * @return Response + * @since 5.0.4 + */ + public function getResponse(Container $container): Response + { + return new Response(); + } \ No newline at end of file diff --git a/src/facd1e1c-ff2f-4520-b735-075c45aa55ed/settings.json b/src/facd1e1c-ff2f-4520-b735-075c45aa55ed/settings.json new file mode 100644 index 0000000..ffaceb1 --- /dev/null +++ b/src/facd1e1c-ff2f-4520-b735-075c45aa55ed/settings.json @@ -0,0 +1,35 @@ +{ + "add_head": "1", + "add_licensing_template": "2", + "extends": "", + "guid": "facd1e1c-ff2f-4520-b735-075c45aa55ed", + "implements": [ + "-1" + ], + "load_selection": null, + "name": "Utilities", + "power_version": "1.0.0", + "system_name": "Joomla.JCB.Service.Utilities", + "type": "class", + "use_selection": { + "use_selection0": { + "use": "1c5bf656-f73a-46ec-bb9d-aa3932d5b3de", + "as": "default" + }, + "use_selection1": { + "use": "d9ee00d6-eeed-4fc4-af8a-7b5547f508ba", + "as": "default" + }, + "use_selection2": { + "use": "c99e85a0-d120-4f25-bcbf-0940dd7b773b", + "as": "default" + } + }, + "extendsinterfaces": null, + "namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Service.Utilities", + "description": "The Joomla Component Builder Utilities 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 \r\n * @git 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": "" +} \ No newline at end of file diff --git a/src/fd3b25c3-cd49-404c-ae82-b6a125863f10/README.md b/src/fd3b25c3-cd49-404c-ae82-b6a125863f10/README.md new file mode 100644 index 0000000..554ea43 --- /dev/null +++ b/src/fd3b25c3-cd49-404c-ae82-b6a125863f10/README.md @@ -0,0 +1,46 @@ +``` +██████╗ ██████╗ ██╗ ██╗███████╗██████╗ +██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗ +██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝ +██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗ +██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║ +╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ +``` +# final class ParsedUrls (Details) +> namespace: **VDM\Joomla\Componentbuilder\Network** +> extends: **Registry** + +```uml +@startuml +class ParsedUrls << (F,LightGreen) >> #RoyalBlue { + # ?string $separator +} + +@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---fd3b25c3_cd49_404c_ae82_b6a125863f10---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) + diff --git a/src/fd3b25c3-cd49-404c-ae82-b6a125863f10/code.php b/src/fd3b25c3-cd49-404c-ae82-b6a125863f10/code.php new file mode 100644 index 0000000..92915a4 --- /dev/null +++ b/src/fd3b25c3-cd49-404c-ae82-b6a125863f10/code.php @@ -0,0 +1,33 @@ + + * @git 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\Abstraction\Registry; + + +/** + * The Network Parsed Urls + * + * @since 5.0.4 + */ +final class ParsedUrls extends Registry +{ + /** + * Path separator + * + * @var string|null + * @since 3.2.0 + */ + protected ?string $separator = '|'; +} + diff --git a/src/fd3b25c3-cd49-404c-ae82-b6a125863f10/code.power b/src/fd3b25c3-cd49-404c-ae82-b6a125863f10/code.power new file mode 100644 index 0000000..0825688 --- /dev/null +++ b/src/fd3b25c3-cd49-404c-ae82-b6a125863f10/code.power @@ -0,0 +1,7 @@ + /** + * Path separator + * + * @var string|null + * @since 3.2.0 + */ + protected ?string $separator = '|'; \ No newline at end of file diff --git a/src/fd3b25c3-cd49-404c-ae82-b6a125863f10/settings.json b/src/fd3b25c3-cd49-404c-ae82-b6a125863f10/settings.json new file mode 100644 index 0000000..8f1500e --- /dev/null +++ b/src/fd3b25c3-cd49-404c-ae82-b6a125863f10/settings.json @@ -0,0 +1,19 @@ +{ + "add_head": "0", + "add_licensing_template": "2", + "extends": "7e822c03-1b20-41d1-9427-f5b8d5836af7", + "guid": "fd3b25c3-cd49-404c-ae82-b6a125863f10", + "implements": null, + "load_selection": null, + "name": "ParsedUrls", + "power_version": "1.0.0", + "system_name": "Joomla.JCB.Network.ParsedUrls", + "type": "final class", + "use_selection": null, + "extendsinterfaces": null, + "namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Network.ParsedUrls", + "description": "The Network Parsed Urls\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 \r\n * @git 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": "" +} \ No newline at end of file diff --git a/super-powers.json b/super-powers.json index 106d7b3..da34aab 100644 --- a/super-powers.json +++ b/super-powers.json @@ -164,6 +164,17 @@ "spk": "Super---071c7cff_4c88_4b80_bd99_066c572dcb71---Power", "guid": "071c7cff-4c88-4b80-bd99-066c572dcb71" }, + "07ca003e-368c-451d-a3d3-ba24e50c7287": { + "name": "Network", + "type": "final class", + "namespace": "VDM\\Joomla\\Componentbuilder\\Api", + "code": "src\/07ca003e-368c-451d-a3d3-ba24e50c7287\/code.php", + "power": "src\/07ca003e-368c-451d-a3d3-ba24e50c7287\/code.power", + "settings": "src\/07ca003e-368c-451d-a3d3-ba24e50c7287\/settings.json", + "path": "src\/07ca003e-368c-451d-a3d3-ba24e50c7287", + "spk": "Super---07ca003e_368c_451d_a3d3_ba24e50c7287---Power", + "guid": "07ca003e-368c-451d-a3d3-ba24e50c7287" + }, "0a524af3-f647-4f62-a422-d7d36ebe749b": { "name": "ConfigFieldsets", "type": "final class", @@ -351,6 +362,17 @@ "spk": "Super---15615db0_02b9_454f_a82e_1ab39ae5e6a9---Power", "guid": "15615db0-02b9-454f-a82e-1ab39ae5e6a9" }, + "156f449b-ca6c-4a57-a925-be345e751614": { + "name": "Network", + "type": "class", + "namespace": "VDM\\Joomla\\Componentbuilder\\Service", + "code": "src\/156f449b-ca6c-4a57-a925-be345e751614\/code.php", + "power": "src\/156f449b-ca6c-4a57-a925-be345e751614\/code.power", + "settings": "src\/156f449b-ca6c-4a57-a925-be345e751614\/settings.json", + "path": "src\/156f449b-ca6c-4a57-a925-be345e751614", + "spk": "Super---156f449b_ca6c_4a57_a925_be345e751614---Power", + "guid": "156f449b-ca6c-4a57-a925-be345e751614" + }, "15b4addf-bf6b-4691-9c92-858c7de9c2c1": { "name": "SiteFieldData", "type": "final class", @@ -472,6 +494,17 @@ "spk": "Super---1bd48df2_4f7e_4581_9fe9_4b54e59105e3---Power", "guid": "1bd48df2-4f7e-4581-9fe9-4b54e59105e3" }, + "1c5bf656-f73a-46ec-bb9d-aa3932d5b3de": { + "name": "Uri", + "type": "final class", + "namespace": "VDM\\Joomla\\Componentbuilder\\Utilities", + "code": "src\/1c5bf656-f73a-46ec-bb9d-aa3932d5b3de\/code.php", + "power": "src\/1c5bf656-f73a-46ec-bb9d-aa3932d5b3de\/code.power", + "settings": "src\/1c5bf656-f73a-46ec-bb9d-aa3932d5b3de\/settings.json", + "path": "src\/1c5bf656-f73a-46ec-bb9d-aa3932d5b3de", + "spk": "Super---1c5bf656_f73a_46ec_bb9d_aa3932d5b3de---Power", + "guid": "1c5bf656-f73a-46ec-bb9d-aa3932d5b3de" + }, "1cef0266-99e2-40d8-919f-c2ce32226b0a": { "name": "External", "type": "class", @@ -736,6 +769,17 @@ "spk": "Super---274a78d1_24c2_4486_b560_b86e9ae72872---Power", "guid": "274a78d1-24c2-4486-b560-b86e9ae72872" }, + "286f7550-9c22-401c-9e5a-2f9426888133": { + "name": "Url", + "type": "final class", + "namespace": "VDM\\Joomla\\Componentbuilder\\Network", + "code": "src\/286f7550-9c22-401c-9e5a-2f9426888133\/code.php", + "power": "src\/286f7550-9c22-401c-9e5a-2f9426888133\/code.power", + "settings": "src\/286f7550-9c22-401c-9e5a-2f9426888133\/settings.json", + "path": "src\/286f7550-9c22-401c-9e5a-2f9426888133", + "spk": "Super---286f7550_9c22_401c_9e5a_2f9426888133---Power", + "guid": "286f7550-9c22-401c-9e5a-2f9426888133" + }, "28c8eed4-58cf-4d40-9053-ad77b6edfa9d": { "name": "Extension", "type": "final class", @@ -1209,6 +1253,17 @@ "spk": "Super---3b6895da_d9eb_4164_90b1_4632a4cc2474---Power", "guid": "3b6895da-d9eb-4164-90b1-4632a4cc2474" }, + "3c7567d7-b079-4910-b325-7ed5c30cabff": { + "name": "Api", + "type": "class", + "namespace": "VDM\\Joomla\\Componentbuilder\\Service", + "code": "src\/3c7567d7-b079-4910-b325-7ed5c30cabff\/code.php", + "power": "src\/3c7567d7-b079-4910-b325-7ed5c30cabff\/code.power", + "settings": "src\/3c7567d7-b079-4910-b325-7ed5c30cabff\/settings.json", + "path": "src\/3c7567d7-b079-4910-b325-7ed5c30cabff", + "spk": "Super---3c7567d7_b079_4910_b325_7ed5c30cabff---Power", + "guid": "3c7567d7-b079-4910-b325-7ed5c30cabff" + }, "3f83fe11-1ef6-4020-bd73-f3bb58cefe3a": { "name": "OtherOrder", "type": "final class", @@ -2243,6 +2298,17 @@ "spk": "Super---7f75b300_534c_4f63_a368_6f4abc4cea58---Power", "guid": "7f75b300-534c-4f63-a368-6f4abc4cea58" }, + "809d3077-c105-4e9c-8ac5-8fbee10cf9fc": { + "name": "Status", + "type": "final class", + "namespace": "VDM\\Joomla\\Componentbuilder\\Network", + "code": "src\/809d3077-c105-4e9c-8ac5-8fbee10cf9fc\/code.php", + "power": "src\/809d3077-c105-4e9c-8ac5-8fbee10cf9fc\/code.power", + "settings": "src\/809d3077-c105-4e9c-8ac5-8fbee10cf9fc\/settings.json", + "path": "src\/809d3077-c105-4e9c-8ac5-8fbee10cf9fc", + "spk": "Super---809d3077_c105_4e9c_8ac5_8fbee10cf9fc---Power", + "guid": "809d3077-c105-4e9c-8ac5-8fbee10cf9fc" + }, "81212121-ad5c-43c5-b046-f2650864f690": { "name": "AccessSwitchList", "type": "final class", @@ -2276,6 +2342,17 @@ "spk": "Super---82505f3f_297f_4d75_a581_929ab3e93689---Power", "guid": "82505f3f-297f-4d75-a581-929ab3e93689" }, + "825ecce9-72ef-4257-bc32-4b05a4c226e9": { + "name": "Core", + "type": "final class", + "namespace": "VDM\\Joomla\\Componentbuilder\\Network", + "code": "src\/825ecce9-72ef-4257-bc32-4b05a4c226e9\/code.php", + "power": "src\/825ecce9-72ef-4257-bc32-4b05a4c226e9\/code.power", + "settings": "src\/825ecce9-72ef-4257-bc32-4b05a4c226e9\/settings.json", + "path": "src\/825ecce9-72ef-4257-bc32-4b05a4c226e9", + "spk": "Super---825ecce9_72ef_4257_bc32_4b05a4c226e9---Power", + "guid": "825ecce9-72ef-4257-bc32-4b05a4c226e9" + }, "84c11075-570a-4907-9be0-9305e0fabe3c": { "name": "ConfigFieldsetsUikit", "type": "final class", @@ -2331,6 +2408,17 @@ "spk": "Super---85cddb24_7ee6_4d86_a0db_615f443e1aec---Power", "guid": "85cddb24-7ee6-4d86-a0db-615f443e1aec" }, + "85e0b652-21b9-4ff7-ba27-dbd72256f0f2": { + "name": "Api", + "type": "abstract class", + "namespace": "VDM\\Joomla\\Componentbuilder\\Abstraction", + "code": "src\/85e0b652-21b9-4ff7-ba27-dbd72256f0f2\/code.php", + "power": "src\/85e0b652-21b9-4ff7-ba27-dbd72256f0f2\/code.power", + "settings": "src\/85e0b652-21b9-4ff7-ba27-dbd72256f0f2\/settings.json", + "path": "src\/85e0b652-21b9-4ff7-ba27-dbd72256f0f2", + "spk": "Super---85e0b652_21b9_4ff7_ba27_dbd72256f0f2---Power", + "guid": "85e0b652-21b9-4ff7-ba27-dbd72256f0f2" + }, "86ac0760-26f5-4746-9c7f-ce77860f80f8": { "name": "Serverinterface", "type": "interface", @@ -2716,17 +2804,6 @@ "spk": "Super---97698747_c2ce_4e09_a470_acf6d8e86281---Power", "guid": "97698747-c2ce-4e09-a470-acf6d8e86281" }, - "9769f3b2-17bf-4f20-b54b-3a4ebe572b36": { - "name": "BaseConfig", - "type": "abstract class", - "namespace": "VDM\\Joomla\\Componentbuilder\\Abstraction", - "code": "src\/9769f3b2-17bf-4f20-b54b-3a4ebe572b36\/code.php", - "power": "src\/9769f3b2-17bf-4f20-b54b-3a4ebe572b36\/code.power", - "settings": "src\/9769f3b2-17bf-4f20-b54b-3a4ebe572b36\/settings.json", - "path": "src\/9769f3b2-17bf-4f20-b54b-3a4ebe572b36", - "spk": "Super---9769f3b2_17bf_4f20_b54b_3a4ebe572b36---Power", - "guid": "9769f3b2-17bf-4f20-b54b-3a4ebe572b36" - }, "98419ff3-6628-4539-8365-37f88378bced": { "name": "Request", "type": "final class", @@ -2870,6 +2947,17 @@ "spk": "Super---a090a472_eb3d_4086_a6d5_4215e1b1851f---Power", "guid": "a090a472-eb3d-4086-a6d5-4215e1b1851f" }, + "a0c143af-3d7d-4c19-91c4-f72060b4c361": { + "name": "Resolve", + "type": "final class", + "namespace": "VDM\\Joomla\\Componentbuilder\\Network", + "code": "src\/a0c143af-3d7d-4c19-91c4-f72060b4c361\/code.php", + "power": "src\/a0c143af-3d7d-4c19-91c4-f72060b4c361\/code.power", + "settings": "src\/a0c143af-3d7d-4c19-91c4-f72060b4c361\/settings.json", + "path": "src\/a0c143af-3d7d-4c19-91c4-f72060b4c361", + "spk": "Super---a0c143af_3d7d_4c19_91c4_f72060b4c361---Power", + "guid": "a0c143af-3d7d-4c19-91c4-f72060b4c361" + }, "a0f032db-2242-41df-8e4a-5e9e6f88201d": { "name": "Layout", "type": "final class", @@ -3618,6 +3706,17 @@ "spk": "Super---c9700450_4f44_4455_bc86_6a7660daadee---Power", "guid": "c9700450-4f44-4455-bc86-6a7660daadee" }, + "c99e85a0-d120-4f25-bcbf-0940dd7b773b": { + "name": "Response", + "type": "final class", + "namespace": "VDM\\Joomla\\Componentbuilder\\Utilities", + "code": "src\/c99e85a0-d120-4f25-bcbf-0940dd7b773b\/code.php", + "power": "src\/c99e85a0-d120-4f25-bcbf-0940dd7b773b\/code.power", + "settings": "src\/c99e85a0-d120-4f25-bcbf-0940dd7b773b\/settings.json", + "path": "src\/c99e85a0-d120-4f25-bcbf-0940dd7b773b", + "spk": "Super---c99e85a0_d120_4f25_bcbf_0940dd7b773b---Power", + "guid": "c99e85a0-d120-4f25-bcbf-0940dd7b773b" + }, "ca111518-e47c-4049-b1b2-cb010f23866f": { "name": "Reverse", "type": "class", @@ -3937,6 +4036,17 @@ "spk": "Super---d910d8b8_4c23_4f3e_8cda_438f2d2bd7ac---Power", "guid": "d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac" }, + "d9ee00d6-eeed-4fc4-af8a-7b5547f508ba": { + "name": "Http", + "type": "final class", + "namespace": "VDM\\Joomla\\Componentbuilder\\Utilities", + "code": "src\/d9ee00d6-eeed-4fc4-af8a-7b5547f508ba\/code.php", + "power": "src\/d9ee00d6-eeed-4fc4-af8a-7b5547f508ba\/code.power", + "settings": "src\/d9ee00d6-eeed-4fc4-af8a-7b5547f508ba\/settings.json", + "path": "src\/d9ee00d6-eeed-4fc4-af8a-7b5547f508ba", + "spk": "Super---d9ee00d6_eeed_4fc4_af8a_7b5547f508ba---Power", + "guid": "d9ee00d6-eeed-4fc4-af8a-7b5547f508ba" + }, "dba0776e-e582-4f73-af3e-e7ed17bc34b3": { "name": "FootableScripts", "type": "final class", @@ -4520,6 +4630,17 @@ "spk": "Super---fa8c1125_d370_4cb6_a7ff_eb32193c198c---Power", "guid": "fa8c1125-d370-4cb6-a7ff-eb32193c198c" }, + "facd1e1c-ff2f-4520-b735-075c45aa55ed": { + "name": "Utilities", + "type": "class", + "namespace": "VDM\\Joomla\\Componentbuilder\\Service", + "code": "src\/facd1e1c-ff2f-4520-b735-075c45aa55ed\/code.php", + "power": "src\/facd1e1c-ff2f-4520-b735-075c45aa55ed\/code.power", + "settings": "src\/facd1e1c-ff2f-4520-b735-075c45aa55ed\/settings.json", + "path": "src\/facd1e1c-ff2f-4520-b735-075c45aa55ed", + "spk": "Super---facd1e1c_ff2f_4520_b735_075c45aa55ed---Power", + "guid": "facd1e1c-ff2f-4520-b735-075c45aa55ed" + }, "fcbd0dd7-1f26-472e-abd3-56265f4999f2": { "name": "Item", "type": "final class", @@ -4542,6 +4663,17 @@ "spk": "Super---fcf42c53_0967_4c87_9699_a4d86adfdadf---Power", "guid": "fcf42c53-0967-4c87-9699-a4d86adfdadf" }, + "fd3b25c3-cd49-404c-ae82-b6a125863f10": { + "name": "ParsedUrls", + "type": "final class", + "namespace": "VDM\\Joomla\\Componentbuilder\\Network", + "code": "src\/fd3b25c3-cd49-404c-ae82-b6a125863f10\/code.php", + "power": "src\/fd3b25c3-cd49-404c-ae82-b6a125863f10\/code.power", + "settings": "src\/fd3b25c3-cd49-404c-ae82-b6a125863f10\/settings.json", + "path": "src\/fd3b25c3-cd49-404c-ae82-b6a125863f10", + "spk": "Super---fd3b25c3_cd49_404c_ae82_b6a125863f10---Power", + "guid": "fd3b25c3-cd49-404c-ae82-b6a125863f10" + }, "fd885c23-88dd-440a-9b05-d02a2b2962f9": { "name": "OtherWhere", "type": "final class",