update 2024-04-12 17:17:01

This commit is contained in:
Robot 2024-04-12 17:17:05 +02:00
parent 669536f1e6
commit 4441974faa
Signed by: Robot
GPG Key ID: 14DECD44E7E1BB95
118 changed files with 7704 additions and 182 deletions

View File

@ -30,6 +30,7 @@ This repository contains an index (see below) of all the approved powers within
- **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) | Super__d910d8b8_4c23_4f3e_8cda_438f2d2bd7ac__Power
- **final class Component** | [Details](src/e2472b22-a329-44d8-b4a2-ae3ba99e17a0) | [Code](src/e2472b22-a329-44d8-b4a2-ae3ba99e17a0/code.php) | [Settings](src/e2472b22-a329-44d8-b4a2-ae3ba99e17a0/settings.json) | Super__e2472b22_a329_44d8_b4a2_ae3ba99e17a0__Power
- **final class JoomlaPower** | [Details](src/3730a000-ab64-477d-8b0f-70eaf71b517a) | [Code](src/3730a000-ab64-477d-8b0f-70eaf71b517a/code.php) | [Settings](src/3730a000-ab64-477d-8b0f-70eaf71b517a/settings.json) | Super__3730a000_ab64_477d_8b0f_70eaf71b517a__Power
- **class Config** | [Details](src/fa4bf18e-301e-42e3-91fb-6e0096c07adc) | [Code](src/fa4bf18e-301e-42e3-91fb-6e0096c07adc/code.php) | [Settings](src/fa4bf18e-301e-42e3-91fb-6e0096c07adc/settings.json) | Super__fa4bf18e_301e_42e3_91fb_6e0096c07adc__Power
- **class Customcode** | [Details](src/313b43c4-98c3-4f62-9177-2d73ec8eba31) | [Code](src/313b43c4-98c3-4f62-9177-2d73ec8eba31/code.php) | [Settings](src/313b43c4-98c3-4f62-9177-2d73ec8eba31/settings.json) | Super__313b43c4_98c3_4f62_9177_2d73ec8eba31__Power
- **class Field** | [Details](src/d7ba2d5d-10b6-470d-978d-9f91ea65ee75) | [Code](src/d7ba2d5d-10b6-470d-978d-9f91ea65ee75/code.php) | [Settings](src/d7ba2d5d-10b6-470d-978d-9f91ea65ee75/settings.json) | Super__d7ba2d5d_10b6_470d_978d_9f91ea65ee75__Power
@ -40,14 +41,21 @@ This repository contains an index (see below) of all the approved powers within
- **Namespace**: [VDM\Joomla\Componentbuilder\Interfaces](#vdm-joomla-componentbuilder-interfaces)
- **interface Cryptinterface** | [Details](src/81de8f57-dd9c-4a17-964f-848cd4a0743b) | [Code](src/81de8f57-dd9c-4a17-964f-848cd4a0743b/code.php) | [Settings](src/81de8f57-dd9c-4a17-964f-848cd4a0743b/settings.json) | Super__81de8f57_dd9c_4a17_964f_848cd4a0743b__Power
- **interface GrepInterface** | [Details](src/c182506a-ab84-439c-b962-1e606b58d545) | [Code](src/c182506a-ab84-439c-b962-1e606b58d545/code.php) | [Settings](src/c182506a-ab84-439c-b962-1e606b58d545/settings.json) | Super__c182506a_ab84_439c_b962_1e606b58d545__Power
- **interface Serverinterface** | [Details](src/86ac0760-26f5-4746-9c7f-ce77860f80f8) | [Code](src/86ac0760-26f5-4746-9c7f-ce77860f80f8/code.php) | [Settings](src/86ac0760-26f5-4746-9c7f-ce77860f80f8/settings.json) | Super__86ac0760_26f5_4746_9c7f_ce77860f80f8__Power
- **interface SuperInterface** | [Details](src/51de80f2-2868-4c2c-8198-ef79349e9bd7) | [Code](src/51de80f2-2868-4c2c-8198-ef79349e9bd7/code.php) | [Settings](src/51de80f2-2868-4c2c-8198-ef79349e9bd7/settings.json) | Super__51de80f2_2868_4c2c_8198_ef79349e9bd7__Power
- **Namespace**: [VDM\Joomla\Componentbuilder\JoomlaPower](#vdm-joomla-componentbuilder-joomlapower)
- **abstract class Factory** | [Details](src/6ee3dc9e-1949-4da5-a74f-d9eb7f14e400) | [Code](src/6ee3dc9e-1949-4da5-a74f-d9eb7f14e400/code.php) | [Settings](src/6ee3dc9e-1949-4da5-a74f-d9eb7f14e400/settings.json) | Super__6ee3dc9e_1949_4da5_a74f_d9eb7f14e400__Power
- **final class Grep** | [Details](src/355bf21a-f859-4528-9110-bcd2c6d05ea7) | [Code](src/355bf21a-f859-4528-9110-bcd2c6d05ea7/code.php) | [Settings](src/355bf21a-f859-4528-9110-bcd2c6d05ea7/settings.json) | Super__355bf21a_f859_4528_9110_bcd2c6d05ea7__Power
- **final class Super** | [Details](src/39a75870-a7f7-45fd-937d-5ba97b85b8ad) | [Code](src/39a75870-a7f7-45fd-937d-5ba97b85b8ad/code.php) | [Settings](src/39a75870-a7f7-45fd-937d-5ba97b85b8ad/settings.json) | Super__39a75870_a7f7_45fd_937d_5ba97b85b8ad__Power
- **Namespace**: [VDM\Joomla\Componentbuilder\Power](#vdm-joomla-componentbuilder-power)
- **abstract class Factory** | [Details](src/a5734b9e-a72d-494c-bc72-c3bc7506015f) | [Code](src/a5734b9e-a72d-494c-bc72-c3bc7506015f/code.php) | [Settings](src/a5734b9e-a72d-494c-bc72-c3bc7506015f/settings.json) | Super__a5734b9e_a72d_494c_bc72_c3bc7506015f__Power
- **final class Generator** | [Details](src/505801ac-d3e2-44c6-a300-9a57a96170c6) | [Code](src/505801ac-d3e2-44c6-a300-9a57a96170c6/code.php) | [Settings](src/505801ac-d3e2-44c6-a300-9a57a96170c6/settings.json) | Super__505801ac_d3e2_44c6_a300_9a57a96170c6__Power
- **final class Grep** | [Details](src/6784dd52-0909-451a-a872-9a942a023c68) | [Code](src/6784dd52-0909-451a-a872-9a942a023c68/code.php) | [Settings](src/6784dd52-0909-451a-a872-9a942a023c68/settings.json) | Super__6784dd52_0909_451a_a872_9a942a023c68__Power
- **final class Super** | [Details](src/3ab0eba9-f37b-4b37-aec1-2e78067f2aff) | [Code](src/3ab0eba9-f37b-4b37-aec1-2e78067f2aff/code.php) | [Settings](src/3ab0eba9-f37b-4b37-aec1-2e78067f2aff/settings.json) | Super__3ab0eba9_f37b_4b37_aec1_2e78067f2aff__Power
- **class Config** | [Details](src/be4ccfae-65a9-401e-bdbe-637d8c226954) | [Code](src/be4ccfae-65a9-401e-bdbe-637d8c226954/code.php) | [Settings](src/be4ccfae-65a9-401e-bdbe-637d8c226954/settings.json) | Super__be4ccfae_65a9_401e_bdbe_637d8c226954__Power
- **class Grep** | [Details](src/6784dd52-0909-451a-a872-9a942a023c68) | [Code](src/6784dd52-0909-451a-a872-9a942a023c68/code.php) | [Settings](src/6784dd52-0909-451a-a872-9a942a023c68/settings.json) | Super__6784dd52_0909_451a_a872_9a942a023c68__Power
- **class Super** | [Details](src/3ab0eba9-f37b-4b37-aec1-2e78067f2aff) | [Code](src/3ab0eba9-f37b-4b37-aec1-2e78067f2aff/code.php) | [Settings](src/3ab0eba9-f37b-4b37-aec1-2e78067f2aff/settings.json) | Super__3ab0eba9_f37b_4b37_aec1_2e78067f2aff__Power
- **Namespace**: [VDM\Joomla\Componentbuilder\Service](#vdm-joomla-componentbuilder-service)
- **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) | Super__f65b52c2_593a_4c35_89d1_4a8e57a1adf0__Power
@ -252,6 +260,10 @@ This repository contains an index (see below) of all the approved powers within
- **final class Event** | [Details](src/4729c2b0-f12b-4397-8d77-055d38bca98b) | [Code](src/4729c2b0-f12b-4397-8d77-055d38bca98b/code.php) | [Settings](src/4729c2b0-f12b-4397-8d77-055d38bca98b/settings.json) | Super__4729c2b0_f12b_4397_8d77_055d38bca98b__Power
- **final class Header** | [Details](src/1ee227b9-da0f-4e7b-ae66-99a9d53f6f49) | [Code](src/1ee227b9-da0f-4e7b-ae66-99a9d53f6f49/code.php) | [Settings](src/1ee227b9-da0f-4e7b-ae66-99a9d53f6f49/settings.json) | Super__1ee227b9_da0f_4e7b_ae66_99a9d53f6f49__Power
- **final class History** | [Details](src/25c7ca86-6088-4f5f-b9fe-13504779c6ba) | [Code](src/25c7ca86-6088-4f5f-b9fe-13504779c6ba/code.php) | [Settings](src/25c7ca86-6088-4f5f-b9fe-13504779c6ba/settings.json) | Super__25c7ca86_6088_4f5f_b9fe_13504779c6ba__Power
- **Namespace**: [VDM\Joomla\Componentbuilder\Compiler\JoomlaPower](#vdm-joomla-componentbuilder-compiler-joomlapower)
- **final class Extractor** | [Details](src/82505f3f-297f-4d75-a581-929ab3e93689) | [Code](src/82505f3f-297f-4d75-a581-929ab3e93689/code.php) | [Settings](src/82505f3f-297f-4d75-a581-929ab3e93689/settings.json) | Super__82505f3f_297f_4d75_a581_929ab3e93689__Power
- **final class Injector** | [Details](src/a6052fe9-0d2b-4b36-b3e7-03b47c483542) | [Code](src/a6052fe9-0d2b-4b36-b3e7-03b47c483542/code.php) | [Settings](src/a6052fe9-0d2b-4b36-b3e7-03b47c483542/settings.json) | Super__a6052fe9_0d2b_4b36_b3e7_03b47c483542__Power
- **Namespace**: [VDM\Joomla\Componentbuilder\Compiler\JoomlaThree](#vdm-joomla-componentbuilder-compiler-joomlathree)
- **final class Event** | [Details](src/4b86f62e-ce41-4325-a11a-08148807d0df) | [Code](src/4b86f62e-ce41-4325-a11a-08148807d0df/code.php) | [Settings](src/4b86f62e-ce41-4325-a11a-08148807d0df/settings.json) | Super__4b86f62e_ce41_4325_a11a_08148807d0df__Power
@ -318,11 +330,11 @@ This repository contains an index (see below) of all the approved powers within
- **class Reverse** | [Details](src/ca111518-e47c-4049-b1b2-cb010f23866f) | [Code](src/ca111518-e47c-4049-b1b2-cb010f23866f/code.php) | [Settings](src/ca111518-e47c-4049-b1b2-cb010f23866f/settings.json) | Super__ca111518_e47c_4049_b1b2_cb010f23866f__Power
- **Namespace**: [VDM\Joomla\Componentbuilder\Compiler\Power](#vdm-joomla-componentbuilder-compiler-power)
- **final class Extractor** | [Details](src/eeb03266-22fd-45bb-953a-961bb6be3a54) | [Code](src/eeb03266-22fd-45bb-953a-961bb6be3a54/code.php) | [Settings](src/eeb03266-22fd-45bb-953a-961bb6be3a54/settings.json) | Super__eeb03266_22fd_45bb_953a_961bb6be3a54__Power
- **final class Injector** | [Details](src/763d137c-42bc-4282-98d8-cc5c0654985f) | [Code](src/763d137c-42bc-4282-98d8-cc5c0654985f/code.php) | [Settings](src/763d137c-42bc-4282-98d8-cc5c0654985f/settings.json) | Super__763d137c_42bc_4282_98d8_cc5c0654985f__Power
- **final class Parser** | [Details](src/95d0e03f-24fd-4412-bc2e-f0899fcc3205) | [Code](src/95d0e03f-24fd-4412-bc2e-f0899fcc3205/code.php) | [Settings](src/95d0e03f-24fd-4412-bc2e-f0899fcc3205/settings.json) | Super__95d0e03f_24fd_4412_bc2e_f0899fcc3205__Power
- **class Autoloader** | [Details](src/6e64917c-d687-4ef3-a655-811319f5a81e) | [Code](src/6e64917c-d687-4ef3-a655-811319f5a81e/code.php) | [Settings](src/6e64917c-d687-4ef3-a655-811319f5a81e/settings.json) | Super__6e64917c_d687_4ef3_a655_811319f5a81e__Power
- **class Extractor** | [Details](src/eeb03266-22fd-45bb-953a-961bb6be3a54) | [Code](src/eeb03266-22fd-45bb-953a-961bb6be3a54/code.php) | [Settings](src/eeb03266-22fd-45bb-953a-961bb6be3a54/settings.json) | Super__eeb03266_22fd_45bb_953a_961bb6be3a54__Power
- **class Infusion** | [Details](src/0419081e-4cb3-4c65-8c6a-ffe941fb0f1c) | [Code](src/0419081e-4cb3-4c65-8c6a-ffe941fb0f1c/code.php) | [Settings](src/0419081e-4cb3-4c65-8c6a-ffe941fb0f1c/settings.json) | Super__0419081e_4cb3_4c65_8c6a_ffe941fb0f1c__Power
- **class Injector** | [Details](src/763d137c-42bc-4282-98d8-cc5c0654985f) | [Code](src/763d137c-42bc-4282-98d8-cc5c0654985f/code.php) | [Settings](src/763d137c-42bc-4282-98d8-cc5c0654985f/settings.json) | Super__763d137c_42bc_4282_98d8_cc5c0654985f__Power
- **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) | Super__ff5e9e63_86d0_4691_ab59_d4b9d9154096__Power
- **class Structure** | [Details](src/324566de-0f7d-4b6e-9caf-8424d55013ae) | [Code](src/324566de-0f7d-4b6e-9caf-8424d55013ae/code.php) | [Settings](src/324566de-0f7d-4b6e-9caf-8424d55013ae/settings.json) | Super__324566de_0f7d_4b6e_9caf_8424d55013ae__Power
- **Namespace**: [VDM\Joomla\Componentbuilder\Compiler\Service](#vdm-joomla-componentbuilder-compiler-service)
@ -342,6 +354,7 @@ This repository contains an index (see below) of all the approved powers within
- **class Field** | [Details](src/c6c30d66-3106-44eb-9272-b2cf7ec74613) | [Code](src/c6c30d66-3106-44eb-9272-b2cf7ec74613/code.php) | [Settings](src/c6c30d66-3106-44eb-9272-b2cf7ec74613/settings.json) | Super__c6c30d66_3106_44eb_9272_b2cf7ec74613__Power
- **class Header** | [Details](src/36d49d4a-8d0e-435f-ab4c-8f247d96fd4d) | [Code](src/36d49d4a-8d0e-435f-ab4c-8f247d96fd4d/code.php) | [Settings](src/36d49d4a-8d0e-435f-ab4c-8f247d96fd4d/settings.json) | Super__36d49d4a_8d0e_435f_ab4c_8f247d96fd4d__Power
- **class History** | [Details](src/63782f74-7b03-4745-aa40-0adf8ed4e704) | [Code](src/63782f74-7b03-4745-aa40-0adf8ed4e704/code.php) | [Settings](src/63782f74-7b03-4745-aa40-0adf8ed4e704/settings.json) | Super__63782f74_7b03_4745_aa40_0adf8ed4e704__Power
- **class JoomlaPower** | [Details](src/5716c79f-a1c9-4059-9d00-8cccb9f9e061) | [Code](src/5716c79f-a1c9-4059-9d00-8cccb9f9e061/code.php) | [Settings](src/5716c79f-a1c9-4059-9d00-8cccb9f9e061/settings.json) | Super__5716c79f_a1c9_4059_9d00_8cccb9f9e061__Power
- **class Joomlamodule** | [Details](src/295186de-5954-4a65-a4c1-2f79ef305743) | [Code](src/295186de-5954-4a65-a4c1-2f79ef305743/code.php) | [Settings](src/295186de-5954-4a65-a4c1-2f79ef305743/settings.json) | Super__295186de_5954_4a65_a4c1_2f79ef305743__Power
- **class Joomlaplugin** | [Details](src/9eba241c-af90-42dd-ae05-92ff4d8391d3) | [Code](src/9eba241c-af90-42dd-ae05-92ff4d8391d3/code.php) | [Settings](src/9eba241c-af90-42dd-ae05-92ff4d8391d3/settings.json) | Super__9eba241c_af90_42dd_ae05_92ff4d8391d3__Power
- **class Language** | [Details](src/9f00e793-86f8-4ef9-b775-a3eb129f83c0) | [Code](src/9f00e793-86f8-4ef9-b775-a3eb129f83c0/code.php) | [Settings](src/9f00e793-86f8-4ef9-b775-a3eb129f83c0/settings.json) | Super__9f00e793_86f8_4ef9_b775_a3eb129f83c0__Power
@ -371,11 +384,28 @@ This repository contains an index (see below) of all the approved powers within
- **class Pathfix** | [Details](src/cdc9b06d-8333-4fa7-ab4d-b810dd90f95f) | [Code](src/cdc9b06d-8333-4fa7-ab4d-b810dd90f95f/code.php) | [Settings](src/cdc9b06d-8333-4fa7-ab4d-b810dd90f95f/settings.json) | Super__cdc9b06d_8333_4fa7_ab4d_b810dd90f95f__Power
- **class Paths** | [Details](src/6f20369a-8536-4870-a1a3-cda254c939c8) | [Code](src/6f20369a-8536-4870-a1a3-cda254c939c8/code.php) | [Settings](src/6f20369a-8536-4870-a1a3-cda254c939c8/settings.json) | Super__6f20369a_8536_4870_a1a3_cda254c939c8__Power
- **class Structure** | [Details](src/1efdded5-d6c8-452c-8f37-0374483a7b3f) | [Code](src/1efdded5-d6c8-452c-8f37-0374483a7b3f/code.php) | [Settings](src/1efdded5-d6c8-452c-8f37-0374483a7b3f/settings.json) | Super__1efdded5_d6c8_452c_8f37_0374483a7b3f__Power
- **Namespace**: [VDM\Joomla\Componentbuilder\Interfaces\Database](#vdm-joomla-componentbuilder-interfaces-database)
- **interface InsertInterface** | [Details](src/95c02df3-fe0a-405b-b506-b7a5b8605b66) | [Code](src/95c02df3-fe0a-405b-b506-b7a5b8605b66/code.php) | [Settings](src/95c02df3-fe0a-405b-b506-b7a5b8605b66/settings.json) | Super__95c02df3_fe0a_405b_b506_b7a5b8605b66__Power
- **interface UpdateInterface** | [Details](src/69c29be3-ab25-4f56-944e-7ada6307b10c) | [Code](src/69c29be3-ab25-4f56-944e-7ada6307b10c/code.php) | [Settings](src/69c29be3-ab25-4f56-944e-7ada6307b10c/settings.json) | Super__69c29be3_ab25_4f56_944e_7ada6307b10c__Power
- **Namespace**: [VDM\Joomla\Componentbuilder\JoomlaPower\Database](#vdm-joomla-componentbuilder-joomlapower-database)
- **final class Insert** | [Details](src/9d53d45e-9b4d-45ec-827b-4916b91c907e) | [Code](src/9d53d45e-9b4d-45ec-827b-4916b91c907e/code.php) | [Settings](src/9d53d45e-9b4d-45ec-827b-4916b91c907e/settings.json) | Super__9d53d45e_9b4d_45ec_827b_4916b91c907e__Power
- **final class Load** | [Details](src/b4ea5de3-653f-43f9-b927-4ba6456b4d0a) | [Code](src/b4ea5de3-653f-43f9-b927-4ba6456b4d0a/code.php) | [Settings](src/b4ea5de3-653f-43f9-b927-4ba6456b4d0a/settings.json) | Super__b4ea5de3_653f_43f9_b927_4ba6456b4d0a__Power
- **final class Update** | [Details](src/679473f6-3ea2-49d5-8273-1b29c8f0ad2b) | [Code](src/679473f6-3ea2-49d5-8273-1b29c8f0ad2b/code.php) | [Settings](src/679473f6-3ea2-49d5-8273-1b29c8f0ad2b/settings.json) | Super__679473f6_3ea2_49d5_8273_1b29c8f0ad2b__Power
- **Namespace**: [VDM\Joomla\Componentbuilder\JoomlaPower\Model](#vdm-joomla-componentbuilder-joomlapower-model)
- **final class Load** | [Details](src/05744dd3-4030-4cf8-8dda-a93ab809b473) | [Code](src/05744dd3-4030-4cf8-8dda-a93ab809b473/code.php) | [Settings](src/05744dd3-4030-4cf8-8dda-a93ab809b473/settings.json) | Super__05744dd3_4030_4cf8_8dda_a93ab809b473__Power
- **final class Upsert** | [Details](src/9206082e-a3f7-472e-98b2-de90d06cbdcd) | [Code](src/9206082e-a3f7-472e-98b2-de90d06cbdcd/code.php) | [Settings](src/9206082e-a3f7-472e-98b2-de90d06cbdcd/settings.json) | Super__9206082e_a3f7_472e_98b2_de90d06cbdcd__Power
- **Namespace**: [VDM\Joomla\Componentbuilder\JoomlaPower\Service](#vdm-joomla-componentbuilder-joomlapower-service)
- **class Database** | [Details](src/a2992a91-eec2-4957-811b-8cde22aa1438) | [Code](src/a2992a91-eec2-4957-811b-8cde22aa1438/code.php) | [Settings](src/a2992a91-eec2-4957-811b-8cde22aa1438/settings.json) | Super__a2992a91_eec2_4957_811b_8cde22aa1438__Power
- **Namespace**: [VDM\Joomla\Componentbuilder\Power\Database](#vdm-joomla-componentbuilder-power-database)
- **final class Insert** | [Details](src/380bb7a3-cdcc-4336-a699-5070cbf521a5) | [Code](src/380bb7a3-cdcc-4336-a699-5070cbf521a5/code.php) | [Settings](src/380bb7a3-cdcc-4336-a699-5070cbf521a5/settings.json) | Super__380bb7a3_cdcc_4336_a699_5070cbf521a5__Power
- **final class Load** | [Details](src/1f86db0f-e271-45df-8795-3e503ec76698) | [Code](src/1f86db0f-e271-45df-8795-3e503ec76698/code.php) | [Settings](src/1f86db0f-e271-45df-8795-3e503ec76698/settings.json) | Super__1f86db0f_e271_45df_8795_3e503ec76698__Power
- **final class Update** | [Details](src/e543c123-b1d9-4a0b-83b2-a9d371da5ff3) | [Code](src/e543c123-b1d9-4a0b-83b2-a9d371da5ff3/code.php) | [Settings](src/e543c123-b1d9-4a0b-83b2-a9d371da5ff3/settings.json) | Super__e543c123_b1d9_4a0b_83b2_a9d371da5ff3__Power
- **interface LoadInterface** | [Details](src/99786f53-64b7-4d52-95b0-5306e7386c3f) | [Code](src/99786f53-64b7-4d52-95b0-5306e7386c3f/code.php) | [Settings](src/99786f53-64b7-4d52-95b0-5306e7386c3f/settings.json) | Super__99786f53_64b7_4d52_95b0_5306e7386c3f__Power
- **class Insert** | [Details](src/380bb7a3-cdcc-4336-a699-5070cbf521a5) | [Code](src/380bb7a3-cdcc-4336-a699-5070cbf521a5/code.php) | [Settings](src/380bb7a3-cdcc-4336-a699-5070cbf521a5/settings.json) | Super__380bb7a3_cdcc_4336_a699_5070cbf521a5__Power
- **class Load** | [Details](src/1f86db0f-e271-45df-8795-3e503ec76698) | [Code](src/1f86db0f-e271-45df-8795-3e503ec76698/code.php) | [Settings](src/1f86db0f-e271-45df-8795-3e503ec76698/settings.json) | Super__1f86db0f_e271_45df_8795_3e503ec76698__Power
- **class Update** | [Details](src/e543c123-b1d9-4a0b-83b2-a9d371da5ff3) | [Code](src/e543c123-b1d9-4a0b-83b2-a9d371da5ff3/code.php) | [Settings](src/e543c123-b1d9-4a0b-83b2-a9d371da5ff3/settings.json) | Super__e543c123_b1d9_4a0b_83b2_a9d371da5ff3__Power
- **Namespace**: [VDM\Joomla\Componentbuilder\Power\Generator](#vdm-joomla-componentbuilder-power-generator)
- **final class Bucket** | [Details](src/5d4278f0-7db2-498f-872a-c974bd8ce334) | [Code](src/5d4278f0-7db2-498f-872a-c974bd8ce334/code.php) | [Settings](src/5d4278f0-7db2-498f-872a-c974bd8ce334/settings.json) | Super__5d4278f0_7db2_498f_872a_c974bd8ce334__Power
@ -386,8 +416,8 @@ This repository contains an index (see below) of all the approved powers within
- **final class ServiceProviderBuilder** | [Details](src/8a2a3ee5-6ce2-4604-91e2-01f770228960) | [Code](src/8a2a3ee5-6ce2-4604-91e2-01f770228960/code.php) | [Settings](src/8a2a3ee5-6ce2-4604-91e2-01f770228960/settings.json) | Super__8a2a3ee5_6ce2_4604_91e2_01f770228960__Power
- **Namespace**: [VDM\Joomla\Componentbuilder\Power\Model](#vdm-joomla-componentbuilder-power-model)
- **final class Load** | [Details](src/bb29a833-73f7-4283-9327-bc7e41f0723b) | [Code](src/bb29a833-73f7-4283-9327-bc7e41f0723b/code.php) | [Settings](src/bb29a833-73f7-4283-9327-bc7e41f0723b/settings.json) | Super__bb29a833_73f7_4283_9327_bc7e41f0723b__Power
- **final class Upsert** | [Details](src/7c1fb50f-8fb1-4627-8705-6fedf7182ca5) | [Code](src/7c1fb50f-8fb1-4627-8705-6fedf7182ca5/code.php) | [Settings](src/7c1fb50f-8fb1-4627-8705-6fedf7182ca5/settings.json) | Super__7c1fb50f_8fb1_4627_8705_6fedf7182ca5__Power
- **class Load** | [Details](src/bb29a833-73f7-4283-9327-bc7e41f0723b) | [Code](src/bb29a833-73f7-4283-9327-bc7e41f0723b/code.php) | [Settings](src/bb29a833-73f7-4283-9327-bc7e41f0723b/settings.json) | Super__bb29a833_73f7_4283_9327_bc7e41f0723b__Power
- **class Upsert** | [Details](src/7c1fb50f-8fb1-4627-8705-6fedf7182ca5) | [Code](src/7c1fb50f-8fb1-4627-8705-6fedf7182ca5/code.php) | [Settings](src/7c1fb50f-8fb1-4627-8705-6fedf7182ca5/settings.json) | Super__7c1fb50f_8fb1_4627_8705_6fedf7182ca5__Power
- **Namespace**: [VDM\Joomla\Componentbuilder\Power\Service](#vdm-joomla-componentbuilder-power-service)
- **class Database** | [Details](src/7243aaf6-b76c-4391-8698-50abbfc98fbe) | [Code](src/7243aaf6-b76c-4391-8698-50abbfc98fbe/code.php) | [Settings](src/7243aaf6-b76c-4391-8698-50abbfc98fbe/settings.json) | Super__7243aaf6_b76c_4391_8698_50abbfc98fbe__Power
@ -457,6 +487,10 @@ This repository contains an index (see below) of all the approved powers within
- **Namespace**: [VDM\Joomla\Componentbuilder\Compiler\Interfaces\Model](#vdm-joomla-componentbuilder-compiler-interfaces-model)
- **interface CustomtabsInterface** | [Details](src/fcf42c53-0967-4c87-9699-a4d86adfdadf) | [Code](src/fcf42c53-0967-4c87-9699-a4d86adfdadf/code.php) | [Settings](src/fcf42c53-0967-4c87-9699-a4d86adfdadf/settings.json) | Super__fcf42c53_0967_4c87_9699_a4d86adfdadf__Power
- **Namespace**: [VDM\Joomla\Componentbuilder\Compiler\Interfaces\Power](#vdm-joomla-componentbuilder-compiler-interfaces-power)
- **interface ExtractorInterface** | [Details](src/c159425c-51f9-4a15-af99-f2d0c6d7aae8) | [Code](src/c159425c-51f9-4a15-af99-f2d0c6d7aae8/code.php) | [Settings](src/c159425c-51f9-4a15-af99-f2d0c6d7aae8/settings.json) | Super__c159425c_51f9_4a15_af99_f2d0c6d7aae8__Power
- **interface InjectorInterface** | [Details](src/e923311a-4058-4e81-9f67-5956fd0c627c) | [Code](src/e923311a-4058-4e81-9f67-5956fd0c627c/code.php) | [Settings](src/e923311a-4058-4e81-9f67-5956fd0c627c/settings.json) | Super__e923311a_4058_4e81_9f67_5956fd0c627c__Power
- **Namespace**: [VDM\Joomla\Componentbuilder\Compiler\Model\JoomlaFive](#vdm-joomla-componentbuilder-compiler-model-joomlafive)
- **final class Customtabs** | [Details](src/92cc3144-1d3d-45b2-b49f-c7d356950033) | [Code](src/92cc3144-1d3d-45b2-b49f-c7d356950033/code.php) | [Settings](src/92cc3144-1d3d-45b2-b49f-c7d356950033/settings.json) | Super__92cc3144_1d3d_45b2_b49f_c7d356950033__Power

View File

@ -0,0 +1,38 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# final class Load (Details)
> namespace: **VDM\Joomla\Componentbuilder\JoomlaPower\Model**
> extends: **Load**
```uml
@startuml
class Load << (F,LightGreen) >> #RoyalBlue {
# getTable() : string
}
note right of Load::getTable
Get the current active table
since: 3.2.0
return: string
end note
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,37 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\JoomlaPower\Model;
use VDM\Joomla\Interfaces\ModelInterface;
use VDM\Joomla\Componentbuilder\Power\Model\Load;
/**
* Joomla Power Model Load
*
* @since 3.2.0
*/
final class Load extends Load implements ModelInterface
{
/**
* Get the current active table
*
* @return string
* @since 3.2.0
*/
protected function getTable(): string
{
return 'joomla_power';
}
}

View File

@ -0,0 +1,10 @@
/**
* Get the current active table
*
* @return string
* @since 3.2.0
*/
protected function getTable(): string
{
return 'joomla_power';
}

View File

@ -0,0 +1,20 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "bb29a833-73f7-4283-9327-bc7e41f0723b",
"guid": "05744dd3-4030-4cf8-8dda-a93ab809b473",
"implements": [
"8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff"
],
"load_selection": null,
"name": "Load",
"power_version": "1.0.0",
"system_name": "JCB.JoomlaPower.Model.Load",
"type": "final class",
"use_selection": null,
"namespace": "VDM\\Joomla\\Componentbuilder.JoomlaPower.Model.Load",
"description": "Joomla Power Model Load\r\n\r\n@since 3.2.0",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
"head": "",
"composer": ""
}

View File

@ -6,13 +6,14 @@
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# final class Load (Details)
# class Load (Details)
> namespace: **VDM\Joomla\Componentbuilder\Power\Database**
```uml
@startuml
class Load << (F,LightGreen) >> #RoyalBlue {
class Load #Gold {
# Model $model
# Database $load
# string $table
+ __construct(Model $model, Database $load)
+ value(array $keys, string $field) : mixed
+ item(array $keys) : ?object

View File

@ -12,8 +12,9 @@
namespace VDM\Joomla\Componentbuilder\Power\Database;
use VDM\Joomla\Componentbuilder\Power\Model\Load as Model;
use VDM\Joomla\Interfaces\ModelInterface as Model;
use VDM\Joomla\Database\Load as Database;
use VDM\Joomla\Componentbuilder\Power\Database\LoadInterface;
/**
@ -21,7 +22,7 @@ use VDM\Joomla\Database\Load as Database;
*
* @since 2.0.1
*/
final class Load
class Load implements LoadInterface
{
/**
* Model Load
@ -39,6 +40,14 @@ final class Load
*/
protected Database $load;
/**
* Table Name
*
* @var string
* @since 3.2.1
*/
protected string $table = 'power';
/**
* Constructor
*
@ -74,11 +83,11 @@ final class Load
return $this->model->value(
$this->load->value(
["a.{$field}" => $field],
['a' => 'power'],
['a' => $this->table],
$this->prefix($keys)
),
$field,
'power'
$this->table
);
}
@ -101,10 +110,10 @@ final class Load
return $this->model->item(
$this->load->item(
['all' => 'a.*'],
['a' => 'power'],
['a' => $this->table],
$this->prefix($keys)
),
'power'
$this->table
);
}
@ -130,9 +139,9 @@ final class Load
{
return $this->model->items(
$this->load->items(
['all' => 'a.*'], ['a' => 'power'], $this->prefix($keys)
['all' => 'a.*'], ['a' => $this->table], $this->prefix($keys)
),
'power'
$this->table
);
}

View File

@ -14,6 +14,14 @@
*/
protected Database $load;
/**
* Table Name
*
* @var string
* @since 3.2.1
*/
protected string $table = 'power';
/**
* Constructor
*
@ -49,11 +57,11 @@
return $this->model->value(
$this->load->value(
["a.{$field}" => $field],
['a' => 'power'],
['a' => $this->table],
$this->prefix($keys)
),
$field,
'power'
$this->table
);
}
@ -76,10 +84,10 @@
return $this->model->item(
$this->load->item(
['all' => 'a.*'],
['a' => 'power'],
['a' => $this->table],
$this->prefix($keys)
),
'power'
$this->table
);
}
@ -105,9 +113,9 @@
{
return $this->model->items(
$this->load->items(
['all' => 'a.*'], ['a' => 'power'], $this->prefix($keys)
['all' => 'a.*'], ['a' => $this->table], $this->prefix($keys)
),
'power'
$this->table
);
}

View File

@ -3,15 +3,17 @@
"add_licensing_template": "2",
"extends": "0",
"guid": "1f86db0f-e271-45df-8795-3e503ec76698",
"implements": null,
"implements": [
"99786f53-64b7-4d52-95b0-5306e7386c3f"
],
"load_selection": null,
"name": "Load",
"power_version": "1.0.0",
"system_name": "JCB.Power.Database.Load",
"type": "final class",
"type": "class",
"use_selection": {
"use_selection0": {
"use": "bb29a833-73f7-4283-9327-bc7e41f0723b",
"use": "8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff",
"as": "Model"
},
"use_selection1": {

View File

@ -0,0 +1,62 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# final class Grep (Details)
> namespace: **VDM\Joomla\Componentbuilder\JoomlaPower**
> extends: **Grep**
```uml
@startuml
class Grep << (F,LightGreen) >> #RoyalBlue {
- getLocal(object $path, string $guid) : ?object
- getRemote(object $path, string $guid) : ?object
- localIndex(object $path) : void
- remoteIndex(object $path) : void
}
note right of Grep::getLocal
Get a local power
since: 3.2.0
return: ?object
end note
note right of Grep::getRemote
Get a remote power
since: 3.2.0
return: ?object
end note
note right of Grep::localIndex
Load the local repository index of powers
since: 3.2.0
return: void
end note
note right of Grep::remoteIndex
Load the remote repository index of powers
since: 3.2.0
return: void
end note
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,146 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\JoomlaPower;
use VDM\Joomla\Utilities\FileHelper;
use VDM\Joomla\Utilities\JsonHelper;
use VDM\Joomla\Componentbuilder\Interfaces\GrepInterface;
use VDM\Joomla\Componentbuilder\Power\Grep;
/**
* Global Resource Empowerment Platform
*
* The Grep feature will try to find your joomla power in the repositories listed in the global
* Options of JCB in the super powers tab, and if it can't be found there will try the global core
* Super powers of JCB. All searches are performed according the the [algorithm:cascading]
* See documentation for more details: https://git.vdm.dev/joomla/super-powers/wiki
*
* @since 3.2.1
*/
final class Grep extends Grep implements GrepInterface
{
/**
* Get a local power
*
* @param object $path The repository path details
* @param string $guid The global unique id of the power
*
* @return object|null
* @since 3.2.0
*/
private function getLocal(object $path, string $guid): ?object
{
if (empty($path->local->{$guid}->settings))
{
return null;
}
// get the settings
if (($settings = FileHelper::getContent($path->full_path . '/' . $path->local->{$guid}->settings, null)) !== null &&
JsonHelper::check($settings))
{
$power = json_decode($settings);
if (isset($power->guid))
{
return $power;
}
}
return null;
}
/**
* Get a remote power
*
* @param object $path The repository path details
* @param string $guid The global unique id of the power
*
* @return object|null
* @since 3.2.0
*/
private function getRemote(object $path, string $guid): ?object
{
if (empty($path->index->{$guid}->settings))
{
return null;
}
// get the settings
if (($power = $this->loadRemoteFile($path->owner, $path->repo, $path->index->{$guid}->settings, $path->branch)) !== null &&
isset($power->guid))
{
return $power;
}
return null;
}
/**
* Load the local repository index of powers
*
* @param object $path The repository path details
*
* @return void
* @since 3.2.0
*/
private function localIndex(object &$path)
{
if (isset($path->local) || !isset($path->full_path))
{
return;
}
if (($content = FileHelper::getContent($path->full_path . '/joomla-powers.json', null)) !== null &&
JsonHelper::check($content))
{
$path->local = json_decode($content);
return;
}
$path->local = null;
}
/**
* Load the remote repository index of powers
*
* @param object $path The repository path details
*
* @return void
* @since 3.2.0
*/
private function remoteIndex(object &$path)
{
if (isset($path->index))
{
return;
}
try
{
$path->index = $this->contents->get($path->owner, $path->repo, 'joomla-powers.json', $path->branch);
}
catch (\Exception $e)
{
$this->app->enqueueMessage(
Text::sprintf('COM_COMPONENTBUILDER_PSUPER_POWERB_REPOSITORY_AT_BSSB_GAVE_THE_FOLLOWING_ERRORBR_SP', $this->contents->api(), $path->path, $e->getMessage()),
'Error'
);
$path->index = null;
}
}
}

View File

@ -0,0 +1,112 @@
/**
* Get a local power
*
* @param object $path The repository path details
* @param string $guid The global unique id of the power
*
* @return object|null
* @since 3.2.0
*/
private function getLocal(object $path, string $guid): ?object
{
if (empty($path->local->{$guid}->settings))
{
return null;
}
// get the settings
if (($settings = FileHelper::getContent($path->full_path . '/' . $path->local->{$guid}->settings, null)) !== null &&
JsonHelper::check($settings))
{
$power = json_decode($settings);
if (isset($power->guid))
{
return $power;
}
}
return null;
}
/**
* Get a remote power
*
* @param object $path The repository path details
* @param string $guid The global unique id of the power
*
* @return object|null
* @since 3.2.0
*/
private function getRemote(object $path, string $guid): ?object
{
if (empty($path->index->{$guid}->settings))
{
return null;
}
// get the settings
if (($power = $this->loadRemoteFile($path->owner, $path->repo, $path->index->{$guid}->settings, $path->branch)) !== null &&
isset($power->guid))
{
return $power;
}
return null;
}
/**
* Load the local repository index of powers
*
* @param object $path The repository path details
*
* @return void
* @since 3.2.0
*/
private function localIndex(object &$path)
{
if (isset($path->local) || !isset($path->full_path))
{
return;
}
if (($content = FileHelper::getContent($path->full_path . '/joomla-powers.json', null)) !== null &&
JsonHelper::check($content))
{
$path->local = json_decode($content);
return;
}
$path->local = null;
}
/**
* Load the remote repository index of powers
*
* @param object $path The repository path details
*
* @return void
* @since 3.2.0
*/
private function remoteIndex(object &$path)
{
if (isset($path->index))
{
return;
}
try
{
$path->index = $this->contents->get($path->owner, $path->repo, 'joomla-powers.json', $path->branch);
}
catch (\Exception $e)
{
$this->app->enqueueMessage(
Text::sprintf('<p>Super Power</b> repository at <b>%s/%s</b> gave the following error!<br />%s</p>', $this->contents->api(), $path->path, $e->getMessage()),
'Error'
);
$path->index = null;
}
}

View File

@ -0,0 +1,29 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "6784dd52-0909-451a-a872-9a942a023c68",
"guid": "355bf21a-f859-4528-9110-bcd2c6d05ea7",
"implements": [
"c182506a-ab84-439c-b962-1e606b58d545"
],
"load_selection": null,
"name": "Grep",
"power_version": "1.0.0",
"system_name": "JCB.JoomlaPower.Grep",
"type": "final class",
"use_selection": {
"use_selection0": {
"use": "a223b31e-ea1d-4cdf-92ae-5f9becffaff0",
"as": "default"
},
"use_selection1": {
"use": "4b225c51-d293-48e4-b3f6-5136cf5c3f18",
"as": "default"
}
},
"namespace": "VDM\\Joomla\\Componentbuilder.JoomlaPower.Grep",
"description": "Global Resource Empowerment Platform\r\n\r\n The Grep feature will try to find your joomla power in the repositories listed in the global\r\n Options of JCB in the super powers tab, and if it can't be found there will try the global core\r\n Super powers of JCB. All searches are performed according the the [algorithm:cascading]\r\n See documentation for more details: https:\/\/git.vdm.dev\/joomla\/super-powers\/wiki\r\n\r\n@since 3.2.1",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
"head": "",
"composer": ""
}

View File

@ -0,0 +1,227 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# final class JoomlaPower (Details)
> namespace: **VDM\Joomla\Componentbuilder\Compiler**
```uml
@startuml
class JoomlaPower << (F,LightGreen) >> #RoyalBlue {
+ array $active
+ array $namespace
+ array $composer
+ array $superpowers
# string $fixUrl
# array $state
# array $retry
# Config $config
# Placeholder $placeholder
# Customcode $customcode
# Gui $gui
# Superpower $superpower
# $db
# $app
+ __construct(Config $config, Placeholder $placeholder, ...)
+ load(array $guids) : void
+ get(string $guid, int $build) : ?object
- set(string $guid) : bool
- isPowerSet(string $guid) : bool
- isGuidValid(string $guid) : bool
- getPowerData(string $guid) : ?object
- setNamespace(string $guid) : bool
- setUseSelection(string $guid, array $use, ...) : void
- setLoadSelection(string $guid) : void
- setComposer(string $guid) : void
- setImplements(string $guid, array $use) : void
- setExtend(string $guid, array $use) : void
- setUseAs(string $guid, array $use, ...) : void
- getCleanNamespace(string $namespace) : string
- getUseNamespace(string $namespace, string $as = 'default') : string
- addToHeader(string $guid, string $string) : void
- setLicensingTemplate(string $guid, array $guiMapper) : void
- setHeader(string $guid, array $guiMapper) : void
- setMainClassCode(string $guid, array $guiMapper) : void
- setSuperPowers(string $guid) : void
}
note right of JoomlaPower::__construct
Constructor.
since: 3.2.0
arguments:
Config $config
Placeholder $placeholder
Customcode $customcode
Gui $gui
Superpower $superpower
end note
note left of JoomlaPower::load
load all the powers linked to this component
since: 3.2.0
return: void
end note
note right of JoomlaPower::get
Get a power
since: 3.2.0
return: ?object
end note
note left of JoomlaPower::set
Set a power
since: 3.2.0
return: bool
end note
note right of JoomlaPower::isPowerSet
Check if the power is already set
since: 3.2.0
return: bool
end note
note left of JoomlaPower::isGuidValid
Validate the GUID
since: 3.2.0
return: bool
end note
note right of JoomlaPower::getPowerData
Get the power data from the database
since: 3.2.0
return: ?object
end note
note left of JoomlaPower::setNamespace
Set the namespace for this power
since: 3.2.0
return: bool
end note
note right of JoomlaPower::setUseSelection
Set Use Classes
since: 3.2.0
return: void
arguments:
string $guid
array $use
array $as
end note
note left of JoomlaPower::setLoadSelection
Load Extra Classes
since: 3.2.0
return: void
end note
note right of JoomlaPower::setComposer
Set Composer Linked Use and Access Point
since: 3.2.0
return: void
end note
note left of JoomlaPower::setImplements
Set Implements Interface classes
since: 3.2.0
return: void
end note
note right of JoomlaPower::setExtend
Set Extend Class
since: 3.2.0
return: void
end note
note left of JoomlaPower::setUseAs
Set Extra Use Classes
since: 3.2.0
return: void
arguments:
string $guid
array $use
array $as
end note
note right of JoomlaPower::getCleanNamespace
Get Clean Namespace without use or ; as part of the name space
since: 3.2.0
return: string
end note
note left of JoomlaPower::getUseNamespace
Get [use Namespace\Class;]
since: 3.2.0
return: string
end note
note right of JoomlaPower::addToHeader
Add to class header
since: 3.2.0
return: void
end note
note left of JoomlaPower::setLicensingTemplate
Set the power licensing template
since: 3.2.0
return: void
end note
note right of JoomlaPower::setHeader
Set the power header script
since: 3.2.0
return: void
end note
note left of JoomlaPower::setMainClassCode
Set the power main class code
since: 3.2.0
return: void
end note
note right of JoomlaPower::setSuperPowers
Set the super powers of this power
since: 3.2.0
return: void
end note
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,69 @@
{
"add_head": "1",
"add_licensing_template": "2",
"extends": "0",
"guid": "3730a000-ab64-477d-8b0f-70eaf71b517a",
"implements": [
"1133c2d7-ba7e-4c95-8cde-01f084d04682"
],
"load_selection": null,
"name": "JoomlaPower",
"power_version": "1.0.0",
"system_name": "JCB.Compiler.JoomlaPower",
"type": "final class",
"use_selection": {
"use_selection0": {
"use": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a",
"as": "default"
},
"use_selection1": {
"use": "1f28cb53-60d9-4db1-b517-3c7dc6b429ef",
"as": "default"
},
"use_selection2": {
"use": "4b225c51-d293-48e4-b3f6-5136cf5c3f18",
"as": "default"
},
"use_selection3": {
"use": "9c513baf-b279-43fd-ae29-a585c8cbc4f0",
"as": "default"
},
"use_selection4": {
"use": "30c5b4c2-f75f-4d15-869a-f8bfedd87358",
"as": "default"
},
"use_selection5": {
"use": "ce8cf834-6bac-44fb-941c-861f7e046cc0",
"as": "default"
},
"use_selection6": {
"use": "d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac",
"as": "Compiler"
},
"use_selection7": {
"use": "fa4bf18e-301e-42e3-91fb-6e0096c07adc",
"as": "default"
},
"use_selection8": {
"use": "06453ada-e370-49f0-b262-e3f5a8ed0c2c",
"as": "default"
},
"use_selection9": {
"use": "313b43c4-98c3-4f62-9177-2d73ec8eba31",
"as": "default"
},
"use_selection10": {
"use": "1bd48df2-4f7e-4581-9fe9-4b54e59105e3",
"as": "default"
},
"use_selection11": {
"use": "39a75870-a7f7-45fd-937d-5ba97b85b8ad",
"as": "SuperPower"
}
},
"namespace": "VDM\\Joomla\\Componentbuilder.Compiler.JoomlaPower",
"description": "Power",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
"head": "use Joomla\\CMS\\Factory;\r\nuse Joomla\\CMS\\Application\\CMSApplication;\r\nuse Joomla\\CMS\\Language\\Text;",
"composer": ""
}

View File

@ -6,13 +6,14 @@
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# final class Insert (Details)
# class Insert (Details)
> namespace: **VDM\Joomla\Componentbuilder\Power\Database**
```uml
@startuml
class Insert << (F,LightGreen) >> #RoyalBlue {
class Insert #Gold {
# Model $model
# Database $database
# string $table
+ __construct(Model $model, Database $database)
+ value(mixed $value, string $field, ...) : bool
+ row(array $item) : bool

View File

@ -12,8 +12,9 @@
namespace VDM\Joomla\Componentbuilder\Power\Database;
use VDM\Joomla\Componentbuilder\Power\Model\Upsert as Model;
use VDM\Joomla\Interfaces\ModelInterface as Model;
use VDM\Joomla\Database\Insert as Database;
use VDM\Joomla\Componentbuilder\Interfaces\Database\InsertInterface;
/**
@ -21,7 +22,7 @@ use VDM\Joomla\Database\Insert as Database;
*
* @since 3.2.0
*/
final class Insert
class Insert implements InsertInterface
{
/**
* Model
@ -39,6 +40,14 @@ final class Insert
*/
protected Database $database;
/**
* Table Name
*
* @var string
* @since 3.2.1
*/
protected string $table = 'power';
/**
* Constructor
*
@ -88,10 +97,10 @@ final class Insert
public function row(array $item): bool
{
// check if object could be modelled
if (($item = $this->model->row($item, 'power')) !== null)
if (($item = $this->model->row($item, $this->table)) !== null)
{
// Insert the column of this table
return $this->database->row($item, 'power');
return $this->database->row($item, $this->table);
}
return false;
}
@ -108,10 +117,10 @@ final class Insert
public function rows(?array $items): bool
{
// check if object could be modelled
if (($items = $this->model->rows($items, 'power')) !== null)
if (($items = $this->model->rows($items, $this->table)) !== null)
{
// Insert the column of this table
return $this->database->rows($items, 'power');
return $this->database->rows($items, $this->table);
}
return false;
}
@ -128,10 +137,10 @@ final class Insert
public function item(object $item): bool
{
// check if object could be modelled
if (($item = $this->model->item($item, 'power')) !== null)
if (($item = $this->model->item($item, $this->table)) !== null)
{
// Insert the column of this table
return $this->database->item($item, 'power');
return $this->database->item($item, $this->table);
}
return false;
}
@ -148,13 +157,12 @@ final class Insert
public function items(?array $items): bool
{
// check if object could be modelled
if (($items = $this->model->items($items, 'power')) !== null)
if (($items = $this->model->items($items, $this->table)) !== null)
{
// Update the column of this table using guid as the primary key.
return $this->database->items($items, 'power');
return $this->database->items($items, $this->table);
}
return false;
}
}
}

View File

@ -14,6 +14,14 @@
*/
protected Database $database;
/**
* Table Name
*
* @var string
* @since 3.2.1
*/
protected string $table = 'power';
/**
* Constructor
*
@ -63,10 +71,10 @@
public function row(array $item): bool
{
// check if object could be modelled
if (($item = $this->model->row($item, 'power')) !== null)
if (($item = $this->model->row($item, $this->table)) !== null)
{
// Insert the column of this table
return $this->database->row($item, 'power');
return $this->database->row($item, $this->table);
}
return false;
}
@ -83,10 +91,10 @@
public function rows(?array $items): bool
{
// check if object could be modelled
if (($items = $this->model->rows($items, 'power')) !== null)
if (($items = $this->model->rows($items, $this->table)) !== null)
{
// Insert the column of this table
return $this->database->rows($items, 'power');
return $this->database->rows($items, $this->table);
}
return false;
}
@ -103,10 +111,10 @@
public function item(object $item): bool
{
// check if object could be modelled
if (($item = $this->model->item($item, 'power')) !== null)
if (($item = $this->model->item($item, $this->table)) !== null)
{
// Insert the column of this table
return $this->database->item($item, 'power');
return $this->database->item($item, $this->table);
}
return false;
}
@ -123,10 +131,10 @@
public function items(?array $items): bool
{
// check if object could be modelled
if (($items = $this->model->items($items, 'power')) !== null)
if (($items = $this->model->items($items, $this->table)) !== null)
{
// Update the column of this table using guid as the primary key.
return $this->database->items($items, 'power');
return $this->database->items($items, $this->table);
}
return false;
}
}

View File

@ -3,15 +3,17 @@
"add_licensing_template": "2",
"extends": "0",
"guid": "380bb7a3-cdcc-4336-a699-5070cbf521a5",
"implements": null,
"implements": [
"95c02df3-fe0a-405b-b506-b7a5b8605b66"
],
"load_selection": null,
"name": "Insert",
"power_version": "1.0.0",
"system_name": "JCB.Power.Database.Insert",
"type": "final class",
"type": "class",
"use_selection": {
"use_selection0": {
"use": "7c1fb50f-8fb1-4627-8705-6fedf7182ca5",
"use": "8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff",
"as": "Model"
},
"use_selection1": {

View File

@ -0,0 +1,31 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# final class Super (Details)
> namespace: **VDM\Joomla\Componentbuilder\JoomlaPower**
> extends: **Super**
```uml
@startuml
class Super << (F,LightGreen) >> #RoyalBlue {
# string $table
}
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,34 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\JoomlaPower;
use VDM\Joomla\Componentbuilder\Interfaces\SuperInterface;
use VDM\Joomla\Componentbuilder\Power\Super;
/**
* Super Joomla Power of JCB
*
* @since 3.2.0
*/
final class Super extends Super implements SuperInterface
{
/**
* Table Name
*
* @var string
* @since 3.2.1
*/
protected string $table = 'joomla_power';
}

View File

@ -0,0 +1,7 @@
/**
* Table Name
*
* @var string
* @since 3.2.1
*/
protected string $table = 'joomla_power';

View File

@ -0,0 +1,20 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "3ab0eba9-f37b-4b37-aec1-2e78067f2aff",
"guid": "39a75870-a7f7-45fd-937d-5ba97b85b8ad",
"implements": [
"51de80f2-2868-4c2c-8198-ef79349e9bd7"
],
"load_selection": null,
"name": "Super",
"power_version": "1.0.0",
"system_name": "JCB.JoomlaPower.Super",
"type": "final class",
"use_selection": null,
"namespace": "VDM\\Joomla\\Componentbuilder.JoomlaPower.Super",
"description": "Super Joomla Power of JCB\r\n\r\n@since 3.2.0",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
"head": "",
"composer": ""
}

View File

@ -6,14 +6,15 @@
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# final class Super (Details)
# class Super (Details)
> namespace: **VDM\Joomla\Componentbuilder\Power**
```uml
@startuml
class Super << (F,LightGreen) >> #RoyalBlue {
class Super #Gold {
# Grep $grep
# Insert $insert
# Update $update
# string $table
+ __construct(Grep $grep, Insert $insert, ...)
+ init() : bool
+ reset(array $powers) : bool

View File

@ -12,9 +12,9 @@
namespace VDM\Joomla\Componentbuilder\Power;
use VDM\Joomla\Componentbuilder\Power\Grep;
use VDM\Joomla\Componentbuilder\Power\Database\Insert;
use VDM\Joomla\Componentbuilder\Power\Database\Update;
use VDM\Joomla\Componentbuilder\Interfaces\GrepInterface as Grep;
use VDM\Joomla\Componentbuilder\Interfaces\Database\InsertInterface as Insert;
use VDM\Joomla\Componentbuilder\Interfaces\Database\UpdateInterface as Update;
use VDM\Joomla\Utilities\GuidHelper;
@ -23,7 +23,7 @@ use VDM\Joomla\Utilities\GuidHelper;
*
* @since 3.2.0
*/
final class Super
class Super
{
/**
* The Power Search Tool
@ -49,6 +49,14 @@ final class Super
**/
protected Update $update;
/**
* Table Name
*
* @var string
* @since 3.2.1
*/
protected string $table = 'power';
/**
* Constructor.
*
@ -174,7 +182,7 @@ final class Super
*/
private function action(string $guid): string
{
if (($id = GuidHelper::item($guid, 'power')) !== null && $id > 0)
if (($id = GuidHelper::item($guid, $this->table)) !== null && $id > 0)
{
return 'update';
}

View File

@ -22,6 +22,14 @@
**/
protected Update $update;
/**
* Table Name
*
* @var string
* @since 3.2.1
*/
protected string $table = 'power';
/**
* Constructor.
*
@ -147,7 +155,7 @@
*/
private function action(string $guid): string
{
if (($id = GuidHelper::item($guid, 'power')) !== null && $id > 0)
if (($id = GuidHelper::item($guid, $this->table)) !== null && $id > 0)
{
return 'update';
}

View File

@ -8,19 +8,19 @@
"name": "Super",
"power_version": "1.0.0",
"system_name": "JCB.Power.Super",
"type": "final class",
"type": "class",
"use_selection": {
"use_selection0": {
"use": "6784dd52-0909-451a-a872-9a942a023c68",
"as": "default"
"use": "c182506a-ab84-439c-b962-1e606b58d545",
"as": "Grep"
},
"use_selection1": {
"use": "380bb7a3-cdcc-4336-a699-5070cbf521a5",
"as": "default"
"use": "95c02df3-fe0a-405b-b506-b7a5b8605b66",
"as": "Insert"
},
"use_selection2": {
"use": "e543c123-b1d9-4a0b-83b2-a9d371da5ff3",
"as": "default"
"use": "69c29be3-ab25-4f56-944e-7ada6307b10c",
"as": "Update"
},
"use_selection3": {
"use": "9c513baf-b279-43fd-ae29-a585c8cbc4f0",

View File

@ -0,0 +1,58 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# interface SuperInterface (Details)
> namespace: **VDM\Joomla\Componentbuilder\Interfaces**
```uml
@startuml
interface SuperInterface #Lavender {
+ init() : bool
+ reset(array $powers) : bool
+ load(string $guid, array $order = ['remote', 'local'], ...) : bool
}
note right of SuperInterface::init
Init all power not found in database
since: 3.2.0
return: bool
end note
note right of SuperInterface::reset
Reset the powers
since: 3.2.0
return: bool
end note
note right of SuperInterface::load
Load a superpower
since: 3.2.0
return: bool
arguments:
string $guid
array $order = ['remote', 'local']
?string $action = null
end note
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,52 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\Interfaces;
/**
* Superpower of JCB
*
* @since 3.2.0
*/
interface SuperInterface
{
/**
* Init all power not found in database
*
* @return bool
* @since 3.2.0
*/
public function init(): bool;
/**
* Reset the powers
*
* @param array $powers The global unique ids of the powers
*
* @return bool
* @since 3.2.0
*/
public function reset(array $powers): bool;
/**
* Load a superpower
*
* @param string $guid The global unique id of the power
* @param array $order The search order
* @param string|null $action The action to load power
*
* @return bool
* @since 3.2.0
*/
public function load(string $guid, array $order = ['remote', 'local'], ?string $action = null): bool;
}

View File

@ -0,0 +1,29 @@
/**
* Init all power not found in database
*
* @return bool
* @since 3.2.0
*/
public function init(): bool;
/**
* Reset the powers
*
* @param array $powers The global unique ids of the powers
*
* @return bool
* @since 3.2.0
*/
public function reset(array $powers): bool;
/**
* Load a superpower
*
* @param string $guid The global unique id of the power
* @param array $order The search order
* @param string|null $action The action to load power
*
* @return bool
* @since 3.2.0
*/
public function load(string $guid, array $order = ['remote', 'local'], ?string $action = null): bool;

View File

@ -0,0 +1,18 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "0",
"guid": "51de80f2-2868-4c2c-8198-ef79349e9bd7",
"implements": null,
"load_selection": null,
"name": "SuperInterface",
"power_version": "1.0.0",
"system_name": "JCB.Interfaces.Super",
"type": "interface",
"use_selection": null,
"namespace": "VDM\\Joomla\\Componentbuilder.Interfaces.SuperInterface",
"description": "Superpower of JCB\r\n\r\n@since 3.2.0",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
"head": "",
"composer": ""
}

View File

@ -0,0 +1,101 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# class JoomlaPower (Details)
> namespace: **VDM\Joomla\Componentbuilder\Compiler\Service**
```uml
@startuml
class JoomlaPower #Gold {
+ register(Container $container) : void
+ getPowers(Container $container) : Powers
+ getSuperpower(Container $container) : Superpower
+ getGrep(Container $container) : Grep
+ getExtractor(Container $container) : Extractor
+ getInjector(Container $container) : Injector
+ getModelUpsert(Container $container) : Upsert
+ getInsert(Container $container) : Insert
+ getUpdate(Container $container) : Update
}
note right of JoomlaPower::register
Registers the service provider with a DI container.
since: 3.2.0
return: void
end note
note left of JoomlaPower::getPowers
Get the Powers
since: 3.2.0
return: Powers
end note
note right of JoomlaPower::getSuperpower
Get the Superpower
since: 3.2.0
return: Superpower
end note
note left of JoomlaPower::getGrep
Get the Grep
since: 3.2.0
return: Grep
end note
note right of JoomlaPower::getExtractor
Get the Compiler Power Extractor
since: 3.2.0
return: Extractor
end note
note left of JoomlaPower::getInjector
Get the Compiler Power Injector
since: 3.2.0
return: Injector
end note
note right of JoomlaPower::getModelUpsert
Get the Power Model Upsert
since: 3.2.0
return: Upsert
end note
note left of JoomlaPower::getInsert
Get the Power Insert
since: 3.2.0
return: Insert
end note
note right of JoomlaPower::getUpdate
Get the Power Update
since: 3.2.0
return: Update
end note
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,198 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\Compiler\Service;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use VDM\Joomla\Componentbuilder\Compiler\JoomlaPower as Powers;
use VDM\Joomla\Componentbuilder\JoomlaPower\Grep;
use VDM\Joomla\Componentbuilder\JoomlaPower\Super as Superpower;
use VDM\Joomla\Componentbuilder\Compiler\JoomlaPower\Extractor;
use VDM\Joomla\Componentbuilder\Compiler\JoomlaPower\Injector;
use VDM\Joomla\Componentbuilder\JoomlaPower\Model\Upsert;
use VDM\Joomla\Componentbuilder\JoomlaPower\Database\Insert;
use VDM\Joomla\Componentbuilder\JoomlaPower\Database\Update;
/**
* Compiler Joomla Power Service Provider
*
* @since 3.2.0
*/
class JoomlaPower implements ServiceProviderInterface
{
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
* @since 3.2.0
*/
public function register(Container $container)
{
$container->alias(Powers::class, 'Joomla.Power')
->share('Joomla.Power', [$this, 'getPowers'], true);
$container->alias(Superpower::class, 'Joomla.Superpower')
->share('Joomla.Superpower', [$this, 'getSuperpower'], true);
$container->alias(Grep::class, 'Joomla.Power.Grep')
->share('Joomla.Power.Grep', [$this, 'getGrep'], true);
$container->alias(Extractor::class, 'Joomla.Power.Extractor')
->share('Power.Extractor', [$this, 'getExtractor'], true);
$container->alias(Injector::class, 'Joomla.Power.Injector')
->share('Power.Injector', [$this, 'getInjector'], true);
$container->alias(Upsert::class, 'Joomla.Power.Model.Upsert')
->share('Power.Model.Upsert', [$this, 'getModelUpsert'], true);
$container->alias(Insert::class, 'Joomla.Power.Insert')
->share('Power.Insert', [$this, 'getInsert'], true);
$container->alias(Update::class, 'Joomla.Power.Update')
->share('Power.Update', [$this, 'getUpdate'], true);
}
/**
* Get the Powers
*
* @param Container $container The DI container.
*
* @return Powers
* @since 3.2.0
*/
public function getPowers(Container $container): Powers
{
return new Powers(
$container->get('Config')
);
}
/**
* Get the Superpower
*
* @param Container $container The DI container.
*
* @return Superpower
* @since 3.2.0
*/
public function getSuperpower(Container $container): Superpower
{
return new Superpower(
$container->get('Joomla.Power.Grep'),
$container->get('Joomla.Power.Insert'),
$container->get('Joomla.Power.Update')
);
}
/**
* Get the Grep
*
* @param Container $container The DI container.
*
* @return Grep
* @since 3.2.0
*/
public function getGrep(Container $container): Grep
{
return new Grep(
$container->get('Config')->local_powers_repository_path,
$container->get('Config')->approved_paths,
$container->get('Gitea.Repository.Contents')
);
}
/**
* Get the Compiler Power Extractor
*
* @param Container $container The DI container.
*
* @return Extractor
* @since 3.2.0
*/
public function getExtractor(Container $container): Extractor
{
return new Extractor(
$container->get('Config')->joomla_version
);
}
/**
* Get the Compiler Power Injector
*
* @param Container $container The DI container.
*
* @return Injector
* @since 3.2.0
*/
public function getInjector(Container $container): Injector
{
return new Injector(
$container->get('Joomla.Power'),
$container->get('Joomla.Power.Extractor'),
$container->get('Power.Parser'),
$container->get('Placeholder')
);
}
/**
* Get the Power Model Upsert
*
* @param Container $container The DI container.
*
* @return Upsert
* @since 3.2.0
*/
public function getModelUpsert(Container $container): Upsert
{
return new Upsert(
$container->get('Table')
);
}
/**
* Get the Power Insert
*
* @param Container $container The DI container.
*
* @return Insert
* @since 3.2.0
*/
public function getInsert(Container $container): Insert
{
return new Insert(
$container->get('Joomla.Power.Model.Upsert'),
$container->get('Insert')
);
}
/**
* Get the Power Update
*
* @param Container $container The DI container.
*
* @return Update
* @since 3.2.0
*/
public function getUpdate(Container $container): Update
{
return new Update(
$container->get('Joomla.Power.Model.Upsert'),
$container->get('Update')
);
}
}

View File

@ -0,0 +1,163 @@
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
* @since 3.2.0
*/
public function register(Container $container)
{
$container->alias(Powers::class, 'Joomla.Power')
->share('Joomla.Power', [$this, 'getPowers'], true);
$container->alias(Superpower::class, 'Joomla.Superpower')
->share('Joomla.Superpower', [$this, 'getSuperpower'], true);
$container->alias(Grep::class, 'Joomla.Power.Grep')
->share('Joomla.Power.Grep', [$this, 'getGrep'], true);
$container->alias(Extractor::class, 'Joomla.Power.Extractor')
->share('Power.Extractor', [$this, 'getExtractor'], true);
$container->alias(Injector::class, 'Joomla.Power.Injector')
->share('Power.Injector', [$this, 'getInjector'], true);
$container->alias(Upsert::class, 'Joomla.Power.Model.Upsert')
->share('Power.Model.Upsert', [$this, 'getModelUpsert'], true);
$container->alias(Insert::class, 'Joomla.Power.Insert')
->share('Power.Insert', [$this, 'getInsert'], true);
$container->alias(Update::class, 'Joomla.Power.Update')
->share('Power.Update', [$this, 'getUpdate'], true);
}
/**
* Get the Powers
*
* @param Container $container The DI container.
*
* @return Powers
* @since 3.2.0
*/
public function getPowers(Container $container): Powers
{
return new Powers(
$container->get('Config')
);
}
/**
* Get the Superpower
*
* @param Container $container The DI container.
*
* @return Superpower
* @since 3.2.0
*/
public function getSuperpower(Container $container): Superpower
{
return new Superpower(
$container->get('Joomla.Power.Grep'),
$container->get('Joomla.Power.Insert'),
$container->get('Joomla.Power.Update')
);
}
/**
* Get the Grep
*
* @param Container $container The DI container.
*
* @return Grep
* @since 3.2.0
*/
public function getGrep(Container $container): Grep
{
return new Grep(
$container->get('Config')->local_powers_repository_path,
$container->get('Config')->approved_paths,
$container->get('Gitea.Repository.Contents')
);
}
/**
* Get the Compiler Power Extractor
*
* @param Container $container The DI container.
*
* @return Extractor
* @since 3.2.0
*/
public function getExtractor(Container $container): Extractor
{
return new Extractor(
$container->get('Config')->joomla_version
);
}
/**
* Get the Compiler Power Injector
*
* @param Container $container The DI container.
*
* @return Injector
* @since 3.2.0
*/
public function getInjector(Container $container): Injector
{
return new Injector(
$container->get('Joomla.Power'),
$container->get('Joomla.Power.Extractor'),
$container->get('Power.Parser'),
$container->get('Placeholder')
);
}
/**
* Get the Power Model Upsert
*
* @param Container $container The DI container.
*
* @return Upsert
* @since 3.2.0
*/
public function getModelUpsert(Container $container): Upsert
{
return new Upsert(
$container->get('Table')
);
}
/**
* Get the Power Insert
*
* @param Container $container The DI container.
*
* @return Insert
* @since 3.2.0
*/
public function getInsert(Container $container): Insert
{
return new Insert(
$container->get('Joomla.Power.Model.Upsert'),
$container->get('Insert')
);
}
/**
* Get the Power Update
*
* @param Container $container The DI container.
*
* @return Update
* @since 3.2.0
*/
public function getUpdate(Container $container): Update
{
return new Update(
$container->get('Joomla.Power.Model.Upsert'),
$container->get('Update')
);
}

View File

@ -0,0 +1,54 @@
{
"add_head": "1",
"add_licensing_template": "2",
"extends": "0",
"guid": "5716c79f-a1c9-4059-9d00-8cccb9f9e061",
"implements": [
"-1"
],
"load_selection": null,
"name": "JoomlaPower",
"power_version": "1.0.0",
"system_name": "JCB.Compiler.Service.JoomlaPower",
"type": "class",
"use_selection": {
"use_selection0": {
"use": "3730a000-ab64-477d-8b0f-70eaf71b517a",
"as": "Powers"
},
"use_selection1": {
"use": "355bf21a-f859-4528-9110-bcd2c6d05ea7",
"as": "default"
},
"use_selection2": {
"use": "39a75870-a7f7-45fd-937d-5ba97b85b8ad",
"as": "Superpower"
},
"use_selection3": {
"use": "82505f3f-297f-4d75-a581-929ab3e93689",
"as": "default"
},
"use_selection4": {
"use": "a6052fe9-0d2b-4b36-b3e7-03b47c483542",
"as": "default"
},
"use_selection5": {
"use": "9206082e-a3f7-472e-98b2-de90d06cbdcd",
"as": "default"
},
"use_selection6": {
"use": "9d53d45e-9b4d-45ec-827b-4916b91c907e",
"as": "default"
},
"use_selection7": {
"use": "679473f6-3ea2-49d5-8273-1b29c8f0ad2b",
"as": "default"
}
},
"namespace": "VDM\\Joomla\\Componentbuilder.Compiler.Service.JoomlaPower",
"description": "Compiler Joomla Power Service Provider\r\n\r\n@since 3.2.0",
"implements_custom": "ServiceProviderInterface",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
"head": "use Joomla\\DI\\Container;\r\nuse Joomla\\DI\\ServiceProviderInterface;",
"composer": ""
}

View File

@ -6,11 +6,11 @@
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# final class Grep (Details)
# class Grep (Details)
> namespace: **VDM\Joomla\Componentbuilder\Power**
```uml
@startuml
class Grep << (F,LightGreen) >> #RoyalBlue {
class Grep #Gold {
+ ?string $path
+ ?array $paths
# Contents $contents

View File

@ -19,6 +19,7 @@ use Joomla\CMS\Language\Text;
use VDM\Joomla\Gitea\Repository\Contents;
use VDM\Joomla\Utilities\FileHelper;
use VDM\Joomla\Utilities\JsonHelper;
use VDM\Joomla\Componentbuilder\Interfaces\GrepInterface;
/**
@ -31,7 +32,7 @@ use VDM\Joomla\Utilities\JsonHelper;
*
* @since 3.2.0
*/
final class Grep
class Grep implements GrepInterface
{
/**
* The local path

View File

@ -3,12 +3,14 @@
"add_licensing_template": "2",
"extends": "0",
"guid": "6784dd52-0909-451a-a872-9a942a023c68",
"implements": null,
"implements": [
"c182506a-ab84-439c-b962-1e606b58d545"
],
"load_selection": null,
"name": "Grep",
"power_version": "1.0.0",
"system_name": "JCB.Power.Grep",
"type": "final class",
"type": "class",
"use_selection": {
"use_selection0": {
"use": "8d1baef6-fcad-49a9-848f-428009cdb989",

View File

@ -0,0 +1,31 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# final class Update (Details)
> namespace: **VDM\Joomla\Componentbuilder\JoomlaPower\Database**
> extends: **Update**
```uml
@startuml
class Update << (F,LightGreen) >> #RoyalBlue {
# string $table
}
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,34 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\JoomlaPower\Database;
use VDM\Joomla\Componentbuilder\Interfaces\Database\UpdateInterface;
use VDM\Joomla\Componentbuilder\Power\Database\Update;
/**
* Joomla Power Database Update
*
* @since 3.2.0
*/
final class Update extends Update implements UpdateInterface
{
/**
* Table Name
*
* @var string
* @since 3.2.1
*/
protected string $table = 'joomla_power';
}

View File

@ -0,0 +1,7 @@
/**
* Table Name
*
* @var string
* @since 3.2.1
*/
protected string $table = 'joomla_power';

View File

@ -0,0 +1,20 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "e543c123-b1d9-4a0b-83b2-a9d371da5ff3",
"guid": "679473f6-3ea2-49d5-8273-1b29c8f0ad2b",
"implements": [
"69c29be3-ab25-4f56-944e-7ada6307b10c"
],
"load_selection": null,
"name": "Update",
"power_version": "1.0.0",
"system_name": "JCB.JoomlaPower.Database.Update",
"type": "final class",
"use_selection": null,
"namespace": "VDM\\Joomla\\Componentbuilder.JoomlaPower.Database.Update",
"description": "Joomla Power Database Update\r\n\r\n@since 3.2.0",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
"head": "",
"composer": ""
}

View File

@ -0,0 +1,80 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# interface UpdateInterface (Details)
> namespace: **VDM\Joomla\Componentbuilder\Interfaces\Database**
```uml
@startuml
interface UpdateInterface #Lavender {
+ value(mixed $value, string $field, ...) : bool
+ row(array $item) : bool
+ rows(?array $items) : bool
+ item(object $item) : bool
+ items(?array $items) : bool
}
note right of UpdateInterface::value
Update a value to a given table
Example: $this->value(Value, 'value_key', 'GUID');
since: 3.2.0
return: bool
arguments:
mixed $value
string $field
string $keyValue
string $key = 'guid'
end note
note right of UpdateInterface::row
Update single row with multiple values to a given table
Example: $this->item(Array);
since: 3.2.0
return: bool
end note
note right of UpdateInterface::rows
Update multiple rows to a given table
Example: $this->items(Array);
since: 3.2.0
return: bool
end note
note right of UpdateInterface::item
Update single item with multiple values to a given table
Example: $this->item(Object);
since: 3.2.0
return: bool
end note
note right of UpdateInterface::items
Update multiple items to a given table
Example: $this->items(Array);
since: 3.2.0
return: bool
end note
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,80 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\Interfaces\Database;
/**
* Database Update
*
* @since 3.2.1
*/
interface UpdateInterface
{
/**
* Update a value to a given table
* Example: $this->value(Value, 'value_key', 'GUID');
*
* @param mixed $value The field value
* @param string $field The field key
* @param string $keyValue The key value
* @param string $key The key name
*
* @return bool
* @since 3.2.0
*/
public function value($value, string $field, string $keyValue, string $key = 'guid'): bool;
/**
* Update single row with multiple values to a given table
* Example: $this->item(Array);
*
* @param array $item The item to save
*
* @return bool
* @since 3.2.0
*/
public function row(array $item): bool;
/**
* Update multiple rows to a given table
* Example: $this->items(Array);
*
* @param array|null $items The items updated in database (array of arrays)
*
* @return bool
* @since 3.2.0
*/
public function rows(?array $items): bool;
/**
* Update single item with multiple values to a given table
* Example: $this->item(Object);
*
* @param object $item The item to save
*
* @return bool
* @since 3.2.0
*/
public function item(object $item): bool;
/**
* Update multiple items to a given table
* Example: $this->items(Array);
*
* @param array|null $items The items updated in database (array of objects)
*
* @return bool
* @since 3.2.0
*/
public function items(?array $items): bool;
}

View File

@ -0,0 +1,57 @@
/**
* Update a value to a given table
* Example: $this->value(Value, 'value_key', 'GUID');
*
* @param mixed $value The field value
* @param string $field The field key
* @param string $keyValue The key value
* @param string $key The key name
*
* @return bool
* @since 3.2.0
*/
public function value($value, string $field, string $keyValue, string $key = 'guid'): bool;
/**
* Update single row with multiple values to a given table
* Example: $this->item(Array);
*
* @param array $item The item to save
*
* @return bool
* @since 3.2.0
*/
public function row(array $item): bool;
/**
* Update multiple rows to a given table
* Example: $this->items(Array);
*
* @param array|null $items The items updated in database (array of arrays)
*
* @return bool
* @since 3.2.0
*/
public function rows(?array $items): bool;
/**
* Update single item with multiple values to a given table
* Example: $this->item(Object);
*
* @param object $item The item to save
*
* @return bool
* @since 3.2.0
*/
public function item(object $item): bool;
/**
* Update multiple items to a given table
* Example: $this->items(Array);
*
* @param array|null $items The items updated in database (array of objects)
*
* @return bool
* @since 3.2.0
*/
public function items(?array $items): bool;

View File

@ -0,0 +1,18 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "0",
"guid": "69c29be3-ab25-4f56-944e-7ada6307b10c",
"implements": null,
"load_selection": null,
"name": "UpdateInterface",
"power_version": "1.0.0",
"system_name": "JCB.Interfaces.Database.UpdateInterface",
"type": "interface",
"use_selection": null,
"namespace": "VDM\\Joomla\\Componentbuilder.Interfaces.Database.UpdateInterface",
"description": "Database Update\r\n\r\n@since 3.2.1",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
"head": "",
"composer": ""
}

View File

@ -0,0 +1,54 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# abstract class Factory (Details)
> namespace: **VDM\Joomla\Componentbuilder\JoomlaPower**
```uml
@startuml
abstract Factory #Orange {
# static $container
+ {static} _(string $key) : Mixed
+ {static} getContainer() : Container
# {static} createContainer() : Container
}
note right of Factory::_
Get any class from the package container
since: 3.2.0
return: Mixed
end note
note right of Factory::getContainer
Get the global package container
since: 3.2.0
return: Container
end note
note right of Factory::createContainer
Create a container object
since: 3.2.0
return: Container
end note
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,86 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\JoomlaPower;
use Joomla\DI\Container;
use VDM\Joomla\Componentbuilder\Compiler\Service\JoomlaPower as Power;
use VDM\Joomla\Componentbuilder\Service\Database;
use VDM\Joomla\Componentbuilder\JoomlaPower\Service\Database as PowerDatabase;
use VDM\Joomla\Componentbuilder\Service\Gitea;
use VDM\Joomla\Componentbuilder\Power\Service\Gitea as GiteaPower;
use VDM\Joomla\Gitea\Service\Utilities as GiteaUtilities;
use VDM\Joomla\Interfaces\FactoryInterface;
/**
* Joomla Power Factory
*
* @since 3.2.0
*/
abstract class Factory implements FactoryInterface
{
/**
* Global Package Container
*
* @var Container
* @since 3.2.0
**/
protected static $container = null;
/**
* Get any class from the package container
*
* @param string $key The container class key
*
* @return Mixed
* @since 3.2.0
*/
public static function _($key)
{
return self::getContainer()->get($key);
}
/**
* Get the global package container
*
* @return Container
* @since 3.2.0
*/
public static function getContainer(): Container
{
if (!self::$container)
{
self::$container = self::createContainer();
}
return self::$container;
}
/**
* Create a container object
*
* @return Container
* @since 3.2.0
*/
protected static function createContainer(): Container
{
return (new Container())
->registerServiceProvider(new Power())
->registerServiceProvider(new Database())
->registerServiceProvider(new PowerDatabase())
->registerServiceProvider(new Gitea())
->registerServiceProvider(new GiteaPower())
->registerServiceProvider(new GiteaUtilities());
}
}

View File

@ -0,0 +1,53 @@
/**
* Global Package Container
*
* @var Container
* @since 3.2.0
**/
protected static $container = null;
/**
* Get any class from the package container
*
* @param string $key The container class key
*
* @return Mixed
* @since 3.2.0
*/
public static function _($key)
{
return self::getContainer()->get($key);
}
/**
* Get the global package container
*
* @return Container
* @since 3.2.0
*/
public static function getContainer(): Container
{
if (!self::$container)
{
self::$container = self::createContainer();
}
return self::$container;
}
/**
* Create a container object
*
* @return Container
* @since 3.2.0
*/
protected static function createContainer(): Container
{
return (new Container())
->registerServiceProvider(new Power())
->registerServiceProvider(new Database())
->registerServiceProvider(new PowerDatabase())
->registerServiceProvider(new Gitea())
->registerServiceProvider(new GiteaPower())
->registerServiceProvider(new GiteaUtilities());
}

View File

@ -0,0 +1,45 @@
{
"add_head": "1",
"add_licensing_template": "2",
"extends": "0",
"guid": "6ee3dc9e-1949-4da5-a74f-d9eb7f14e400",
"implements": [
"caf33c5d-858c-4f9a-894f-ab302ec5445a"
],
"load_selection": null,
"name": "Factory",
"power_version": "1.0.0",
"system_name": "JCB.JoomlaPower.Factory",
"type": "abstract class",
"use_selection": {
"use_selection0": {
"use": "5716c79f-a1c9-4059-9d00-8cccb9f9e061",
"as": "Power"
},
"use_selection1": {
"use": "4815e1c7-a433-443d-a112-d1e03d7df84b",
"as": "default"
},
"use_selection2": {
"use": "a2992a91-eec2-4957-811b-8cde22aa1438",
"as": "PowerDatabase"
},
"use_selection3": {
"use": "71acf8d6-32b8-4173-8277-eb9cda29fd64",
"as": "default"
},
"use_selection4": {
"use": "510dc0f6-da3f-4a78-b43d-3a03e2cb5fae",
"as": "GiteaPower"
},
"use_selection5": {
"use": "6edf0cf3-c2b0-45c9-84d2-c6ef1c5d434c",
"as": "GiteaUtilities"
}
},
"namespace": "VDM\\Joomla\\Componentbuilder.JoomlaPower.Factory",
"description": "Joomla Power Factory\r\n\r\n@since 3.2.0",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
"head": "use Joomla\\DI\\Container;",
"composer": ""
}

View File

@ -6,11 +6,11 @@
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# final class Injector (Details)
# class Injector (Details)
> namespace: **VDM\Joomla\Componentbuilder\Compiler\Power**
```uml
@startuml
class Injector << (F,LightGreen) >> #RoyalBlue {
class Injector #Gold {
# Power $power
# Extractor $extractor
# Parser $parser
@ -20,7 +20,7 @@ class Injector << (F,LightGreen) >> #RoyalBlue {
# array $traits
# array $other
# array $duplicate
+ __construct(?Power $power = null, ?Extractor $extractor = null, ...)
+ __construct(Power $power = null, Extractor $extractor = null, ...)
+ power(string $code) : string
# update(array $guids, string $code) : string
# inspect(object $power, ?array $useStatements, ...) : ?string
@ -45,10 +45,10 @@ note right of Injector::__construct
since: 3.2.0
arguments:
?Power $power = null
?Extractor $extractor = null
?Parser $parser = null
?Placeholder $placeholder = null
Power $power = null
Extractor $extractor = null
Parser $parser = null
Placeholder $placeholder = null
end note
note left of Injector::power

View File

@ -12,18 +12,18 @@
namespace VDM\Joomla\Componentbuilder\Compiler\Power;
use VDM\Joomla\Componentbuilder\Compiler\Factory as Compiler;
use VDM\Joomla\Componentbuilder\Compiler\Power;
use VDM\Joomla\Componentbuilder\Compiler\Power\Extractor;
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\PowerInterface as Power;
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Power\ExtractorInterface as Extractor;
use VDM\Joomla\Componentbuilder\Compiler\Power\Parser;
use VDM\Joomla\Componentbuilder\Compiler\Placeholder;
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Power\InjectorInterface;
/**
* Compiler Power Injector
* @since 3.2.0
*/
final class Injector
class Injector implements InjectorInterface
{
/**
* Power Objects
@ -107,13 +107,13 @@ final class Injector
*
* @since 3.2.0
*/
public function __construct(?Power $power = null, ?Extractor $extractor = null,
?Parser $parser = null, ?Placeholder $placeholder = null)
public function __construct(Power $power = null, Extractor $extractor = null,
Parser $parser = null, Placeholder $placeholder = null)
{
$this->power = $power ?: Compiler::_('Power');
$this->extractor = $extractor ?: Compiler::_('Power.Extractor');
$this->parser = $parser ?: Compiler::_('Power.Parser');
$this->placeholder = $placeholder ?: Compiler::_('Placeholder');
$this->power = $power;
$this->extractor = $extractor;
$this->parser = $parser;
$this->placeholder = $placeholder;
}
/**

View File

@ -80,13 +80,13 @@
*
* @since 3.2.0
*/
public function __construct(?Power $power = null, ?Extractor $extractor = null,
?Parser $parser = null, ?Placeholder $placeholder = null)
public function __construct(Power $power = null, Extractor $extractor = null,
Parser $parser = null, Placeholder $placeholder = null)
{
$this->power = $power ?: Compiler::_('Power');
$this->extractor = $extractor ?: Compiler::_('Power.Extractor');
$this->parser = $parser ?: Compiler::_('Power.Parser');
$this->placeholder = $placeholder ?: Compiler::_('Placeholder');
$this->power = $power;
$this->extractor = $extractor;
$this->parser = $parser;
$this->placeholder = $placeholder;
}
/**

View File

@ -3,30 +3,28 @@
"add_licensing_template": "2",
"extends": "0",
"guid": "763d137c-42bc-4282-98d8-cc5c0654985f",
"implements": null,
"implements": [
"e923311a-4058-4e81-9f67-5956fd0c627c"
],
"load_selection": null,
"name": "Injector",
"power_version": "1.0.0",
"system_name": "JCB.Compiler.Power.Injector",
"type": "final class",
"type": "class",
"use_selection": {
"use_selection0": {
"use": "d910d8b8-4c23-4f3e-8cda-438f2d2bd7ac",
"as": "Compiler"
"use": "1133c2d7-ba7e-4c95-8cde-01f084d04682",
"as": "Power"
},
"use_selection1": {
"use": "b836c1b1-b6b1-44f7-b8a2-9a763a4185b1",
"as": "default"
"use": "c159425c-51f9-4a15-af99-f2d0c6d7aae8",
"as": "Extractor"
},
"use_selection2": {
"use": "eeb03266-22fd-45bb-953a-961bb6be3a54",
"as": "default"
},
"use_selection3": {
"use": "95d0e03f-24fd-4412-bc2e-f0899fcc3205",
"as": "default"
},
"use_selection4": {
"use_selection3": {
"use": "06453ada-e370-49f0-b262-e3f5a8ed0c2c",
"as": "default"
}

View File

@ -6,12 +6,12 @@
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# final class Upsert (Details)
# class Upsert (Details)
> namespace: **VDM\Joomla\Componentbuilder\Power\Model**
> extends: **AbstractionModel**
```uml
@startuml
class Upsert << (F,LightGreen) >> #RoyalBlue {
class Upsert #Gold {
+ value(mixed $value, string $field, ...) : mixed
# validateBefore(mixed $value, ?string $field = null, ...) : bool
# validateAfter(mixed $value, ?string $field = null, ...) : bool

View File

@ -24,7 +24,7 @@ use VDM\Joomla\Interfaces\ModelInterface;
*
* @since 3.2.0
*/
final class Upsert extends AbstractionModel implements ModelInterface
class Upsert extends AbstractionModel implements ModelInterface
{
/**
* Model the value

View File

@ -10,7 +10,7 @@
"name": "Upsert",
"power_version": "1.0.0",
"system_name": "JCB.Power.Model.Upsert",
"type": "final class",
"type": "class",
"use_selection": {
"use_selection0": {
"use": "584747d1-3a86-453d-b7a3-a2219de8d777",

View File

@ -0,0 +1,47 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# final class Extractor (Details)
> namespace: **VDM\Joomla\Componentbuilder\Compiler\JoomlaPower**
> extends: **Extractor**
```uml
@startuml
class Extractor << (F,LightGreen) >> #RoyalBlue {
# string $table
# $targetVersion
+ __construct(int $targetVersion)
# namespaces(array $guids) : ?array
}
note right of Extractor::__construct
Constructor.
since: 3.2.1
end note
note right of Extractor::namespaces
Get the complete namespace strings of the guids passed as an array.
since: 3.2.0
return: ?array
end note
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,118 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\Compiler\JoomlaPower;
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Power\ExtractorInterface;
use VDM\Joomla\Componentbuilder\Compiler\Power\Extractor;
/**
* Compiler Joomla Power Extractor
* @since 3.2.1
*/
final class Extractor extends Extractor implements ExtractorInterface
{
/**
* The pattern to get the powers
*
* @var string
* @since 3.2.0
**/
protected string $pattern = '/Joomla_'.'_'.'_[a-zA-Z0-9_]+_'.'_'.'_Power/';
/**
* The pattern to get the Front
*
* @var string
* @since 3.2.1
**/
protected string $_pattern = 'Joomla';
/**
* The pattern to get the Back
*
* @var string
* @since 3.2.1
**/
protected string $pattern_ = 'Power';
/**
* The Table
*
* @var string
* @since 3.2.1
**/
protected string $table = 'joomla_power';
/**
* Current Joomla Version Being Build
*
* @var int
* @since 3.2.0
**/
protected $targetVersion;
/**
* Constructor.
*
* @param int $targetVersion The targeted Joomla version.
*
* @since 3.2.1
*/
public function __construct(int $targetVersion)
{
parent::__construct();
$this->targetVersion = $targetVersion;
}
/**
* Get the complete namespace strings of the guids passed as an array.
*
* @param array $guids The guids to filter the results
*
* @return array|null The result namespaces with their guids
* @since 3.2.0
**/
protected function namespaces(array $guids): ?array
{
$query = $this->db->getQuery(true);
$query->select($this->db->quoteName(['settings', 'guid']))
->from($this->db->quoteName('#__componentbuilder_' . $this->table))
->where($this->db->quoteName('guid') . ' IN (' . implode(',', array_map([$this->db, 'quote'], $guids)) . ')');
$this->db->setQuery($query);
$this->db->execute();
if ($this->db->getNumRows())
{
$namespaces = [];
$items = $this->db->loadAssocList();
foreach ($items as $item)
{
if (JsonHelper::check($item->settings))
{
$item->settings = json_decode($item->settings, true);
echo '<pre>'; var_dump($item->settings, 'Joomla Version: ' . $this->targetVersion); exit;
}
}
if ($namespaces !== [])
{
return $namespaces;
}
}
return null;
}
}

View File

@ -0,0 +1,92 @@
/**
* The pattern to get the powers
*
* @var string
* @since 3.2.0
**/
protected string $pattern = '/Joomla_'.'_'.'_[a-zA-Z0-9_]+_'.'_'.'_Power/';
/**
* The pattern to get the Front
*
* @var string
* @since 3.2.1
**/
protected string $_pattern = 'Joomla';
/**
* The pattern to get the Back
*
* @var string
* @since 3.2.1
**/
protected string $pattern_ = 'Power';
/**
* The Table
*
* @var string
* @since 3.2.1
**/
protected string $table = 'joomla_power';
/**
* Current Joomla Version Being Build
*
* @var int
* @since 3.2.0
**/
protected $targetVersion;
/**
* Constructor.
*
* @param int $targetVersion The targeted Joomla version.
*
* @since 3.2.1
*/
public function __construct(int $targetVersion)
{
parent::__construct();
$this->targetVersion = $targetVersion;
}
/**
* Get the complete namespace strings of the guids passed as an array.
*
* @param array $guids The guids to filter the results
*
* @return array|null The result namespaces with their guids
* @since 3.2.0
**/
protected function namespaces(array $guids): ?array
{
$query = $this->db->getQuery(true);
$query->select($this->db->quoteName(['settings', 'guid']))
->from($this->db->quoteName('#__componentbuilder_' . $this->table))
->where($this->db->quoteName('guid') . ' IN (' . implode(',', array_map([$this->db, 'quote'], $guids)) . ')');
$this->db->setQuery($query);
$this->db->execute();
if ($this->db->getNumRows())
{
$namespaces = [];
$items = $this->db->loadAssocList();
foreach ($items as $item)
{
if (JsonHelper::check($item->settings))
{
$item->settings = json_decode($item->settings, true);
echo '<pre>'; var_dump($item->settings, 'Joomla Version: ' . $this->targetVersion); exit;
}
}
if ($namespaces !== [])
{
return $namespaces;
}
}
return null;
}

View File

@ -0,0 +1,20 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "eeb03266-22fd-45bb-953a-961bb6be3a54",
"guid": "82505f3f-297f-4d75-a581-929ab3e93689",
"implements": [
"c159425c-51f9-4a15-af99-f2d0c6d7aae8"
],
"load_selection": null,
"name": "Extractor",
"power_version": "1.0.0",
"system_name": "JCB.Compiler.JoomlaPower.Extractor",
"type": "final class",
"use_selection": null,
"namespace": "VDM\\Joomla\\Componentbuilder.Compiler.JoomlaPower.Extractor",
"description": "Compiler Joomla Power Extractor\r\n@since 3.2.1",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
"head": "",
"composer": ""
}

View File

@ -0,0 +1,38 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# final class Upsert (Details)
> namespace: **VDM\Joomla\Componentbuilder\JoomlaPower\Model**
> extends: **Upsert**
```uml
@startuml
class Upsert << (F,LightGreen) >> #RoyalBlue {
# getTable() : string
}
note right of Upsert::getTable
Get the current active table
since: 3.2.0
return: string
end note
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,38 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\JoomlaPower\Model;
use VDM\Joomla\Interfaces\ModelInterface;
use VDM\Joomla\Componentbuilder\Power\Model\Upsert;
/**
* Joomla Power Model Update or Insert
*
* @since 3.2.0
*/
final class Upsert extends Upsert implements ModelInterface
{
/**
* Get the current active table
*
* @return string
* @since 3.2.0
*/
protected function getTable(): string
{
return 'joomla_power';
}
}

View File

@ -0,0 +1,10 @@
/**
* Get the current active table
*
* @return string
* @since 3.2.0
*/
protected function getTable(): string
{
return 'joomla_power';
}

View File

@ -0,0 +1,20 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "7c1fb50f-8fb1-4627-8705-6fedf7182ca5",
"guid": "9206082e-a3f7-472e-98b2-de90d06cbdcd",
"implements": [
"8aef58c1-3f70-4bd4-b9e4-3f29fcd41cff"
],
"load_selection": null,
"name": "Upsert",
"power_version": "1.0.0",
"system_name": "JCB.JoomlaPower.Model.Upsert",
"type": "final class",
"use_selection": null,
"namespace": "VDM\\Joomla\\Componentbuilder.JoomlaPower.Model.Upsert",
"description": "Joomla Power Model Update or Insert\r\n\r\n@since 3.2.0",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
"head": "",
"composer": ""
}

View File

@ -0,0 +1,80 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# interface InsertInterface (Details)
> namespace: **VDM\Joomla\Componentbuilder\Interfaces\Database**
```uml
@startuml
interface InsertInterface #Lavender {
+ value(mixed $value, string $field, ...) : bool
+ row(array $item) : bool
+ rows(?array $items) : bool
+ item(object $item) : bool
+ items(?array $items) : bool
}
note right of InsertInterface::value
Insert a value to a given table
Example: $this->value(Value, 'value_key', 'GUID');
since: 3.2.0
return: bool
arguments:
mixed $value
string $field
string $keyValue
string $key = 'guid'
end note
note right of InsertInterface::row
Insert single row with multiple values to a given table
Example: $this->item(Array);
since: 3.2.0
return: bool
end note
note right of InsertInterface::rows
Insert multiple rows to a given table
Example: $this->items(Array);
since: 3.2.0
return: bool
end note
note right of InsertInterface::item
Insert single item with multiple values to a given table
Example: $this->item(Object);
since: 3.2.0
return: bool
end note
note right of InsertInterface::items
Insert multiple items to a given table
Example: $this->items(Array);
since: 3.2.0
return: bool
end note
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,81 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\Interfaces\Database;
/**
* Database Insert
*
* @since 3.2.1
*/
interface InsertInterface
{
/**
* Insert a value to a given table
* Example: $this->value(Value, 'value_key', 'GUID');
*
* @param mixed $value The field value
* @param string $field The field key
* @param string $keyValue The key value
* @param string $key The key name
*
* @return bool
* @since 3.2.0
*/
public function value($value, string $field, string $keyValue, string $key = 'guid'): bool;
/**
* Insert single row with multiple values to a given table
* Example: $this->item(Array);
*
* @param array $item The item to save
*
* @return bool
* @since 3.2.0
*/
public function row(array $item): bool;
/**
* Insert multiple rows to a given table
* Example: $this->items(Array);
*
* @param array|null $items The items updated in database (array of arrays)
*
* @return bool
* @since 3.2.0
*/
public function rows(?array $items): bool;
/**
* Insert single item with multiple values to a given table
* Example: $this->item(Object);
*
* @param object $item The item to save
*
* @return bool
* @since 3.2.0
*/
public function item(object $item): bool;
/**
* Insert multiple items to a given table
* Example: $this->items(Array);
*
* @param array|null $items The items updated in database (array of objects)
*
* @return bool
* @since 3.2.0
*/
public function items(?array $items): bool;
}

View File

@ -0,0 +1,57 @@
/**
* Insert a value to a given table
* Example: $this->value(Value, 'value_key', 'GUID');
*
* @param mixed $value The field value
* @param string $field The field key
* @param string $keyValue The key value
* @param string $key The key name
*
* @return bool
* @since 3.2.0
*/
public function value($value, string $field, string $keyValue, string $key = 'guid'): bool;
/**
* Insert single row with multiple values to a given table
* Example: $this->item(Array);
*
* @param array $item The item to save
*
* @return bool
* @since 3.2.0
*/
public function row(array $item): bool;
/**
* Insert multiple rows to a given table
* Example: $this->items(Array);
*
* @param array|null $items The items updated in database (array of arrays)
*
* @return bool
* @since 3.2.0
*/
public function rows(?array $items): bool;
/**
* Insert single item with multiple values to a given table
* Example: $this->item(Object);
*
* @param object $item The item to save
*
* @return bool
* @since 3.2.0
*/
public function item(object $item): bool;
/**
* Insert multiple items to a given table
* Example: $this->items(Array);
*
* @param array|null $items The items updated in database (array of objects)
*
* @return bool
* @since 3.2.0
*/
public function items(?array $items): bool;

View File

@ -0,0 +1,18 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "0",
"guid": "95c02df3-fe0a-405b-b506-b7a5b8605b66",
"implements": null,
"load_selection": null,
"name": "InsertInterface",
"power_version": "1.0.0",
"system_name": "JCB.Interfaces.Database.InsertInterface",
"type": "interface",
"use_selection": null,
"namespace": "VDM\\Joomla\\Componentbuilder.Interfaces.Database.InsertInterface",
"description": "Database Insert\r\n\r\n@since 3.2.1",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
"head": "",
"composer": ""
}

View File

@ -0,0 +1,72 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# interface LoadInterface (Details)
> namespace: **VDM\Joomla\Componentbuilder\Power\Database**
```uml
@startuml
interface LoadInterface #Lavender {
+ value(array $keys, string $field) : mixed
+ item(array $keys) : ?object
+ items(array $keys) : ?array
}
note right of LoadInterface::value
Get a value from a given table
Example: $this->value(
[
'guid' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
], 'value_key'
);
since: 2.0.1
return: mixed
end note
note right of LoadInterface::item
Get values from a given table
Example: $this->item(
[
'guid' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
]
);
since: 2.0.1
return: ?object
end note
note right of LoadInterface::items
Get values from a given table
Example: $this->items(
[
'guid' => [
'operator' => 'IN',
'value' => [''xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'', ''xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'']
]
]
);
Example: $this->items($ids, 'table_name');
since: 2.0.1
return: ?array
end note
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,75 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\Power\Database;
/**
* Power Database Load
*
* @since 2.0.1
*/
interface LoadInterface
{
/**
* Get a value from a given table
* Example: $this->value(
* [
* 'guid' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
* ], 'value_key'
* );
*
* @param array $keys The item keys
* @param string $field The field key
* @param string $table The table
*
* @return mixed
* @since 2.0.1
*/
public function value(array $keys, string $field);
/**
* Get values from a given table
* Example: $this->item(
* [
* 'guid' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
* ]
* );
*
* @param array $keys The item keys
* @param string $table The table
*
* @return object|null
* @since 2.0.1
*/
public function item(array $keys): ?object;
/**
* Get values from a given table
* Example: $this->items(
* [
* 'guid' => [
* 'operator' => 'IN',
* 'value' => [''xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'', ''xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'']
* ]
* ]
* );
* Example: $this->items($ids, 'table_name');
*
* @param array $keys The item keys
* @param string $table The table
*
* @return array|null
* @since 2.0.1
*/
public function items(array $keys): ?array;
}

View File

@ -0,0 +1,52 @@
/**
* Get a value from a given table
* Example: $this->value(
* [
* 'guid' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
* ], 'value_key'
* );
*
* @param array $keys The item keys
* @param string $field The field key
* @param string $table The table
*
* @return mixed
* @since 2.0.1
*/
public function value(array $keys, string $field);
/**
* Get values from a given table
* Example: $this->item(
* [
* 'guid' => 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
* ]
* );
*
* @param array $keys The item keys
* @param string $table The table
*
* @return object|null
* @since 2.0.1
*/
public function item(array $keys): ?object;
/**
* Get values from a given table
* Example: $this->items(
* [
* 'guid' => [
* 'operator' => 'IN',
* 'value' => [''xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'', ''xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'']
* ]
* ]
* );
* Example: $this->items($ids, 'table_name');
*
* @param array $keys The item keys
* @param string $table The table
*
* @return array|null
* @since 2.0.1
*/
public function items(array $keys): ?array;

View File

@ -0,0 +1,18 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "0",
"guid": "99786f53-64b7-4d52-95b0-5306e7386c3f",
"implements": null,
"load_selection": null,
"name": "LoadInterface",
"power_version": "1.0.0",
"system_name": "JCB.Interfaces.Database.LoadInterface",
"type": "interface",
"use_selection": null,
"namespace": "VDM\\Joomla\\Componentbuilder.Power.Database.LoadInterface",
"description": "Power Database Load\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 <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
"head": "",
"composer": ""
}

View File

@ -0,0 +1,31 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# final class Insert (Details)
> namespace: **VDM\Joomla\Componentbuilder\JoomlaPower\Database**
> extends: **Insert**
```uml
@startuml
class Insert << (F,LightGreen) >> #RoyalBlue {
# string $table
}
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,34 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\JoomlaPower\Database;
use VDM\Joomla\Componentbuilder\Interfaces\Database\InsertInterface;
use VDM\Joomla\Componentbuilder\Power\Database\Insert;
/**
* Joomla Power Database Insert
*
* @since 3.2.1
*/
final class Insert extends Insert implements InsertInterface
{
/**
* Table Name
*
* @var string
* @since 3.2.1
*/
protected string $table = 'power';
}

View File

@ -0,0 +1,7 @@
/**
* Table Name
*
* @var string
* @since 3.2.1
*/
protected string $table = 'power';

View File

@ -0,0 +1,20 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "380bb7a3-cdcc-4336-a699-5070cbf521a5",
"guid": "9d53d45e-9b4d-45ec-827b-4916b91c907e",
"implements": [
"95c02df3-fe0a-405b-b506-b7a5b8605b66"
],
"load_selection": null,
"name": "Insert",
"power_version": "1.0.0",
"system_name": "JCB.JoomlaPower.Database.Insert",
"type": "final class",
"use_selection": null,
"namespace": "VDM\\Joomla\\Componentbuilder.JoomlaPower.Database.Insert",
"description": "Joomla Power Database Insert\r\n\r\n@since 3.2.1",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
"head": "",
"composer": ""
}

View File

@ -0,0 +1,77 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# class Database (Details)
> namespace: **VDM\Joomla\Componentbuilder\JoomlaPower\Service**
```uml
@startuml
class Database #Gold {
+ register(Container $container) : void
+ getModelLoad(Container $container) : ModelLoad
+ getModelUpsert(Container $container) : ModelUpsert
+ getLoadDatabase(Container $container) : LoadDatabase
+ getInsertDatabase(Container $container) : InsertDatabase
+ getUpdateDatabase(Container $container) : UpdateDatabase
}
note right of Database::register
Registers the service provider with a DI container.
since: 3.2.0
return: void
end note
note right of Database::getModelLoad
Get the Power Model Load
since: 3.2.0
return: ModelLoad
end note
note right of Database::getModelUpsert
Get the Power Model Update or Insert
since: 3.2.0
return: ModelUpsert
end note
note right of Database::getLoadDatabase
Get the Load Database
since: 3.2.0
return: LoadDatabase
end note
note right of Database::getInsertDatabase
Get the Insert Database
since: 3.2.0
return: InsertDatabase
end note
note right of Database::getUpdateDatabase
Get the Update Database
since: 3.2.0
return: UpdateDatabase
end note
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,135 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\JoomlaPower\Service;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use VDM\Joomla\Componentbuilder\JoomlaPower\Model\Load as ModelLoad;
use VDM\Joomla\Componentbuilder\JoomlaPower\Model\Upsert as ModelUpsert;
use VDM\Joomla\Componentbuilder\JoomlaPower\Database\Load as LoadDatabase;
use VDM\Joomla\Componentbuilder\JoomlaPower\Database\Insert as InsertDatabase;
use VDM\Joomla\Componentbuilder\JoomlaPower\Database\Update as UpdateDatabase;
/**
* Database Service Provider
*
* @since 3.2.0
*/
class Database implements ServiceProviderInterface
{
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
* @since 3.2.0
*/
public function register(Container $container)
{
$container->alias(ModelLoad::class, 'Joomla.Power.Model.Load')
->share('Joomla.Power.Model.Load', [$this, 'getModelLoad'], true);
$container->alias(ModelUpsert::class, 'Joomla.Power.Model.Upsert')
->share('Joomla.Power.Model.Upsert', [$this, 'getModelUpsert'], true);
$container->alias(LoadDatabase::class, 'Joomla.Power.Database.Load')
->share('Joomla.Power.Database.Load', [$this, 'getLoadDatabase'], true);
$container->alias(InsertDatabase::class, 'Joomla.Power.Database.Insert')
->share('Joomla.Power.Database.Insert', [$this, 'getInsertDatabase'], true);
$container->alias(UpdateDatabase::class, 'Joomla.Power.Database.Update')
->share('Joomla.Power.Database.Update', [$this, 'getUpdateDatabase'], true);
}
/**
* Get the Power Model Load
*
* @param Container $container The DI container.
*
* @return ModelLoad
* @since 3.2.0
*/
public function getModelLoad(Container $container): ModelLoad
{
return new ModelLoad(
$container->get('Table')
);
}
/**
* Get the Power Model Update or Insert
*
* @param Container $container The DI container.
*
* @return ModelUpsert
* @since 3.2.0
*/
public function getModelUpsert(Container $container): ModelUpsert
{
return new ModelUpsert(
$container->get('Table')
);
}
/**
* Get the Load Database
*
* @param Container $container The DI container.
*
* @return LoadDatabase
* @since 3.2.0
*/
public function getLoadDatabase(Container $container): LoadDatabase
{
return new LoadDatabase(
$container->get('Joomla.Power.Model.Load'),
$container->get('Load')
);
}
/**
* Get the Insert Database
*
* @param Container $container The DI container.
*
* @return InsertDatabase
* @since 3.2.0
*/
public function getInsertDatabase(Container $container): InsertDatabase
{
return new InsertDatabase(
$container->get('Joomla.Power.Model.Upsert'),
$container->get('Insert')
);
}
/**
* Get the Update Database
*
* @param Container $container The DI container.
*
* @return UpdateDatabase
* @since 3.2.0
*/
public function getUpdateDatabase(Container $container): UpdateDatabase
{
return new UpdateDatabase(
$container->get('Joomla.Power.Model.Upsert'),
$container->get('Update')
);
}
}

View File

@ -0,0 +1,103 @@
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
* @since 3.2.0
*/
public function register(Container $container)
{
$container->alias(ModelLoad::class, 'Joomla.Power.Model.Load')
->share('Joomla.Power.Model.Load', [$this, 'getModelLoad'], true);
$container->alias(ModelUpsert::class, 'Joomla.Power.Model.Upsert')
->share('Joomla.Power.Model.Upsert', [$this, 'getModelUpsert'], true);
$container->alias(LoadDatabase::class, 'Joomla.Power.Database.Load')
->share('Joomla.Power.Database.Load', [$this, 'getLoadDatabase'], true);
$container->alias(InsertDatabase::class, 'Joomla.Power.Database.Insert')
->share('Joomla.Power.Database.Insert', [$this, 'getInsertDatabase'], true);
$container->alias(UpdateDatabase::class, 'Joomla.Power.Database.Update')
->share('Joomla.Power.Database.Update', [$this, 'getUpdateDatabase'], true);
}
/**
* Get the Power Model Load
*
* @param Container $container The DI container.
*
* @return ModelLoad
* @since 3.2.0
*/
public function getModelLoad(Container $container): ModelLoad
{
return new ModelLoad(
$container->get('Table')
);
}
/**
* Get the Power Model Update or Insert
*
* @param Container $container The DI container.
*
* @return ModelUpsert
* @since 3.2.0
*/
public function getModelUpsert(Container $container): ModelUpsert
{
return new ModelUpsert(
$container->get('Table')
);
}
/**
* Get the Load Database
*
* @param Container $container The DI container.
*
* @return LoadDatabase
* @since 3.2.0
*/
public function getLoadDatabase(Container $container): LoadDatabase
{
return new LoadDatabase(
$container->get('Joomla.Power.Model.Load'),
$container->get('Load')
);
}
/**
* Get the Insert Database
*
* @param Container $container The DI container.
*
* @return InsertDatabase
* @since 3.2.0
*/
public function getInsertDatabase(Container $container): InsertDatabase
{
return new InsertDatabase(
$container->get('Joomla.Power.Model.Upsert'),
$container->get('Insert')
);
}
/**
* Get the Update Database
*
* @param Container $container The DI container.
*
* @return UpdateDatabase
* @since 3.2.0
*/
public function getUpdateDatabase(Container $container): UpdateDatabase
{
return new UpdateDatabase(
$container->get('Joomla.Power.Model.Upsert'),
$container->get('Update')
);
}

View File

@ -0,0 +1,42 @@
{
"add_head": "1",
"add_licensing_template": "2",
"extends": "0",
"guid": "a2992a91-eec2-4957-811b-8cde22aa1438",
"implements": [
"-1"
],
"load_selection": null,
"name": "Database",
"power_version": "1.0.0",
"system_name": "JCB.JoomlaPower.Service.Database",
"type": "class",
"use_selection": {
"use_selection0": {
"use": "05744dd3-4030-4cf8-8dda-a93ab809b473",
"as": "ModelLoad"
},
"use_selection1": {
"use": "9206082e-a3f7-472e-98b2-de90d06cbdcd",
"as": "ModelUpsert"
},
"use_selection2": {
"use": "b4ea5de3-653f-43f9-b927-4ba6456b4d0a",
"as": "LoadDatabase"
},
"use_selection3": {
"use": "9d53d45e-9b4d-45ec-827b-4916b91c907e",
"as": "InsertDatabase"
},
"use_selection4": {
"use": "679473f6-3ea2-49d5-8273-1b29c8f0ad2b",
"as": "UpdateDatabase"
}
},
"namespace": "VDM\\Joomla\\Componentbuilder.JoomlaPower.Service.Database",
"description": "Database Service Provider\r\n\r\n@since 3.2.0",
"implements_custom": "ServiceProviderInterface",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
"head": "use Joomla\\DI\\Container;\r\nuse Joomla\\DI\\ServiceProviderInterface;",
"composer": ""
}

View File

@ -0,0 +1,180 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# final class Injector (Details)
> namespace: **VDM\Joomla\Componentbuilder\Compiler\JoomlaPower**
> extends: **Injector**
```uml
@startuml
class Injector << (F,LightGreen) >> #RoyalBlue {
# update(array $guids, string $code) : string
# inspect(object $power, ?array $useStatements, ...) : ?string
# buildNamespaceStatment(object $power) : string
# extractUseStatements(string $useStatement, string $className, ...) : array
# isUseStatementEqual(string $useStatement, string $namespaceStatement) : bool
# extractClassNameOrAlias(string $useStatement) : ?string
# getUniqueName(string $name, object $power) : string
# extractLastNameFromNamespace(string $namespace) : ?string
# removeLastNameFromNamespace(string $namespace) : string
# shouldAddTraitStatement(object $power) : bool
# handleTraitLogic(string $name, object $power, ...) : void
# addUseStatement(string $name, string $className, ...) : void
# addUseStatements(string $code, ?array $useStatements) : string
# addLines(string $code, string $lines) : string
# addLinesAfterDefinedLine(string $code, string $lines) : string
}
note right of Injector::update
Update the code
since: 3.2.0
return: string
end note
note left of Injector::inspect
Inspect the super power to determine the necessary class name based on use statements and traits.
It checks if the given power (class, trait, etc.) already has a corresponding use statement
and handles the naming accordingly to avoid conflicts.
since: 3.2.0
return: ?string
arguments:
object $power
?array $useStatements
?array $traits
end note
note right of Injector::buildNamespaceStatment
Builds the namespace statement from the power object's namespace and class name.
since: 3.2.0
return: string
end note
note left of Injector::extractUseStatements
Extracts and processes use statements to find if the current class name is already used.
It identifies any potential naming conflicts.
since: 3.2.0
return: array
arguments:
string $useStatement
string $className
?array $useStatements
end note
note right of Injector::isUseStatementEqual
Checks if the namespace statement is already declared in the current use statements.
This method uses a regular expression to check for an exact match of the full statement,
taking into account the possibility of an alias being used.
return: bool
end note
note left of Injector::extractClassNameOrAlias
Extracts the class name or alias from a use statement.
This method parses a PHP 'use' statement and extracts either the class name or its alias.
If the statement doesn't match the expected format, or if no class name or alias is found,
the method returns null.
Example:
- 'use Namespace\ClassName;' -> returns 'ClassName'
- 'use Namespace\ClassName as Alias;' -> returns 'Alias'
since: 3.2.0
return: ?string
end note
note right of Injector::getUniqueName
Ensures the name for the use statement is unique, avoiding conflicts with other classes.
since: 3.2.0
return: string
end note
note left of Injector::extractLastNameFromNamespace
Extracts the last part of a namespace string, which is typically the class name.
since: 3.2.0
return: ?string
end note
note right of Injector::removeLastNameFromNamespace
Removes the last name from the namespace.
since: 3.2.0
return: string
end note
note left of Injector::shouldAddTraitStatement
Determines whether a trait statement should be added.
since: 3.2.0
return: bool
end note
note right of Injector::handleTraitLogic
Handles specific logic for traits, such as checking if the trait is already used.
since: 3.2.0
return: void
arguments:
string $name
object $power
?array $traits
end note
note left of Injector::addUseStatement
Adds a use statement to the class if it's not already present.
since: 3.2.0
return: void
arguments:
string $name
string $className
string $namespaceStatement
end note
note right of Injector::addUseStatements
Insert a line before the class declaration in the given class code.
since: 3.2.0
return: string
end note
note left of Injector::addLines
Insert a line before the class declaration in the given class code.
since: 3.2.0
return: string
end note
note right of Injector::addLinesAfterDefinedLine
Inserts a new line after the defined('_JEXEC') line.
since: 3.2.0
return: string
end note
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,504 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\Compiler\JoomlaPower;
use VDM\Joomla\Componentbuilder\Compiler\Interfaces\Power\InjectorInterface;
use VDM\Joomla\Componentbuilder\Compiler\Power\Injector;
/**
* Compiler Joomla Power Injector
* @since 3.2.0
*/
final class Injector extends Injector implements InjectorInterface
{
/**
* Update the code
*
* @param array $guids The Power guids found
* @param string $code The class code
*
* @return string The updated code
* @since 3.2.0
*/
protected function update(array $guids, string $code): string
{
$use_statements = $this->parser->getUseStatements($code);
$traits = $this->parser->getTraits(
$this->parser->getClassCode($code) ?? ''
);
// reset with each file
$this->map = [];
$this->useStatements = [];
$this->traits = [];
$this->other = [];
$this->duplicate = [];
foreach ($guids as $key => $guid)
{
if (($power = $this->power->get($guid)) !== null)
{
if (($name = $this->inspect($power, $use_statements, $traits)) !== null)
{
$this->map[$key] = $name;
}
}
}
// update
if ($this->map !== [])
{
if ($this->useStatements !== [])
{
$code = $this->addUseStatements($code, $use_statements);
}
return $this->placeholder->update($code, $this->map);
}
return $code;
}
/**
* Inspect the super power to determine the necessary class name based on use statements and traits.
* It checks if the given power (class, trait, etc.) already has a corresponding use statement
* and handles the naming accordingly to avoid conflicts.
*
* @param object $power The power object containing type, namespace, and class name.
* @param array|null $useStatements Array of existing use statements in the code.
* @param array|null $traits Array of existing traits used in the code.
*
* @return string|null The determined class name, or null if the type is not valid.
* @since 3.2.0
*/
protected function inspect(object $power, ?array $useStatements, ?array $traits): ?string
{
$namespaceStatement = $this->buildNamespaceStatment($power);
$use_extracted = $this->extractUseStatements($namespaceStatement, $power->class_name, $useStatements);
$name = $use_extracted['found'] ?? $power->class_name;
$name = $this->getUniqueName($name, $power);
$this->handleTraitLogic($name, $power, $traits);
if (!$use_extracted['hasStatement'])
{
$this->addUseStatement($name, $power->class_name, $namespaceStatement);
}
return $name;
}
/**
* Builds the namespace statement from the power object's namespace and class name.
*
* @param object $power The power object.
*
* @return string The constructed use statement.
* @since 3.2.0
*/
protected function buildNamespaceStatment(object $power): string
{
return $power->_namespace . '\\' . $power->class_name;
}
/**
* Extracts and processes use statements to find if the current class name is already used.
* It identifies any potential naming conflicts.
*
* @param string $useStatement The search statement of the current class.
* @param string $className The class name of the power object.
* @param array|null $useStatements The existing use statements.
*
* @return array An array with keys 'found' and 'hasStatement'.
* @since 3.2.0
*/
protected function extractUseStatements(string $useStatement, string $className, ?array $useStatements): array
{
$results = ['found' => null, 'hasStatement' => false];
if ($useStatements !== null)
{
foreach ($useStatements as $use_statement)
{
$class_name = $this->extractClassNameOrAlias($use_statement);
if ($this->isUseStatementEqual($use_statement, $useStatement))
{
if ($results['found'] === null)
{
$results['found'] = $class_name;
$results['hasStatement'] = true;
}
else
{
// TODO we need to backport fix these
$this->duplicate[$use_statement] = $class_name;
}
}
elseif ($className === $class_name)
{
$this->other[$className] = $class_name;
}
}
}
return $results;
}
/**
* Checks if the namespace statement is already declared in the current use statements.
*
* This method uses a regular expression to check for an exact match of the full statement,
* taking into account the possibility of an alias being used.
*
* @param string $useStatement The existing use statement to check against.
* @param string $namespaceStatement The search statement to search for (without the trailing semicolon, or use prefix).
*
* @return bool True if the full statement is found, false otherwise.
*/
protected function isUseStatementEqual(string $useStatement, string $namespaceStatement): bool
{
// Create a regular expression pattern to match the full statement
// The pattern checks for the start of the statement, optional whitespace,
// and an optional alias after the full statement.
$pattern = '/^use\s+' . preg_quote($namespaceStatement, '/') . '(?:\s+as\s+\w+)?;$/';
// Perform the regex match to check if the use statement is equal to the search statment
return (bool) preg_match($pattern, $useStatement);
}
/**
* Extracts the class name or alias from a use statement.
*
* This method parses a PHP 'use' statement and extracts either the class name or its alias.
* If the statement doesn't match the expected format, or if no class name or alias is found,
* the method returns null.
*
* Example:
* - 'use Namespace\ClassName;' -> returns 'ClassName'
* - 'use Namespace\ClassName as Alias;' -> returns 'Alias'
*
* @param string $useStatement The use statement from which to extract the class name or alias.
*
* @return string|null The class name or alias if found, null otherwise.
* @since 3.2.0
*/
protected function extractClassNameOrAlias(string $useStatement): ?string
{
// If the input doesn't start with 'use ', assume it's just the namespace without a use statement
if (strpos($useStatement, 'use ') !== 0)
{
return $this->extractLastNameFromNamespace($useStatement);
}
// Regular expression to extract the class name and alias from the use statement
$pattern = '/use\s+(?P<namespace>[\w\\\\]+?)(?:\s+as\s+(?P<alias>\w+))?;/';
if (preg_match($pattern, $useStatement, $matches))
{
// Return the alias if it exists; otherwise, return the last part of the namespace (class name)
return $matches['alias'] ?? $this->extractLastNameFromNamespace($matches['namespace']);
}
// Return null if no match is found
return null;
}
/**
* Ensures the name for the use statement is unique, avoiding conflicts with other classes.
*
* @param string $name The current name
* @param object $power The power object containing type, namespace, and class name.
*
* @return string The unique name
* @since 3.2.0
*/
protected function getUniqueName(string $name, object $power): string
{
// set search namespace
$namespace = ($name !== $power->class_name) ? $this->buildNamespaceStatment($power) : $power->_namespace;
// check if we need to update the name
if (isset($this->other[$name]))
{
// if the name is already used
while (isset($this->other[$name]))
{
if (($tmp = $this->extractClassNameOrAlias($namespace)) !== null)
{
$name = ucfirst($tmp) . $name;
$namespace = $this->removeLastNameFromNamespace($namespace);
}
else
{
$name = 'Unique' . $name;
}
}
}
// also loop new found use statements
if (isset($this->useStatements[$name]))
{
// if the name is already used
while (isset($this->useStatements[$name]))
{
if (($tmp = $this->extractClassNameOrAlias($namespace)) !== null)
{
$name = ucfirst($tmp) . $name;
$namespace = $this->removeLastNameFromNamespace($namespace);
}
else
{
$name = 'Unique' . $name;
}
}
}
return $name;
}
/**
* Extracts the last part of a namespace string, which is typically the class name.
*
* @param string $namespace The namespace string to extract from.
*
* @return string|null The extracted class name.
* @since 3.2.0
*/
protected function extractLastNameFromNamespace(string $namespace): ?string
{
$parts = explode('\\', $namespace);
$result = end($parts);
// Remove '\\' from the beginning and end of the resulting string
$result = trim($result, '\\');
// If the resulting string is empty, return null
return empty($result) ? null : $result;
}
/**
* Removes the last name from the namespace.
*
* @param string $namespace The namespace
*
* @return string The namespace shortened
* @since 3.2.0
*/
protected function removeLastNameFromNamespace(string $namespace): string
{
// Remove '\\' from the beginning and end of the resulting string
$namespace = trim($namespace, '\\');
$parts = explode('\\', $namespace);
// Remove the last part (the class name)
array_pop($parts);
// Reassemble the namespace without the class name
return implode('\\', $parts);
}
/**
* Determines whether a trait statement should be added.
*
* @param object $power The power object.
*
* @return bool True if a trait statement should be added, false otherwise.
* @since 3.2.0
*/
protected function shouldAddTraitStatement(object $power): bool
{
return $power->type === 'trait';
}
/**
* Handles specific logic for traits, such as checking if the trait is already used.
*
* @param string $name The current name.
* @param object $power The power object containing type, namespace, and class name.
* @param array|null $traits The traits used in the code.
*
* @return void
* @since 3.2.0
*/
protected function handleTraitLogic(string $name, object $power, ?array $traits): void
{
if ($this->shouldAddTraitStatement($power) && $traits !== null)
{
foreach ($traits as $trait)
{
if ($trait === $name)
{
return;
}
}
}
// add the trait
$this->traits[$name] = 'use ' . $name . ';';
}
/**
* Adds a use statement to the class if it's not already present.
*
* @param string $name The name to use.
* @param string $className The class name of the power object.
* @param string $namespaceStatement The search statement to search for (without the trailing semicolon, or use prefix).
*
* @since 3.2.0
*/
protected function addUseStatement(string &$name, string $className, string $namespaceStatement): void
{
if ($name !== $className)
{
$statement = 'use ' . $namespaceStatement . ' as ' . $name . ';';
}
else
{
$statement = 'use ' . $namespaceStatement . ';';
}
$this->useStatements[$name] = $statement;
}
/**
* Insert a line before the class declaration in the given class code.
*
* @param string $code The class code
* @param array|null $useStatements The existing use statements
*
* @return string The modified file content
* @since 3.2.0
*/
protected function addUseStatements(string $code, ?array $useStatements): string
{
if ($useStatements !== null)
{
// we add the use statements using existing use statements
$key = end($useStatements);
array_unshift($this->useStatements, $key);
return $this->placeholder->update($code, [$key => implode(PHP_EOL, array_values($this->useStatements))]);
}
return $this->addLines($code, implode(PHP_EOL, array_values($this->useStatements)));
}
/**
* Insert a line before the class declaration in the given class code.
*
* @param string $code The class code
* @param string $lines The new lines to insert
*
* @return string The modified file content
* @since 3.2.0
*/
protected function addLines(string $code, string $lines): string
{
// Pattern to match class, final class, abstract class, interface, and trait
$pattern = '/(?:class|final class|abstract class|interface|trait)\s+[a-zA-Z0-9_]+\s*(?:extends\s+[a-zA-Z0-9_]+\s*)?(?:implements\s+[a-zA-Z0-9_]+(?:\s*,\s*[a-zA-Z0-9_]+)*)?\s*\{/s';
// Find the position of the class declaration
preg_match($pattern, $code, $matches, PREG_OFFSET_CAPTURE);
$class_declaration_pos = $matches[0][1] ?? null;
if (null !== $class_declaration_pos)
{
// Find the position of the last newline character before the class declaration
$last_newline_pos = strrpos($code, PHP_EOL, -(strlen($code) - $class_declaration_pos));
// Find the position of the comment block right before the class declaration
$comment_pattern = '/\s*\*\/\s*$/m';
$insert_pos = null;
if (preg_match($comment_pattern, $code, $comment_matches, PREG_OFFSET_CAPTURE, $last_newline_pos))
{
$insert_pos = (int) $comment_matches[0][1] + strlen($comment_matches[0][0]);
}
else
{
// Find the last empty line before the class declaration
$empty_line_pattern = '/(^|\r\n|\r|\n)[\s]*($|\r\n|\r|\n)/';
if (preg_match($empty_line_pattern, $code, $empty_line_matches, PREG_OFFSET_CAPTURE, $last_newline_pos))
{
$insert_pos = (int) $empty_line_matches[0][1] + strlen($empty_line_matches[0][0]);
}
}
// Insert the new line at the found position
if (null !== $insert_pos)
{
return substr_replace($code, $lines . PHP_EOL, $insert_pos, 0);
}
}
// last try targeting the defined line
return $this->addLinesAfterDefinedLine($code, $lines);
}
/**
* Inserts a new line after the defined('_JEXEC') line.
*
* @param string $code The class code
* @param string $lines The new lines to insert
*
* @return string The modified file content
* @since 3.2.0
*/
protected function addLinesAfterDefinedLine(string $code, string $lines): string
{
// Patterns to match the defined('_JEXEC') and defined('JPATH_BASE') lines
$patterns = [
"/defined\('_JEXEC'\)(.*?)\s*;/",
"/\\defined\('_JEXEC'\)(.*?)\s*;/",
"/defined\('JPATH_BASE'\)(.*?)\s*;/",
"/\\defined\('JPATH_BASE'\)(.*?)\s*;/",
];
$insert_pos = null;
// Iterate through the patterns and try to find a match
foreach ($patterns as $pattern)
{
preg_match($pattern, $code, $matches, PREG_OFFSET_CAPTURE);
$defined_line_pos = $matches[0][1] ?? null;
if ($defined_line_pos !== null)
{
// Find the position of the newline character after the defined() line
$next_lines_pos = strpos($code, PHP_EOL, (int) $defined_line_pos + strlen($matches[0][0]));
// Insert the new line at the found position
if ($next_lines_pos !== false)
{
$insert_pos = $next_lines_pos;
break;
}
}
}
// Insert the new line at the found position
if ($insert_pos !== null)
{
$code = substr_replace($code, PHP_EOL . $lines, $insert_pos, 0);
}
return $code;
}
}

View File

@ -0,0 +1,478 @@
/**
* Update the code
*
* @param array $guids The Power guids found
* @param string $code The class code
*
* @return string The updated code
* @since 3.2.0
*/
protected function update(array $guids, string $code): string
{
$use_statements = $this->parser->getUseStatements($code);
$traits = $this->parser->getTraits(
$this->parser->getClassCode($code) ?? ''
);
// reset with each file
$this->map = [];
$this->useStatements = [];
$this->traits = [];
$this->other = [];
$this->duplicate = [];
foreach ($guids as $key => $guid)
{
if (($power = $this->power->get($guid)) !== null)
{
if (($name = $this->inspect($power, $use_statements, $traits)) !== null)
{
$this->map[$key] = $name;
}
}
}
// update
if ($this->map !== [])
{
if ($this->useStatements !== [])
{
$code = $this->addUseStatements($code, $use_statements);
}
return $this->placeholder->update($code, $this->map);
}
return $code;
}
/**
* Inspect the super power to determine the necessary class name based on use statements and traits.
* It checks if the given power (class, trait, etc.) already has a corresponding use statement
* and handles the naming accordingly to avoid conflicts.
*
* @param object $power The power object containing type, namespace, and class name.
* @param array|null $useStatements Array of existing use statements in the code.
* @param array|null $traits Array of existing traits used in the code.
*
* @return string|null The determined class name, or null if the type is not valid.
* @since 3.2.0
*/
protected function inspect(object $power, ?array $useStatements, ?array $traits): ?string
{
$namespaceStatement = $this->buildNamespaceStatment($power);
$use_extracted = $this->extractUseStatements($namespaceStatement, $power->class_name, $useStatements);
$name = $use_extracted['found'] ?? $power->class_name;
$name = $this->getUniqueName($name, $power);
$this->handleTraitLogic($name, $power, $traits);
if (!$use_extracted['hasStatement'])
{
$this->addUseStatement($name, $power->class_name, $namespaceStatement);
}
return $name;
}
/**
* Builds the namespace statement from the power object's namespace and class name.
*
* @param object $power The power object.
*
* @return string The constructed use statement.
* @since 3.2.0
*/
protected function buildNamespaceStatment(object $power): string
{
return $power->_namespace . '\\' . $power->class_name;
}
/**
* Extracts and processes use statements to find if the current class name is already used.
* It identifies any potential naming conflicts.
*
* @param string $useStatement The search statement of the current class.
* @param string $className The class name of the power object.
* @param array|null $useStatements The existing use statements.
*
* @return array An array with keys 'found' and 'hasStatement'.
* @since 3.2.0
*/
protected function extractUseStatements(string $useStatement, string $className, ?array $useStatements): array
{
$results = ['found' => null, 'hasStatement' => false];
if ($useStatements !== null)
{
foreach ($useStatements as $use_statement)
{
$class_name = $this->extractClassNameOrAlias($use_statement);
if ($this->isUseStatementEqual($use_statement, $useStatement))
{
if ($results['found'] === null)
{
$results['found'] = $class_name;
$results['hasStatement'] = true;
}
else
{
// TODO we need to backport fix these
$this->duplicate[$use_statement] = $class_name;
}
}
elseif ($className === $class_name)
{
$this->other[$className] = $class_name;
}
}
}
return $results;
}
/**
* Checks if the namespace statement is already declared in the current use statements.
*
* This method uses a regular expression to check for an exact match of the full statement,
* taking into account the possibility of an alias being used.
*
* @param string $useStatement The existing use statement to check against.
* @param string $namespaceStatement The search statement to search for (without the trailing semicolon, or use prefix).
*
* @return bool True if the full statement is found, false otherwise.
*/
protected function isUseStatementEqual(string $useStatement, string $namespaceStatement): bool
{
// Create a regular expression pattern to match the full statement
// The pattern checks for the start of the statement, optional whitespace,
// and an optional alias after the full statement.
$pattern = '/^use\s+' . preg_quote($namespaceStatement, '/') . '(?:\s+as\s+\w+)?;$/';
// Perform the regex match to check if the use statement is equal to the search statment
return (bool) preg_match($pattern, $useStatement);
}
/**
* Extracts the class name or alias from a use statement.
*
* This method parses a PHP 'use' statement and extracts either the class name or its alias.
* If the statement doesn't match the expected format, or if no class name or alias is found,
* the method returns null.
*
* Example:
* - 'use Namespace\ClassName;' -> returns 'ClassName'
* - 'use Namespace\ClassName as Alias;' -> returns 'Alias'
*
* @param string $useStatement The use statement from which to extract the class name or alias.
*
* @return string|null The class name or alias if found, null otherwise.
* @since 3.2.0
*/
protected function extractClassNameOrAlias(string $useStatement): ?string
{
// If the input doesn't start with 'use ', assume it's just the namespace without a use statement
if (strpos($useStatement, 'use ') !== 0)
{
return $this->extractLastNameFromNamespace($useStatement);
}
// Regular expression to extract the class name and alias from the use statement
$pattern = '/use\s+(?P<namespace>[\w\\\\]+?)(?:\s+as\s+(?P<alias>\w+))?;/';
if (preg_match($pattern, $useStatement, $matches))
{
// Return the alias if it exists; otherwise, return the last part of the namespace (class name)
return $matches['alias'] ?? $this->extractLastNameFromNamespace($matches['namespace']);
}
// Return null if no match is found
return null;
}
/**
* Ensures the name for the use statement is unique, avoiding conflicts with other classes.
*
* @param string $name The current name
* @param object $power The power object containing type, namespace, and class name.
*
* @return string The unique name
* @since 3.2.0
*/
protected function getUniqueName(string $name, object $power): string
{
// set search namespace
$namespace = ($name !== $power->class_name) ? $this->buildNamespaceStatment($power) : $power->_namespace;
// check if we need to update the name
if (isset($this->other[$name]))
{
// if the name is already used
while (isset($this->other[$name]))
{
if (($tmp = $this->extractClassNameOrAlias($namespace)) !== null)
{
$name = ucfirst($tmp) . $name;
$namespace = $this->removeLastNameFromNamespace($namespace);
}
else
{
$name = 'Unique' . $name;
}
}
}
// also loop new found use statements
if (isset($this->useStatements[$name]))
{
// if the name is already used
while (isset($this->useStatements[$name]))
{
if (($tmp = $this->extractClassNameOrAlias($namespace)) !== null)
{
$name = ucfirst($tmp) . $name;
$namespace = $this->removeLastNameFromNamespace($namespace);
}
else
{
$name = 'Unique' . $name;
}
}
}
return $name;
}
/**
* Extracts the last part of a namespace string, which is typically the class name.
*
* @param string $namespace The namespace string to extract from.
*
* @return string|null The extracted class name.
* @since 3.2.0
*/
protected function extractLastNameFromNamespace(string $namespace): ?string
{
$parts = explode('\\', $namespace);
$result = end($parts);
// Remove '\\' from the beginning and end of the resulting string
$result = trim($result, '\\');
// If the resulting string is empty, return null
return empty($result) ? null : $result;
}
/**
* Removes the last name from the namespace.
*
* @param string $namespace The namespace
*
* @return string The namespace shortened
* @since 3.2.0
*/
protected function removeLastNameFromNamespace(string $namespace): string
{
// Remove '\\' from the beginning and end of the resulting string
$namespace = trim($namespace, '\\');
$parts = explode('\\', $namespace);
// Remove the last part (the class name)
array_pop($parts);
// Reassemble the namespace without the class name
return implode('\\', $parts);
}
/**
* Determines whether a trait statement should be added.
*
* @param object $power The power object.
*
* @return bool True if a trait statement should be added, false otherwise.
* @since 3.2.0
*/
protected function shouldAddTraitStatement(object $power): bool
{
return $power->type === 'trait';
}
/**
* Handles specific logic for traits, such as checking if the trait is already used.
*
* @param string $name The current name.
* @param object $power The power object containing type, namespace, and class name.
* @param array|null $traits The traits used in the code.
*
* @return void
* @since 3.2.0
*/
protected function handleTraitLogic(string $name, object $power, ?array $traits): void
{
if ($this->shouldAddTraitStatement($power) && $traits !== null)
{
foreach ($traits as $trait)
{
if ($trait === $name)
{
return;
}
}
}
// add the trait
$this->traits[$name] = 'use ' . $name . ';';
}
/**
* Adds a use statement to the class if it's not already present.
*
* @param string $name The name to use.
* @param string $className The class name of the power object.
* @param string $namespaceStatement The search statement to search for (without the trailing semicolon, or use prefix).
*
* @since 3.2.0
*/
protected function addUseStatement(string &$name, string $className, string $namespaceStatement): void
{
if ($name !== $className)
{
$statement = 'use ' . $namespaceStatement . ' as ' . $name . ';';
}
else
{
$statement = 'use ' . $namespaceStatement . ';';
}
$this->useStatements[$name] = $statement;
}
/**
* Insert a line before the class declaration in the given class code.
*
* @param string $code The class code
* @param array|null $useStatements The existing use statements
*
* @return string The modified file content
* @since 3.2.0
*/
protected function addUseStatements(string $code, ?array $useStatements): string
{
if ($useStatements !== null)
{
// we add the use statements using existing use statements
$key = end($useStatements);
array_unshift($this->useStatements, $key);
return $this->placeholder->update($code, [$key => implode(PHP_EOL, array_values($this->useStatements))]);
}
return $this->addLines($code, implode(PHP_EOL, array_values($this->useStatements)));
}
/**
* Insert a line before the class declaration in the given class code.
*
* @param string $code The class code
* @param string $lines The new lines to insert
*
* @return string The modified file content
* @since 3.2.0
*/
protected function addLines(string $code, string $lines): string
{
// Pattern to match class, final class, abstract class, interface, and trait
$pattern = '/(?:class|final class|abstract class|interface|trait)\s+[a-zA-Z0-9_]+\s*(?:extends\s+[a-zA-Z0-9_]+\s*)?(?:implements\s+[a-zA-Z0-9_]+(?:\s*,\s*[a-zA-Z0-9_]+)*)?\s*\{/s';
// Find the position of the class declaration
preg_match($pattern, $code, $matches, PREG_OFFSET_CAPTURE);
$class_declaration_pos = $matches[0][1] ?? null;
if (null !== $class_declaration_pos)
{
// Find the position of the last newline character before the class declaration
$last_newline_pos = strrpos($code, PHP_EOL, -(strlen($code) - $class_declaration_pos));
// Find the position of the comment block right before the class declaration
$comment_pattern = '/\s*\*\/\s*$/m';
$insert_pos = null;
if (preg_match($comment_pattern, $code, $comment_matches, PREG_OFFSET_CAPTURE, $last_newline_pos))
{
$insert_pos = (int) $comment_matches[0][1] + strlen($comment_matches[0][0]);
}
else
{
// Find the last empty line before the class declaration
$empty_line_pattern = '/(^|\r\n|\r|\n)[\s]*($|\r\n|\r|\n)/';
if (preg_match($empty_line_pattern, $code, $empty_line_matches, PREG_OFFSET_CAPTURE, $last_newline_pos))
{
$insert_pos = (int) $empty_line_matches[0][1] + strlen($empty_line_matches[0][0]);
}
}
// Insert the new line at the found position
if (null !== $insert_pos)
{
return substr_replace($code, $lines . PHP_EOL, $insert_pos, 0);
}
}
// last try targeting the defined line
return $this->addLinesAfterDefinedLine($code, $lines);
}
/**
* Inserts a new line after the defined('_JEXEC') line.
*
* @param string $code The class code
* @param string $lines The new lines to insert
*
* @return string The modified file content
* @since 3.2.0
*/
protected function addLinesAfterDefinedLine(string $code, string $lines): string
{
// Patterns to match the defined('_JEXEC') and defined('JPATH_BASE') lines
$patterns = [
"/defined\('_JEXEC'\)(.*?)\s*;/",
"/\\defined\('_JEXEC'\)(.*?)\s*;/",
"/defined\('JPATH_BASE'\)(.*?)\s*;/",
"/\\defined\('JPATH_BASE'\)(.*?)\s*;/",
];
$insert_pos = null;
// Iterate through the patterns and try to find a match
foreach ($patterns as $pattern)
{
preg_match($pattern, $code, $matches, PREG_OFFSET_CAPTURE);
$defined_line_pos = $matches[0][1] ?? null;
if ($defined_line_pos !== null)
{
// Find the position of the newline character after the defined() line
$next_lines_pos = strpos($code, PHP_EOL, (int) $defined_line_pos + strlen($matches[0][0]));
// Insert the new line at the found position
if ($next_lines_pos !== false)
{
$insert_pos = $next_lines_pos;
break;
}
}
}
// Insert the new line at the found position
if ($insert_pos !== null)
{
$code = substr_replace($code, PHP_EOL . $lines, $insert_pos, 0);
}
return $code;
}

View File

@ -0,0 +1,20 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "763d137c-42bc-4282-98d8-cc5c0654985f",
"guid": "a6052fe9-0d2b-4b36-b3e7-03b47c483542",
"implements": [
"e923311a-4058-4e81-9f67-5956fd0c627c"
],
"load_selection": null,
"name": "Injector",
"power_version": "1.0.0",
"system_name": "JCB.Compiler.JoomlaPower.Injector",
"type": "final class",
"use_selection": null,
"namespace": "VDM\\Joomla\\Componentbuilder.Compiler.JoomlaPower.Injector",
"description": "Compiler Joomla Power Injector\r\n@since 3.2.0",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
"head": "",
"composer": ""
}

View File

@ -0,0 +1,31 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# final class Load (Details)
> namespace: **VDM\Joomla\Componentbuilder\JoomlaPower\Database**
> extends: **Load**
```uml
@startuml
class Load << (F,LightGreen) >> #RoyalBlue {
# string $table
}
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,34 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\JoomlaPower\Database;
use VDM\Joomla\Componentbuilder\Power\Database\LoadInterface;
use VDM\Joomla\Componentbuilder\Power\Database\Load;
/**
* Power Database Load
*
* @since 2.0.1
*/
final class Load extends Load implements LoadInterface
{
/**
* Table Name
*
* @var string
* @since 3.2.1
*/
protected string $table = 'joomla_power';
}

View File

@ -0,0 +1,7 @@
/**
* Table Name
*
* @var string
* @since 3.2.1
*/
protected string $table = 'joomla_power';

View File

@ -0,0 +1,20 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "1f86db0f-e271-45df-8795-3e503ec76698",
"guid": "b4ea5de3-653f-43f9-b927-4ba6456b4d0a",
"implements": [
"99786f53-64b7-4d52-95b0-5306e7386c3f"
],
"load_selection": null,
"name": "Load",
"power_version": "1.0.0",
"system_name": "JCB.JoomlaPower.Database.Load",
"type": "final class",
"use_selection": null,
"namespace": "VDM\\Joomla\\Componentbuilder.JoomlaPower.Database.Load",
"description": "Power Database Load\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 <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
"head": "",
"composer": ""
}

View File

@ -6,12 +6,12 @@
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# final class Load (Details)
# class Load (Details)
> namespace: **VDM\Joomla\Componentbuilder\Power\Model**
> extends: **AbstractionModel**
```uml
@startuml
class Load << (F,LightGreen) >> #RoyalBlue {
class Load #Gold {
+ value(mixed $value, string $field, ...) : mixed
# validateBefore(mixed $value, ?string $field = null, ...) : bool
# validateAfter(mixed $value, ?string $field = null, ...) : bool

View File

@ -24,7 +24,7 @@ use VDM\Joomla\Interfaces\ModelInterface;
*
* @since 3.2.0
*/
final class Load extends AbstractionModel implements ModelInterface
class Load extends AbstractionModel implements ModelInterface
{
/**
* Model the value

View File

@ -10,7 +10,7 @@
"name": "Load",
"power_version": "1.0.0",
"system_name": "JCB.Power.Model.Load",
"type": "final class",
"type": "class",
"use_selection": {
"use_selection0": {
"use": "584747d1-3a86-453d-b7a3-a2219de8d777",

View File

@ -0,0 +1,61 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# interface ExtractorInterface (Details)
> namespace: **VDM\Joomla\Componentbuilder\Compiler\Interfaces\Power**
```uml
@startuml
interface ExtractorInterface #Lavender {
+ get_() : ?array
+ get(string $code) : ?array
+ reverse(string $code) : ?array
+ search(string $code) : void
}
note right of ExtractorInterface::get_
Get Super Powers from the code string
since: 3.2.0
return: ?array
end note
note right of ExtractorInterface::get
Get Super Powers from the code string
since: 3.2.0
return: ?array
end note
note right of ExtractorInterface::reverse
Get Super Powers from the code string
since: 3.2.0
return: ?array
end note
note right of ExtractorInterface::search
Get Super Powers from the code string and load it
since: 3.2.0
return: void
end note
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,61 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\Compiler\Interfaces\Power;
/**
* Compiler Power Extractor
* @since 3.2.1
*/
interface ExtractorInterface
{
/**
* Get Super Powers from the code string
*
* @param string $code The code
*
* @return array|null
* @since 3.2.0
*/
public function get_(): ?array;
/**
* Get Super Powers from the code string
*
* @param string $code The code
*
* @return array|null
* @since 3.2.0
*/
public function get(string $code): ?array;
/**
* Get Super Powers from the code string
*
* @param string $code The code
*
* @return array|null
* @since 3.2.0
*/
public function reverse(string $code): ?array;
/**
* Get Super Powers from the code string and load it
*
* @param string $code The code
*
* @return void
* @since 3.2.0
*/
public function search(string $code): void;
}

View File

@ -0,0 +1,39 @@
/**
* Get Super Powers from the code string
*
* @param string $code The code
*
* @return array|null
* @since 3.2.0
*/
public function get_(): ?array;
/**
* Get Super Powers from the code string
*
* @param string $code The code
*
* @return array|null
* @since 3.2.0
*/
public function get(string $code): ?array;
/**
* Get Super Powers from the code string
*
* @param string $code The code
*
* @return array|null
* @since 3.2.0
*/
public function reverse(string $code): ?array;
/**
* Get Super Powers from the code string and load it
*
* @param string $code The code
*
* @return void
* @since 3.2.0
*/
public function search(string $code): void;

View File

@ -0,0 +1,18 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "0",
"guid": "c159425c-51f9-4a15-af99-f2d0c6d7aae8",
"implements": null,
"load_selection": null,
"name": "ExtractorInterface",
"power_version": "1.0.0",
"system_name": "JCB.Compiler.Interfaces.Power.ExtractorInterface",
"type": "interface",
"use_selection": null,
"namespace": "VDM\\Joomla\\Componentbuilder.Compiler.Interfaces.Power.ExtractorInterface",
"description": "Compiler Power Extractor\r\n@since 3.2.1",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
"head": "",
"composer": ""
}

View File

@ -0,0 +1,45 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# interface GrepInterface (Details)
> namespace: **VDM\Joomla\Componentbuilder\Interfaces**
```uml
@startuml
interface GrepInterface #Lavender {
+ getRemotePowersGuid() : ?array
+ get(string $guid, array $order = ['local', 'remote']) : ?object
}
note right of GrepInterface::getRemotePowersGuid
Get all remote powers GUID's
since: 3.2.0
return: ?array
end note
note right of GrepInterface::get
Get a power
since: 3.2.0
return: ?object
end note
@enduml
```
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,41 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\Interfaces;
/**
* Global Resource Empowerment Platform
*
* @since 3.2.1
*/
interface GrepInterface
{
/**
* Get all remote powers GUID's
*
* @return array|null
* @since 3.2.0
*/
public function getRemotePowersGuid(): ?array;
/**
* Get a power
*
* @param string $guid The global unique id of the power
* @param array $order The search order
*
* @return object|null
* @since 3.2.0
*/
public function get(string $guid, array $order = ['local', 'remote']): ?object;
}

Some files were not shown because too many files have changed in this diff Show More