forked from joomla/super-powers
Compare commits
41 Commits
Author | SHA1 | Date | |
---|---|---|---|
3d7c68c014 | |||
dbfc061804 | |||
b87e1f91aa | |||
77f23fb8c2 | |||
44d1649eb0 | |||
e3096c796e | |||
98710c7fbd | |||
9eba4b338f | |||
ab9fb353ba | |||
1a74439a89 | |||
7effb3035a | |||
972f531ed3 | |||
7096370b60 | |||
7ce368db75 | |||
43edf4dee7 | |||
492bab1f36 | |||
8c8f4a0b58 | |||
25b4ae4215 | |||
a980aa9f81 | |||
d2d0222c5a | |||
bfba10e61e | |||
73dc7abc5d | |||
170c69669a | |||
1d2430e698 | |||
b4fe424113 | |||
d1e605dcd3 | |||
3efc0de510 | |||
c67a23df10 | |||
599c54d774 | |||
e78ebe5eeb | |||
216bd102ed | |||
eb51db9f03 | |||
65a2f83ed1 | |||
b0cdf9d36e | |||
92c4b2881e | |||
b894dfc8af | |||
26e410cc2d | |||
e5a248a773 | |||
ceb508698d | |||
a62938ca20 | |||
9ca083305b |
93
README.md
93
README.md
@ -26,10 +26,10 @@ This repository contains an index (see below) of all the approved powers within
|
|||||||
- **Namespace**: [VDM\Joomla\Abstraction](#vdm-joomla-abstraction)
|
- **Namespace**: [VDM\Joomla\Abstraction](#vdm-joomla-abstraction)
|
||||||
|
|
||||||
- **abstract class ActiveRegistry** | [Details](src/43134867-5cb8-4280-9be8-309fd2fd135f) | [Code](src/43134867-5cb8-4280-9be8-309fd2fd135f/code.php) | [Settings](src/43134867-5cb8-4280-9be8-309fd2fd135f/settings.json) | SPK: `Super---43134867_5cb8_4280_9be8_309fd2fd135f---Power`
|
- **abstract class ActiveRegistry** | [Details](src/43134867-5cb8-4280-9be8-309fd2fd135f) | [Code](src/43134867-5cb8-4280-9be8-309fd2fd135f/code.php) | [Settings](src/43134867-5cb8-4280-9be8-309fd2fd135f/settings.json) | SPK: `Super---43134867_5cb8_4280_9be8_309fd2fd135f---Power`
|
||||||
- **abstract class BaseConfig** | [Details](src/ffbd4e1f-a342-4080-ab7d-1de3741bf319) | [Code](src/ffbd4e1f-a342-4080-ab7d-1de3741bf319/code.php) | [Settings](src/ffbd4e1f-a342-4080-ab7d-1de3741bf319/settings.json) | SPK: `Super---ffbd4e1f_a342_4080_ab7d_1de3741bf319---Power`
|
|
||||||
- **abstract class BaseTable** | [Details](src/e0f6ddbe-2a35-4537-942c-faff2ebd04f6) | [Code](src/e0f6ddbe-2a35-4537-942c-faff2ebd04f6/code.php) | [Settings](src/e0f6ddbe-2a35-4537-942c-faff2ebd04f6/settings.json) | SPK: `Super---e0f6ddbe_2a35_4537_942c_faff2ebd04f6---Power`
|
- **abstract class BaseTable** | [Details](src/e0f6ddbe-2a35-4537-942c-faff2ebd04f6) | [Code](src/e0f6ddbe-2a35-4537-942c-faff2ebd04f6/code.php) | [Settings](src/e0f6ddbe-2a35-4537-942c-faff2ebd04f6/settings.json) | SPK: `Super---e0f6ddbe_2a35_4537_942c_faff2ebd04f6---Power`
|
||||||
- **abstract class Database** | [Details](src/6cbef8f8-4813-48e3-b05a-65e1aea95171) | [Code](src/6cbef8f8-4813-48e3-b05a-65e1aea95171/code.php) | [Settings](src/6cbef8f8-4813-48e3-b05a-65e1aea95171/settings.json) | SPK: `Super---6cbef8f8_4813_48e3_b05a_65e1aea95171---Power`
|
- **abstract class Database** | [Details](src/6cbef8f8-4813-48e3-b05a-65e1aea95171) | [Code](src/6cbef8f8-4813-48e3-b05a-65e1aea95171/code.php) | [Settings](src/6cbef8f8-4813-48e3-b05a-65e1aea95171/settings.json) | SPK: `Super---6cbef8f8_4813_48e3_b05a_65e1aea95171---Power`
|
||||||
- **abstract class Factory** | [Details](src/2e5bf608-de5c-4b00-a20d-47c26aa350d9) | [Code](src/2e5bf608-de5c-4b00-a20d-47c26aa350d9/code.php) | [Settings](src/2e5bf608-de5c-4b00-a20d-47c26aa350d9/settings.json) | SPK: `Super---2e5bf608_de5c_4b00_a20d_47c26aa350d9---Power`
|
- **abstract class Factory** | [Details](src/2e5bf608-de5c-4b00-a20d-47c26aa350d9) | [Code](src/2e5bf608-de5c-4b00-a20d-47c26aa350d9/code.php) | [Settings](src/2e5bf608-de5c-4b00-a20d-47c26aa350d9/settings.json) | SPK: `Super---2e5bf608_de5c_4b00_a20d_47c26aa350d9---Power`
|
||||||
|
- **abstract class FunctionRegistry** | [Details](src/ffbd4e1f-a342-4080-ab7d-1de3741bf319) | [Code](src/ffbd4e1f-a342-4080-ab7d-1de3741bf319/code.php) | [Settings](src/ffbd4e1f-a342-4080-ab7d-1de3741bf319/settings.json) | SPK: `Super---ffbd4e1f_a342_4080_ab7d_1de3741bf319---Power`
|
||||||
- **abstract class Grep** | [Details](src/1401a167-0ce4-4f4a-afee-2d8b02ed339b) | [Code](src/1401a167-0ce4-4f4a-afee-2d8b02ed339b/code.php) | [Settings](src/1401a167-0ce4-4f4a-afee-2d8b02ed339b/settings.json) | SPK: `Super---1401a167_0ce4_4f4a_afee_2d8b02ed339b---Power`
|
- **abstract class Grep** | [Details](src/1401a167-0ce4-4f4a-afee-2d8b02ed339b) | [Code](src/1401a167-0ce4-4f4a-afee-2d8b02ed339b/code.php) | [Settings](src/1401a167-0ce4-4f4a-afee-2d8b02ed339b/settings.json) | SPK: `Super---1401a167_0ce4_4f4a_afee_2d8b02ed339b---Power`
|
||||||
- **abstract class Model** | [Details](src/584747d1-3a86-453d-b7a3-a2219de8d777) | [Code](src/584747d1-3a86-453d-b7a3-a2219de8d777/code.php) | [Settings](src/584747d1-3a86-453d-b7a3-a2219de8d777/settings.json) | SPK: `Super---584747d1_3a86_453d_b7a3_a2219de8d777---Power`
|
- **abstract class Model** | [Details](src/584747d1-3a86-453d-b7a3-a2219de8d777) | [Code](src/584747d1-3a86-453d-b7a3-a2219de8d777/code.php) | [Settings](src/584747d1-3a86-453d-b7a3-a2219de8d777/settings.json) | SPK: `Super---584747d1_3a86_453d_b7a3_a2219de8d777---Power`
|
||||||
- **abstract class PHPConfigurationChecker** | [Details](src/900456a2-feb5-48b9-9f05-c5a032a32c59) | [Code](src/900456a2-feb5-48b9-9f05-c5a032a32c59/code.php) | [Settings](src/900456a2-feb5-48b9-9f05-c5a032a32c59/settings.json) | SPK: `Super---900456a2_feb5_48b9_9f05_c5a032a32c59---Power`
|
- **abstract class PHPConfigurationChecker** | [Details](src/900456a2-feb5-48b9-9f05-c5a032a32c59) | [Code](src/900456a2-feb5-48b9-9f05-c5a032a32c59/code.php) | [Settings](src/900456a2-feb5-48b9-9f05-c5a032a32c59/settings.json) | SPK: `Super---900456a2_feb5_48b9_9f05_c5a032a32c59---Power`
|
||||||
@ -47,6 +47,8 @@ This repository contains an index (see below) of all the approved powers within
|
|||||||
- **final class Items** | [Details](src/21bca8a4-5b28-41c4-843e-8097f0ba7cca) | [Code](src/21bca8a4-5b28-41c4-843e-8097f0ba7cca/code.php) | [Settings](src/21bca8a4-5b28-41c4-843e-8097f0ba7cca/settings.json) | SPK: `Super---21bca8a4_5b28_41c4_843e_8097f0ba7cca---Power`
|
- **final class Items** | [Details](src/21bca8a4-5b28-41c4-843e-8097f0ba7cca) | [Code](src/21bca8a4-5b28-41c4-843e-8097f0ba7cca/code.php) | [Settings](src/21bca8a4-5b28-41c4-843e-8097f0ba7cca/settings.json) | SPK: `Super---21bca8a4_5b28_41c4_843e_8097f0ba7cca---Power`
|
||||||
- **final class MultiSubform** | [Details](src/e0198c3f-777a-4a0b-87b7-e6a198afc8f9) | [Code](src/e0198c3f-777a-4a0b-87b7-e6a198afc8f9/code.php) | [Settings](src/e0198c3f-777a-4a0b-87b7-e6a198afc8f9/settings.json) | SPK: `Super---e0198c3f_777a_4a0b_87b7_e6a198afc8f9---Power`
|
- **final class MultiSubform** | [Details](src/e0198c3f-777a-4a0b-87b7-e6a198afc8f9) | [Code](src/e0198c3f-777a-4a0b-87b7-e6a198afc8f9/code.php) | [Settings](src/e0198c3f-777a-4a0b-87b7-e6a198afc8f9/settings.json) | SPK: `Super---e0198c3f_777a_4a0b_87b7_e6a198afc8f9---Power`
|
||||||
- **final class Subform** | [Details](src/85785701-07b2-4f81-bc1e-0f423700c254) | [Code](src/85785701-07b2-4f81-bc1e-0f423700c254/code.php) | [Settings](src/85785701-07b2-4f81-bc1e-0f423700c254/settings.json) | SPK: `Super---85785701_07b2_4f81_bc1e_0f423700c254---Power`
|
- **final class Subform** | [Details](src/85785701-07b2-4f81-bc1e-0f423700c254) | [Code](src/85785701-07b2-4f81-bc1e-0f423700c254/code.php) | [Settings](src/85785701-07b2-4f81-bc1e-0f423700c254/settings.json) | SPK: `Super---85785701_07b2_4f81_bc1e_0f423700c254---Power`
|
||||||
|
- **final class UsersSubform** | [Details](src/46b98346-ec98-42b3-a393-96c7d1282b1c) | [Code](src/46b98346-ec98-42b3-a393-96c7d1282b1c/code.php) | [Settings](src/46b98346-ec98-42b3-a393-96c7d1282b1c/settings.json) | SPK: `Super---46b98346_ec98_42b3_a393_96c7d1282b1c---Power`
|
||||||
|
- **trait Guid** | [Details](src/5acded67-0e3d-4c6b-a6ea-b533b076de0c) | [Code](src/5acded67-0e3d-4c6b-a6ea-b533b076de0c/code.php) | [Settings](src/5acded67-0e3d-4c6b-a6ea-b533b076de0c/settings.json) | SPK: `Super---5acded67_0e3d_4c6b_a6ea_b533b076de0c---Power`
|
||||||
- **Namespace**: [VDM\Joomla\Database](#vdm-joomla-database)
|
- **Namespace**: [VDM\Joomla\Database](#vdm-joomla-database)
|
||||||
|
|
||||||
- **final class Delete** | [Details](src/92291f1f-f248-4ec0-9f2a-3d47c49eeac1) | [Code](src/92291f1f-f248-4ec0-9f2a-3d47c49eeac1/code.php) | [Settings](src/92291f1f-f248-4ec0-9f2a-3d47c49eeac1/settings.json) | SPK: `Super---92291f1f_f248_4ec0_9f2a_3d47c49eeac1---Power`
|
- **final class Delete** | [Details](src/92291f1f-f248-4ec0-9f2a-3d47c49eeac1) | [Code](src/92291f1f-f248-4ec0-9f2a-3d47c49eeac1/code.php) | [Settings](src/92291f1f-f248-4ec0-9f2a-3d47c49eeac1/settings.json) | SPK: `Super---92291f1f_f248_4ec0_9f2a_3d47c49eeac1---Power`
|
||||||
@ -66,7 +68,8 @@ This repository contains an index (see below) of all the approved powers within
|
|||||||
- **interface Registryinterface** | [Details](src/64e291c2-11f1-423d-a44d-837cc12cc017) | [Code](src/64e291c2-11f1-423d-a44d-837cc12cc017/code.php) | [Settings](src/64e291c2-11f1-423d-a44d-837cc12cc017/settings.json) | SPK: `Super---64e291c2_11f1_423d_a44d_837cc12cc017---Power`
|
- **interface Registryinterface** | [Details](src/64e291c2-11f1-423d-a44d-837cc12cc017) | [Code](src/64e291c2-11f1-423d-a44d-837cc12cc017/code.php) | [Settings](src/64e291c2-11f1-423d-a44d-837cc12cc017/settings.json) | SPK: `Super---64e291c2_11f1_423d_a44d_837cc12cc017---Power`
|
||||||
- **interface SchemaCheckerInterface** | [Details](src/b6e9854c-3672-42ec-8843-26c24b4635bd) | [Code](src/b6e9854c-3672-42ec-8843-26c24b4635bd/code.php) | [Settings](src/b6e9854c-3672-42ec-8843-26c24b4635bd/settings.json) | SPK: `Super---b6e9854c_3672_42ec_8843_26c24b4635bd---Power`
|
- **interface SchemaCheckerInterface** | [Details](src/b6e9854c-3672-42ec-8843-26c24b4635bd) | [Code](src/b6e9854c-3672-42ec-8843-26c24b4635bd/code.php) | [Settings](src/b6e9854c-3672-42ec-8843-26c24b4635bd/settings.json) | SPK: `Super---b6e9854c_3672_42ec_8843_26c24b4635bd---Power`
|
||||||
- **interface SchemaInterface** | [Details](src/4dd11b9b-3c64-460b-aaa6-62ba467db7aa) | [Code](src/4dd11b9b-3c64-460b-aaa6-62ba467db7aa/code.php) | [Settings](src/4dd11b9b-3c64-460b-aaa6-62ba467db7aa/settings.json) | SPK: `Super---4dd11b9b_3c64_460b_aaa6_62ba467db7aa---Power`
|
- **interface SchemaInterface** | [Details](src/4dd11b9b-3c64-460b-aaa6-62ba467db7aa) | [Code](src/4dd11b9b-3c64-460b-aaa6-62ba467db7aa/code.php) | [Settings](src/4dd11b9b-3c64-460b-aaa6-62ba467db7aa/settings.json) | SPK: `Super---4dd11b9b_3c64_460b_aaa6_62ba467db7aa---Power`
|
||||||
- **interface Tableinterface** | [Details](src/2da6d6c4-eb29-4d69-8bc2-36d96e916adf) | [Code](src/2da6d6c4-eb29-4d69-8bc2-36d96e916adf/code.php) | [Settings](src/2da6d6c4-eb29-4d69-8bc2-36d96e916adf/settings.json) | SPK: `Super---2da6d6c4_eb29_4d69_8bc2_36d96e916adf---Power`
|
- **interface TableInterface** | [Details](src/2da6d6c4-eb29-4d69-8bc2-36d96e916adf) | [Code](src/2da6d6c4-eb29-4d69-8bc2-36d96e916adf/code.php) | [Settings](src/2da6d6c4-eb29-4d69-8bc2-36d96e916adf/settings.json) | SPK: `Super---2da6d6c4_eb29_4d69_8bc2_36d96e916adf---Power`
|
||||||
|
- **interface TableValidatorInterface** | [Details](src/feb3affa-5102-4307-93db-04525f4c66f0) | [Code](src/feb3affa-5102-4307-93db-04525f4c66f0/code.php) | [Settings](src/feb3affa-5102-4307-93db-04525f4c66f0/settings.json) | SPK: `Super---feb3affa_5102_4307_93db_04525f4c66f0---Power`
|
||||||
- **interface UpdateInterface** | [Details](src/7179fde6-1e51-4b51-8545-7ca18f74a0f4) | [Code](src/7179fde6-1e51-4b51-8545-7ca18f74a0f4/code.php) | [Settings](src/7179fde6-1e51-4b51-8545-7ca18f74a0f4/settings.json) | SPK: `Super---7179fde6_1e51_4b51_8545_7ca18f74a0f4---Power`
|
- **interface UpdateInterface** | [Details](src/7179fde6-1e51-4b51-8545-7ca18f74a0f4) | [Code](src/7179fde6-1e51-4b51-8545-7ca18f74a0f4/code.php) | [Settings](src/7179fde6-1e51-4b51-8545-7ca18f74a0f4/settings.json) | SPK: `Super---7179fde6_1e51_4b51_8545_7ca18f74a0f4---Power`
|
||||||
- **Namespace**: [VDM\Joomla\Model](#vdm-joomla-model)
|
- **Namespace**: [VDM\Joomla\Model](#vdm-joomla-model)
|
||||||
|
|
||||||
@ -83,6 +86,7 @@ This repository contains an index (see below) of all the approved powers within
|
|||||||
- **abstract class ArrayHelper** | [Details](src/0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a) | [Code](src/0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a/code.php) | [Settings](src/0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a/settings.json) | SPK: `Super---0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a---Power`
|
- **abstract class ArrayHelper** | [Details](src/0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a) | [Code](src/0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a/code.php) | [Settings](src/0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a/settings.json) | SPK: `Super---0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a---Power`
|
||||||
- **abstract class Base64Helper** | [Details](src/64a6ff6c-069c-4a11-a76b-db5e36c27690) | [Code](src/64a6ff6c-069c-4a11-a76b-db5e36c27690/code.php) | [Settings](src/64a6ff6c-069c-4a11-a76b-db5e36c27690/settings.json) | SPK: `Super---64a6ff6c_069c_4a11_a76b_db5e36c27690---Power`
|
- **abstract class Base64Helper** | [Details](src/64a6ff6c-069c-4a11-a76b-db5e36c27690) | [Code](src/64a6ff6c-069c-4a11-a76b-db5e36c27690/code.php) | [Settings](src/64a6ff6c-069c-4a11-a76b-db5e36c27690/settings.json) | SPK: `Super---64a6ff6c_069c_4a11_a76b_db5e36c27690---Power`
|
||||||
- **abstract class ClassHelper** | [Details](src/13c2cac1-a70d-42d7-99fc-eb7ac3443069) | [Code](src/13c2cac1-a70d-42d7-99fc-eb7ac3443069/code.php) | [Settings](src/13c2cac1-a70d-42d7-99fc-eb7ac3443069/settings.json) | SPK: `Super---13c2cac1_a70d_42d7_99fc_eb7ac3443069---Power`
|
- **abstract class ClassHelper** | [Details](src/13c2cac1-a70d-42d7-99fc-eb7ac3443069) | [Code](src/13c2cac1-a70d-42d7-99fc-eb7ac3443069/code.php) | [Settings](src/13c2cac1-a70d-42d7-99fc-eb7ac3443069/settings.json) | SPK: `Super---13c2cac1_a70d_42d7_99fc_eb7ac3443069---Power`
|
||||||
|
- **abstract class DateHelper** | [Details](src/993fe913-8e36-4800-a5f7-544aa728ee48) | [Code](src/993fe913-8e36-4800-a5f7-544aa728ee48/code.php) | [Settings](src/993fe913-8e36-4800-a5f7-544aa728ee48/settings.json) | SPK: `Super---993fe913_8e36_4800_a5f7_544aa728ee48---Power`
|
||||||
- **abstract class FileHelper** | [Details](src/a223b31e-ea1d-4cdf-92ae-5f9becffaff0) | [Code](src/a223b31e-ea1d-4cdf-92ae-5f9becffaff0/code.php) | [Settings](src/a223b31e-ea1d-4cdf-92ae-5f9becffaff0/settings.json) | SPK: `Super---a223b31e_ea1d_4cdf_92ae_5f9becffaff0---Power`
|
- **abstract class FileHelper** | [Details](src/a223b31e-ea1d-4cdf-92ae-5f9becffaff0) | [Code](src/a223b31e-ea1d-4cdf-92ae-5f9becffaff0/code.php) | [Settings](src/a223b31e-ea1d-4cdf-92ae-5f9becffaff0/settings.json) | SPK: `Super---a223b31e_ea1d_4cdf_92ae_5f9becffaff0---Power`
|
||||||
- **abstract class FormHelper** | [Details](src/1198aecf-84c6-45d2-aea8-d531aa4afdfa) | [Code](src/1198aecf-84c6-45d2-aea8-d531aa4afdfa/code.php) | [Settings](src/1198aecf-84c6-45d2-aea8-d531aa4afdfa/settings.json) | SPK: `Super---1198aecf_84c6_45d2_aea8_d531aa4afdfa---Power`
|
- **abstract class FormHelper** | [Details](src/1198aecf-84c6-45d2-aea8-d531aa4afdfa) | [Code](src/1198aecf-84c6-45d2-aea8-d531aa4afdfa/code.php) | [Settings](src/1198aecf-84c6-45d2-aea8-d531aa4afdfa/settings.json) | SPK: `Super---1198aecf_84c6_45d2_aea8_d531aa4afdfa---Power`
|
||||||
- **abstract class GetHelper** | [Details](src/db87c339-5bb6-4291-a7ef-2c48ea1b06bc) | [Code](src/db87c339-5bb6-4291-a7ef-2c48ea1b06bc/code.php) | [Settings](src/db87c339-5bb6-4291-a7ef-2c48ea1b06bc/settings.json) | SPK: `Super---db87c339_5bb6_4291_a7ef_2c48ea1b06bc---Power`
|
- **abstract class GetHelper** | [Details](src/db87c339-5bb6-4291-a7ef-2c48ea1b06bc) | [Code](src/db87c339-5bb6-4291-a7ef-2c48ea1b06bc/code.php) | [Settings](src/db87c339-5bb6-4291-a7ef-2c48ea1b06bc/settings.json) | SPK: `Super---db87c339_5bb6_4291_a7ef_2c48ea1b06bc---Power`
|
||||||
@ -90,8 +94,14 @@ This repository contains an index (see below) of all the approved powers within
|
|||||||
- **abstract class GuidHelper** | [Details](src/9c513baf-b279-43fd-ae29-a585c8cbc4f0) | [Code](src/9c513baf-b279-43fd-ae29-a585c8cbc4f0/code.php) | [Settings](src/9c513baf-b279-43fd-ae29-a585c8cbc4f0/settings.json) | SPK: `Super---9c513baf_b279_43fd_ae29_a585c8cbc4f0---Power`
|
- **abstract class GuidHelper** | [Details](src/9c513baf-b279-43fd-ae29-a585c8cbc4f0) | [Code](src/9c513baf-b279-43fd-ae29-a585c8cbc4f0/code.php) | [Settings](src/9c513baf-b279-43fd-ae29-a585c8cbc4f0/settings.json) | SPK: `Super---9c513baf_b279_43fd_ae29_a585c8cbc4f0---Power`
|
||||||
- **abstract class JsonHelper** | [Details](src/4b225c51-d293-48e4-b3f6-5136cf5c3f18) | [Code](src/4b225c51-d293-48e4-b3f6-5136cf5c3f18/code.php) | [Settings](src/4b225c51-d293-48e4-b3f6-5136cf5c3f18/settings.json) | SPK: `Super---4b225c51_d293_48e4_b3f6_5136cf5c3f18---Power`
|
- **abstract class JsonHelper** | [Details](src/4b225c51-d293-48e4-b3f6-5136cf5c3f18) | [Code](src/4b225c51-d293-48e4-b3f6-5136cf5c3f18/code.php) | [Settings](src/4b225c51-d293-48e4-b3f6-5136cf5c3f18/settings.json) | SPK: `Super---4b225c51_d293_48e4_b3f6_5136cf5c3f18---Power`
|
||||||
- **abstract class MathHelper** | [Details](src/152c8793-8b75-4715-996a-257b9f65451c) | [Code](src/152c8793-8b75-4715-996a-257b9f65451c/code.php) | [Settings](src/152c8793-8b75-4715-996a-257b9f65451c/settings.json) | SPK: `Super---152c8793_8b75_4715_996a_257b9f65451c---Power`
|
- **abstract class MathHelper** | [Details](src/152c8793-8b75-4715-996a-257b9f65451c) | [Code](src/152c8793-8b75-4715-996a-257b9f65451c/code.php) | [Settings](src/152c8793-8b75-4715-996a-257b9f65451c/settings.json) | SPK: `Super---152c8793_8b75_4715_996a_257b9f65451c---Power`
|
||||||
|
- **abstract class MimeHelper** | [Details](src/f11dc790-713e-4706-9a85-a318ed3ad56e) | [Code](src/f11dc790-713e-4706-9a85-a318ed3ad56e/code.php) | [Settings](src/f11dc790-713e-4706-9a85-a318ed3ad56e/settings.json) | SPK: `Super---f11dc790_713e_4706_9a85_a318ed3ad56e---Power`
|
||||||
- **abstract class ObjectHelper** | [Details](src/91004529-94a9-4590-b842-e7c6b624ecf5) | [Code](src/91004529-94a9-4590-b842-e7c6b624ecf5/code.php) | [Settings](src/91004529-94a9-4590-b842-e7c6b624ecf5/settings.json) | SPK: `Super---91004529_94a9_4590_b842_e7c6b624ecf5---Power`
|
- **abstract class ObjectHelper** | [Details](src/91004529-94a9-4590-b842-e7c6b624ecf5) | [Code](src/91004529-94a9-4590-b842-e7c6b624ecf5/code.php) | [Settings](src/91004529-94a9-4590-b842-e7c6b624ecf5/settings.json) | SPK: `Super---91004529_94a9_4590_b842_e7c6b624ecf5---Power`
|
||||||
|
- **abstract class SessionHelper** | [Details](src/47a63728-cd5d-4d53-99cf-2409bd1c744c) | [Code](src/47a63728-cd5d-4d53-99cf-2409bd1c744c/code.php) | [Settings](src/47a63728-cd5d-4d53-99cf-2409bd1c744c/settings.json) | SPK: `Super---47a63728_cd5d_4d53_99cf_2409bd1c744c---Power`
|
||||||
- **abstract class StringHelper** | [Details](src/1f28cb53-60d9-4db1-b517-3c7dc6b429ef) | [Code](src/1f28cb53-60d9-4db1-b517-3c7dc6b429ef/code.php) | [Settings](src/1f28cb53-60d9-4db1-b517-3c7dc6b429ef/settings.json) | SPK: `Super---1f28cb53_60d9_4db1_b517_3c7dc6b429ef---Power`
|
- **abstract class StringHelper** | [Details](src/1f28cb53-60d9-4db1-b517-3c7dc6b429ef) | [Code](src/1f28cb53-60d9-4db1-b517-3c7dc6b429ef/code.php) | [Settings](src/1f28cb53-60d9-4db1-b517-3c7dc6b429ef/settings.json) | SPK: `Super---1f28cb53_60d9_4db1_b517_3c7dc6b429ef---Power`
|
||||||
|
- **abstract class UploadHelper** | [Details](src/d7600b43-771a-4747-9f5d-952765721799) | [Code](src/d7600b43-771a-4747-9f5d-952765721799/code.php) | [Settings](src/d7600b43-771a-4747-9f5d-952765721799/settings.json) | SPK: `Super---d7600b43_771a_4747_9f5d_952765721799---Power`
|
||||||
|
- **Namespace**: [VDM\Joomla\Abstraction\Console](#vdm-joomla-abstraction-console)
|
||||||
|
|
||||||
|
- **abstract class Import** | [Details](src/85321deb-5c3a-401b-9ce1-039a746add51) | [Code](src/85321deb-5c3a-401b-9ce1-039a746add51/code.php) | [Settings](src/85321deb-5c3a-401b-9ce1-039a746add51/settings.json) | SPK: `Super---85321deb_5c3a_401b_9ce1_039a746add51---Power`
|
||||||
- **Namespace**: [VDM\Joomla\Abstraction\Remote](#vdm-joomla-abstraction-remote)
|
- **Namespace**: [VDM\Joomla\Abstraction\Remote](#vdm-joomla-abstraction-remote)
|
||||||
|
|
||||||
- **abstract class Get** | [Details](src/728ee726-3f0f-4762-899d-f8c9430cee58) | [Code](src/728ee726-3f0f-4762-899d-f8c9430cee58/code.php) | [Settings](src/728ee726-3f0f-4762-899d-f8c9430cee58/settings.json) | SPK: `Super---728ee726_3f0f_4762_899d_f8c9430cee58---Power`
|
- **abstract class Get** | [Details](src/728ee726-3f0f-4762-899d-f8c9430cee58) | [Code](src/728ee726-3f0f-4762-899d-f8c9430cee58/code.php) | [Settings](src/728ee726-3f0f-4762-899d-f8c9430cee58/settings.json) | SPK: `Super---728ee726_3f0f_4762_899d_f8c9430cee58---Power`
|
||||||
@ -99,19 +109,70 @@ This repository contains an index (see below) of all the approved powers within
|
|||||||
- **Namespace**: [VDM\Joomla\Componentbuilder\Abstraction](#vdm-joomla-componentbuilder-abstraction)
|
- **Namespace**: [VDM\Joomla\Componentbuilder\Abstraction](#vdm-joomla-componentbuilder-abstraction)
|
||||||
|
|
||||||
- **abstract class BaseRegistry** | [Details](src/b84e947d-2a13-44f7-ac0f-3902ae55ae0c) | [Code](src/b84e947d-2a13-44f7-ac0f-3902ae55ae0c/code.php) | [Settings](src/b84e947d-2a13-44f7-ac0f-3902ae55ae0c/settings.json) | SPK: `Super---b84e947d_2a13_44f7_ac0f_3902ae55ae0c---Power`
|
- **abstract class BaseRegistry** | [Details](src/b84e947d-2a13-44f7-ac0f-3902ae55ae0c) | [Code](src/b84e947d-2a13-44f7-ac0f-3902ae55ae0c/code.php) | [Settings](src/b84e947d-2a13-44f7-ac0f-3902ae55ae0c/settings.json) | SPK: `Super---b84e947d_2a13_44f7_ac0f_3902ae55ae0c---Power`
|
||||||
|
- **abstract class ComponentConfig** | [Details](src/9769f3b2-17bf-4f20-b54b-3a4ebe572b36) | [Code](src/9769f3b2-17bf-4f20-b54b-3a4ebe572b36/code.php) | [Settings](src/9769f3b2-17bf-4f20-b54b-3a4ebe572b36/settings.json) | SPK: `Super---9769f3b2_17bf_4f20_b54b_3a4ebe572b36---Power`
|
||||||
|
- **Namespace**: [VDM\Joomla\Componentbuilder\Console](#vdm-joomla-componentbuilder-console)
|
||||||
|
|
||||||
|
- **class ItemImport** | [Details](src/647316a5-eb42-4bec-82dd-ca0dc2861ad3) | [Code](src/647316a5-eb42-4bec-82dd-ca0dc2861ad3/code.php) | [Settings](src/647316a5-eb42-4bec-82dd-ca0dc2861ad3/settings.json) | SPK: `Super---647316a5_eb42_4bec_82dd_ca0dc2861ad3---Power`
|
||||||
|
- **Namespace**: [VDM\Joomla\Componentbuilder\File](#vdm-joomla-componentbuilder-file)
|
||||||
|
|
||||||
|
- **abstract class Factory** | [Details](src/884eca78-281f-4eab-b962-d97e355af16d) | [Code](src/884eca78-281f-4eab-b962-d97e355af16d/code.php) | [Settings](src/884eca78-281f-4eab-b962-d97e355af16d/settings.json) | SPK: `Super---884eca78_281f_4eab_b962_d97e355af16d---Power`
|
||||||
|
- **final class Display** | [Details](src/d46c4667-378b-49e8-9782-ffb28d92415a) | [Code](src/d46c4667-378b-49e8-9782-ffb28d92415a/code.php) | [Settings](src/d46c4667-378b-49e8-9782-ffb28d92415a/settings.json) | SPK: `Super---d46c4667_378b_49e8_9782_ffb28d92415a---Power`
|
||||||
|
- **final class Handler** | [Details](src/4144ad3b-2ad5-401f-af0c-a3d856c1e688) | [Code](src/4144ad3b-2ad5-401f-af0c-a3d856c1e688/code.php) | [Settings](src/4144ad3b-2ad5-401f-af0c-a3d856c1e688/settings.json) | SPK: `Super---4144ad3b_2ad5_401f_af0c_a3d856c1e688---Power`
|
||||||
|
- **final class Manager** | [Details](src/67a5e0ca-0ff0-4979-9b41-da0b09988016) | [Code](src/67a5e0ca-0ff0-4979-9b41-da0b09988016/code.php) | [Settings](src/67a5e0ca-0ff0-4979-9b41-da0b09988016/settings.json) | SPK: `Super---67a5e0ca_0ff0_4979_9b41_da0b09988016---Power`
|
||||||
|
- **final class Type** | [Details](src/12a2a8de-a893-4dbb-a53d-b52de4f6cb0e) | [Code](src/12a2a8de-a893-4dbb-a53d-b52de4f6cb0e/code.php) | [Settings](src/12a2a8de-a893-4dbb-a53d-b52de4f6cb0e/settings.json) | SPK: `Super---12a2a8de_a893_4dbb_a53d_b52de4f6cb0e---Power`
|
||||||
|
- **Namespace**: [VDM\Joomla\Componentbuilder\Import](#vdm-joomla-componentbuilder-import)
|
||||||
|
|
||||||
|
- **abstract class Factory** | [Details](src/ff8d5fdb-2d1f-4178-bd18-a43b8efd1068) | [Code](src/ff8d5fdb-2d1f-4178-bd18-a43b8efd1068/code.php) | [Settings](src/ff8d5fdb-2d1f-4178-bd18-a43b8efd1068/settings.json) | SPK: `Super---ff8d5fdb_2d1f_4178_bd18_a43b8efd1068---Power`
|
||||||
|
- **final class Assessor** | [Details](src/19a66b48-620c-439b-ab8a-3c0d43e040c3) | [Code](src/19a66b48-620c-439b-ab8a-3c0d43e040c3/code.php) | [Settings](src/19a66b48-620c-439b-ab8a-3c0d43e040c3/settings.json) | SPK: `Super---19a66b48_620c_439b_ab8a_3c0d43e040c3---Power`
|
||||||
|
- **final class Item** | [Details](src/68a0f9af-265a-4db1-bae9-a4e4531f94d7) | [Code](src/68a0f9af-265a-4db1-bae9-a4e4531f94d7/code.php) | [Settings](src/68a0f9af-265a-4db1-bae9-a4e4531f94d7/settings.json) | SPK: `Super---68a0f9af_265a_4db1_bae9_a4e4531f94d7---Power`
|
||||||
|
- **final class Mapper** | [Details](src/90b48ea8-0930-48d1-869a-bce9c901589c) | [Code](src/90b48ea8-0930-48d1-869a-bce9c901589c/code.php) | [Settings](src/90b48ea8-0930-48d1-869a-bce9c901589c/settings.json) | SPK: `Super---90b48ea8_0930_48d1_869a_bce9c901589c---Power`
|
||||||
|
- **final class Message** | [Details](src/eef6ffc2-2af0-4336-958f-e0b9cf7c4ad0) | [Code](src/eef6ffc2-2af0-4336-958f-e0b9cf7c4ad0/code.php) | [Settings](src/eef6ffc2-2af0-4336-958f-e0b9cf7c4ad0/settings.json) | SPK: `Super---eef6ffc2_2af0_4336_958f_e0b9cf7c4ad0---Power`
|
||||||
|
- **final class Row** | [Details](src/afb5b891-7130-422a-b389-1934b0e4fc48) | [Code](src/afb5b891-7130-422a-b389-1934b0e4fc48/code.php) | [Settings](src/afb5b891-7130-422a-b389-1934b0e4fc48/settings.json) | SPK: `Super---afb5b891_7130_422a_b389_1934b0e4fc48---Power`
|
||||||
|
- **final class Status** | [Details](src/d2a859ac-3f2a-4f69-a77f-f118b2e0a459) | [Code](src/d2a859ac-3f2a-4f69-a77f-f118b2e0a459/code.php) | [Settings](src/d2a859ac-3f2a-4f69-a77f-f118b2e0a459/settings.json) | SPK: `Super---d2a859ac_3f2a_4f69_a77f_f118b2e0a459---Power`
|
||||||
|
- **class Data** | [Details](src/05f23281-58e3-482e-be42-2dc1355ef4ea) | [Code](src/05f23281-58e3-482e-be42-2dc1355ef4ea/code.php) | [Settings](src/05f23281-58e3-482e-be42-2dc1355ef4ea/settings.json) | SPK: `Super---05f23281_58e3_482e_be42_2dc1355ef4ea---Power`
|
||||||
|
- **Namespace**: [VDM\Joomla\Componentbuilder\Interfaces](#vdm-joomla-componentbuilder-interfaces)
|
||||||
|
|
||||||
|
- **interface ImportAssessorInterface** | [Details](src/57c00d53-5581-4fd1-b3ea-080422710243) | [Code](src/57c00d53-5581-4fd1-b3ea-080422710243/code.php) | [Settings](src/57c00d53-5581-4fd1-b3ea-080422710243/settings.json) | SPK: `Super---57c00d53_5581_4fd1_b3ea_080422710243---Power`
|
||||||
|
- **interface ImportItemInterface** | [Details](src/53f55e5b-63cb-49e7-b1e6-33e7a9f97856) | [Code](src/53f55e5b-63cb-49e7-b1e6-33e7a9f97856/code.php) | [Settings](src/53f55e5b-63cb-49e7-b1e6-33e7a9f97856/settings.json) | SPK: `Super---53f55e5b_63cb_49e7_b1e6_33e7a9f97856---Power`
|
||||||
|
- **interface ImportMapperInterface** | [Details](src/250a7272-9ae1-4c63-a058-26bad9ad6f70) | [Code](src/250a7272-9ae1-4c63-a058-26bad9ad6f70/code.php) | [Settings](src/250a7272-9ae1-4c63-a058-26bad9ad6f70/settings.json) | SPK: `Super---250a7272_9ae1_4c63_a058_26bad9ad6f70---Power`
|
||||||
|
- **interface ImportMessageInterface** | [Details](src/23ad6e72-1b82-40fb-836c-50da690bb174) | [Code](src/23ad6e72-1b82-40fb-836c-50da690bb174/code.php) | [Settings](src/23ad6e72-1b82-40fb-836c-50da690bb174/settings.json) | SPK: `Super---23ad6e72_1b82_40fb_836c_50da690bb174---Power`
|
||||||
|
- **interface ImportRowInterface** | [Details](src/3d3ec064-9867-41e6-a48a-964c15d753aa) | [Code](src/3d3ec064-9867-41e6-a48a-964c15d753aa/code.php) | [Settings](src/3d3ec064-9867-41e6-a48a-964c15d753aa/settings.json) | SPK: `Super---3d3ec064_9867_41e6_a48a_964c15d753aa---Power`
|
||||||
|
- **interface ImportStatusInterface** | [Details](src/0e44d149-4863-47ec-8f0f-6a821ab3e77f) | [Code](src/0e44d149-4863-47ec-8f0f-6a821ab3e77f/code.php) | [Settings](src/0e44d149-4863-47ec-8f0f-6a821ab3e77f/settings.json) | SPK: `Super---0e44d149_4863_47ec_8f0f_6a821ab3e77f---Power`
|
||||||
|
- **Namespace**: [VDM\Joomla\Componentbuilder\Item](#vdm-joomla-componentbuilder-item)
|
||||||
|
|
||||||
|
- **final class Import** | [Details](src/2f14ec19-1b67-44be-8306-2a9e74588464) | [Code](src/2f14ec19-1b67-44be-8306-2a9e74588464/code.php) | [Settings](src/2f14ec19-1b67-44be-8306-2a9e74588464/settings.json) | SPK: `Super---2f14ec19_1b67_44be_8306_2a9e74588464---Power`
|
||||||
|
- **Namespace**: [VDM\Joomla\Componentbuilder\Service](#vdm-joomla-componentbuilder-service)
|
||||||
|
|
||||||
|
- **class Spreadsheet** | [Details](src/c4a188de-ad78-4a6d-9d5b-01866846d701) | [Code](src/c4a188de-ad78-4a6d-9d5b-01866846d701/code.php) | [Settings](src/c4a188de-ad78-4a6d-9d5b-01866846d701/settings.json) | SPK: `Super---c4a188de_ad78_4a6d_9d5b_01866846d701---Power`
|
||||||
|
- **Namespace**: [VDM\Joomla\Componentbuilder\Spreadsheet](#vdm-joomla-componentbuilder-spreadsheet)
|
||||||
|
|
||||||
|
- **final class ChunkReadFilter** | [Details](src/9ae018a5-9064-40ed-ad69-9c1ed2a459f5) | [Code](src/9ae018a5-9064-40ed-ad69-9c1ed2a459f5/code.php) | [Settings](src/9ae018a5-9064-40ed-ad69-9c1ed2a459f5/settings.json) | SPK: `Super---9ae018a5_9064_40ed_ad69_9c1ed2a459f5---Power`
|
||||||
|
- **final class Exporter** | [Details](src/e250638e-4a50-41f9-9172-db3e7f174d26) | [Code](src/e250638e-4a50-41f9-9172-db3e7f174d26/code.php) | [Settings](src/e250638e-4a50-41f9-9172-db3e7f174d26/settings.json) | SPK: `Super---e250638e_4a50_41f9_9172_db3e7f174d26---Power`
|
||||||
|
- **final class FileReader** | [Details](src/dcb0e061-f337-44f7-87f2-f5c5fb9ce917) | [Code](src/dcb0e061-f337-44f7-87f2-f5c5fb9ce917/code.php) | [Settings](src/dcb0e061-f337-44f7-87f2-f5c5fb9ce917/settings.json) | SPK: `Super---dcb0e061_f337_44f7_87f2_f5c5fb9ce917---Power`
|
||||||
|
- **final class Header** | [Details](src/fd3f322a-082d-4579-93ad-3352c5adfc71) | [Code](src/fd3f322a-082d-4579-93ad-3352c5adfc71/code.php) | [Settings](src/fd3f322a-082d-4579-93ad-3352c5adfc71/settings.json) | SPK: `Super---fd3f322a_082d_4579_93ad_3352c5adfc71---Power`
|
||||||
|
- **final class Importer** | [Details](src/c4169332-3914-400e-b861-972b2d465963) | [Code](src/c4169332-3914-400e-b861-972b2d465963/code.php) | [Settings](src/c4169332-3914-400e-b861-972b2d465963/settings.json) | SPK: `Super---c4169332_3914_400e_b861_972b2d465963---Power`
|
||||||
|
- **final class RowDataArray** | [Details](src/36063502-2115-4c8d-b16a-0c76cc8c1ada) | [Code](src/36063502-2115-4c8d-b16a-0c76cc8c1ada/code.php) | [Settings](src/36063502-2115-4c8d-b16a-0c76cc8c1ada/settings.json) | SPK: `Super---36063502_2115_4c8d_b16a_0c76cc8c1ada---Power`
|
||||||
- **Namespace**: [VDM\Joomla\Componentbuilder\Table](#vdm-joomla-componentbuilder-table)
|
- **Namespace**: [VDM\Joomla\Componentbuilder\Table](#vdm-joomla-componentbuilder-table)
|
||||||
|
|
||||||
- **final class Schema** | [Details](src/b3d2ec33-76d4-4c3b-bb2c-86ac14a221ce) | [Code](src/b3d2ec33-76d4-4c3b-bb2c-86ac14a221ce/code.php) | [Settings](src/b3d2ec33-76d4-4c3b-bb2c-86ac14a221ce/settings.json) | SPK: `Super---b3d2ec33_76d4_4c3b_bb2c_86ac14a221ce---Power`
|
- **final class Schema** | [Details](src/b3d2ec33-76d4-4c3b-bb2c-86ac14a221ce) | [Code](src/b3d2ec33-76d4-4c3b-bb2c-86ac14a221ce/code.php) | [Settings](src/b3d2ec33-76d4-4c3b-bb2c-86ac14a221ce/settings.json) | SPK: `Super---b3d2ec33_76d4_4c3b_bb2c_86ac14a221ce---Power`
|
||||||
- **final class SchemaChecker** | [Details](src/709d7294-9a43-46e2-b64e-d16a16f0eab1) | [Code](src/709d7294-9a43-46e2-b64e-d16a16f0eab1/code.php) | [Settings](src/709d7294-9a43-46e2-b64e-d16a16f0eab1/settings.json) | SPK: `Super---709d7294_9a43_46e2_b64e_d16a16f0eab1---Power`
|
- **final class SchemaChecker** | [Details](src/709d7294-9a43-46e2-b64e-d16a16f0eab1) | [Code](src/709d7294-9a43-46e2-b64e-d16a16f0eab1/code.php) | [Settings](src/709d7294-9a43-46e2-b64e-d16a16f0eab1/settings.json) | SPK: `Super---709d7294_9a43_46e2_b64e_d16a16f0eab1---Power`
|
||||||
|
- **final class Validator** | [Details](src/79fd4f39-824d-4ab6-936d-959705ff24ec) | [Code](src/79fd4f39-824d-4ab6-936d-959705ff24ec/code.php) | [Settings](src/79fd4f39-824d-4ab6-936d-959705ff24ec/settings.json) | SPK: `Super---79fd4f39_824d_4ab6_936d_959705ff24ec---Power`
|
||||||
|
- **Namespace**: [VDM\Joomla\Componentbuilder\Utilities](#vdm-joomla-componentbuilder-utilities)
|
||||||
|
|
||||||
|
- **abstract class UserHelper** | [Details](src/7832a726-87b6-4e95-887e-7b725d3fab8f) | [Code](src/7832a726-87b6-4e95-887e-7b725d3fab8f/code.php) | [Settings](src/7832a726-87b6-4e95-887e-7b725d3fab8f/settings.json) | SPK: `Super---7832a726_87b6_4e95_887e_7b725d3fab8f---Power`
|
||||||
- **Namespace**: [VDM\Joomla\Data\Action](#vdm-joomla-data-action)
|
- **Namespace**: [VDM\Joomla\Data\Action](#vdm-joomla-data-action)
|
||||||
|
|
||||||
- **class Delete** | [Details](src/3fc72954-a303-4cac-b53c-554be38b85e7) | [Code](src/3fc72954-a303-4cac-b53c-554be38b85e7/code.php) | [Settings](src/3fc72954-a303-4cac-b53c-554be38b85e7/settings.json) | SPK: `Super---3fc72954_a303_4cac_b53c_554be38b85e7---Power`
|
- **class Delete** | [Details](src/3fc72954-a303-4cac-b53c-554be38b85e7) | [Code](src/3fc72954-a303-4cac-b53c-554be38b85e7/code.php) | [Settings](src/3fc72954-a303-4cac-b53c-554be38b85e7/settings.json) | SPK: `Super---3fc72954_a303_4cac_b53c_554be38b85e7---Power`
|
||||||
- **class Insert** | [Details](src/a455d916-cfe4-41df-9245-bafb709aacdb) | [Code](src/a455d916-cfe4-41df-9245-bafb709aacdb/code.php) | [Settings](src/a455d916-cfe4-41df-9245-bafb709aacdb/settings.json) | SPK: `Super---a455d916_cfe4_41df_9245_bafb709aacdb---Power`
|
- **class Insert** | [Details](src/a455d916-cfe4-41df-9245-bafb709aacdb) | [Code](src/a455d916-cfe4-41df-9245-bafb709aacdb/code.php) | [Settings](src/a455d916-cfe4-41df-9245-bafb709aacdb/settings.json) | SPK: `Super---a455d916_cfe4_41df_9245_bafb709aacdb---Power`
|
||||||
- **class Load** | [Details](src/008d111c-9d43-427c-8dd4-2653e8b74be8) | [Code](src/008d111c-9d43-427c-8dd4-2653e8b74be8/code.php) | [Settings](src/008d111c-9d43-427c-8dd4-2653e8b74be8/settings.json) | SPK: `Super---008d111c_9d43_427c_8dd4_2653e8b74be8---Power`
|
- **class Load** | [Details](src/008d111c-9d43-427c-8dd4-2653e8b74be8) | [Code](src/008d111c-9d43-427c-8dd4-2653e8b74be8/code.php) | [Settings](src/008d111c-9d43-427c-8dd4-2653e8b74be8/settings.json) | SPK: `Super---008d111c_9d43_427c_8dd4_2653e8b74be8---Power`
|
||||||
- **class Update** | [Details](src/8f83fb79-f92b-4f1f-952b-325f6c22d11e) | [Code](src/8f83fb79-f92b-4f1f-952b-325f6c22d11e/code.php) | [Settings](src/8f83fb79-f92b-4f1f-952b-325f6c22d11e/settings.json) | SPK: `Super---8f83fb79_f92b_4f1f_952b_325f6c22d11e---Power`
|
- **class Update** | [Details](src/8f83fb79-f92b-4f1f-952b-325f6c22d11e) | [Code](src/8f83fb79-f92b-4f1f-952b-325f6c22d11e/code.php) | [Settings](src/8f83fb79-f92b-4f1f-952b-325f6c22d11e/settings.json) | SPK: `Super---8f83fb79_f92b_4f1f_952b_325f6c22d11e---Power`
|
||||||
|
- **Namespace**: [VDM\Joomla\Data\Migrator](#vdm-joomla-data-migrator)
|
||||||
|
|
||||||
|
- **final class Guid** | [Details](src/0b746305-d34e-4c21-bc20-898c4aeac376) | [Code](src/0b746305-d34e-4c21-bc20-898c4aeac376/code.php) | [Settings](src/0b746305-d34e-4c21-bc20-898c4aeac376/settings.json) | SPK: `Super---0b746305_d34e_4c21_bc20_898c4aeac376---Power`
|
||||||
- **Namespace**: [VDM\Joomla\Interfaces\Data](#vdm-joomla-interfaces-data)
|
- **Namespace**: [VDM\Joomla\Interfaces\Data](#vdm-joomla-interfaces-data)
|
||||||
|
|
||||||
- **interface DeleteInterface** | [Details](src/d8f9ba53-c490-4e8b-8e9f-6757224e069c) | [Code](src/d8f9ba53-c490-4e8b-8e9f-6757224e069c/code.php) | [Settings](src/d8f9ba53-c490-4e8b-8e9f-6757224e069c/settings.json) | SPK: `Super---d8f9ba53_c490_4e8b_8e9f_6757224e069c---Power`
|
- **interface DeleteInterface** | [Details](src/d8f9ba53-c490-4e8b-8e9f-6757224e069c) | [Code](src/d8f9ba53-c490-4e8b-8e9f-6757224e069c/code.php) | [Settings](src/d8f9ba53-c490-4e8b-8e9f-6757224e069c/settings.json) | SPK: `Super---d8f9ba53_c490_4e8b_8e9f_6757224e069c---Power`
|
||||||
|
- **interface GuidInterface** | [Details](src/576685fd-263c-46bb-9fdc-1f5eb234cbb6) | [Code](src/576685fd-263c-46bb-9fdc-1f5eb234cbb6/code.php) | [Settings](src/576685fd-263c-46bb-9fdc-1f5eb234cbb6/settings.json) | SPK: `Super---576685fd_263c_46bb_9fdc_1f5eb234cbb6---Power`
|
||||||
- **interface InsertInterface** | [Details](src/03bbc8d5-86e8-4d2f-ae5f-0d44a4f7af13) | [Code](src/03bbc8d5-86e8-4d2f-ae5f-0d44a4f7af13/code.php) | [Settings](src/03bbc8d5-86e8-4d2f-ae5f-0d44a4f7af13/settings.json) | SPK: `Super---03bbc8d5_86e8_4d2f_ae5f_0d44a4f7af13---Power`
|
- **interface InsertInterface** | [Details](src/03bbc8d5-86e8-4d2f-ae5f-0d44a4f7af13) | [Code](src/03bbc8d5-86e8-4d2f-ae5f-0d44a4f7af13/code.php) | [Settings](src/03bbc8d5-86e8-4d2f-ae5f-0d44a4f7af13/settings.json) | SPK: `Super---03bbc8d5_86e8_4d2f_ae5f_0d44a4f7af13---Power`
|
||||||
- **interface ItemInterface** | [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) | SPK: `Super---05744dd3_4030_4cf8_8dda_a93ab809b473---Power`
|
- **interface ItemInterface** | [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) | SPK: `Super---05744dd3_4030_4cf8_8dda_a93ab809b473---Power`
|
||||||
- **interface ItemsInterface** | [Details](src/7212e4db-371f-4cfd-8122-32e9bb100d83) | [Code](src/7212e4db-371f-4cfd-8122-32e9bb100d83/code.php) | [Settings](src/7212e4db-371f-4cfd-8122-32e9bb100d83/settings.json) | SPK: `Super---7212e4db_371f_4cfd_8122_32e9bb100d83---Power`
|
- **interface ItemsInterface** | [Details](src/7212e4db-371f-4cfd-8122-32e9bb100d83) | [Code](src/7212e4db-371f-4cfd-8122-32e9bb100d83/code.php) | [Settings](src/7212e4db-371f-4cfd-8122-32e9bb100d83/settings.json) | SPK: `Super---7212e4db_371f_4cfd_8122_32e9bb100d83---Power`
|
||||||
@ -143,13 +204,37 @@ This repository contains an index (see below) of all the approved powers within
|
|||||||
- **abstract class TypeHelper** | [Details](src/a8935cbe-7701-40dc-bfd5-675f2d600954) | [Code](src/a8935cbe-7701-40dc-bfd5-675f2d600954/code.php) | [Settings](src/a8935cbe-7701-40dc-bfd5-675f2d600954/settings.json) | SPK: `Super---a8935cbe_7701_40dc_bfd5_675f2d600954---Power`
|
- **abstract class TypeHelper** | [Details](src/a8935cbe-7701-40dc-bfd5-675f2d600954) | [Code](src/a8935cbe-7701-40dc-bfd5-675f2d600954/code.php) | [Settings](src/a8935cbe-7701-40dc-bfd5-675f2d600954/settings.json) | SPK: `Super---a8935cbe_7701_40dc_bfd5_675f2d600954---Power`
|
||||||
- **Namespace**: [VDM\Joomla\Abstraction\Registry\Traits](#vdm-joomla-abstraction-registry-traits)
|
- **Namespace**: [VDM\Joomla\Abstraction\Registry\Traits](#vdm-joomla-abstraction-registry-traits)
|
||||||
|
|
||||||
- **trait Count** | [Details](src/11572d9b-e3d5-4b29-904c-9618d8f2bfd8) | [Code](src/11572d9b-e3d5-4b29-904c-9618d8f2bfd8/code.php) | [Settings](src/11572d9b-e3d5-4b29-904c-9618d8f2bfd8/settings.json) | SPK: `Super---11572d9b_e3d5_4b29_904c_9618d8f2bfd8---Power`
|
|
||||||
- **trait GetString** | [Details](src/59b1a2ea-d77e-4040-ac8c-e65cd8743e9b) | [Code](src/59b1a2ea-d77e-4040-ac8c-e65cd8743e9b/code.php) | [Settings](src/59b1a2ea-d77e-4040-ac8c-e65cd8743e9b/settings.json) | SPK: `Super---59b1a2ea_d77e_4040_ac8c_e65cd8743e9b---Power`
|
- **trait GetString** | [Details](src/59b1a2ea-d77e-4040-ac8c-e65cd8743e9b) | [Code](src/59b1a2ea-d77e-4040-ac8c-e65cd8743e9b/code.php) | [Settings](src/59b1a2ea-d77e-4040-ac8c-e65cd8743e9b/settings.json) | SPK: `Super---59b1a2ea_d77e_4040_ac8c_e65cd8743e9b---Power`
|
||||||
- **trait InArray** | [Details](src/215b35ac-1b26-4838-bbcf-d1fdbbd9353f) | [Code](src/215b35ac-1b26-4838-bbcf-d1fdbbd9353f/code.php) | [Settings](src/215b35ac-1b26-4838-bbcf-d1fdbbd9353f/settings.json) | SPK: `Super---215b35ac_1b26_4838_bbcf_d1fdbbd9353f---Power`
|
- **trait InArray** | [Details](src/215b35ac-1b26-4838-bbcf-d1fdbbd9353f) | [Code](src/215b35ac-1b26-4838-bbcf-d1fdbbd9353f/code.php) | [Settings](src/215b35ac-1b26-4838-bbcf-d1fdbbd9353f/settings.json) | SPK: `Super---215b35ac_1b26_4838_bbcf_d1fdbbd9353f---Power`
|
||||||
- **trait IsArray** | [Details](src/c09e8968-c767-4175-bb3d-8432f206a2c7) | [Code](src/c09e8968-c767-4175-bb3d-8432f206a2c7/code.php) | [Settings](src/c09e8968-c767-4175-bb3d-8432f206a2c7/settings.json) | SPK: `Super---c09e8968_c767_4175_bb3d_8432f206a2c7---Power`
|
- **trait IsArray** | [Details](src/c09e8968-c767-4175-bb3d-8432f206a2c7) | [Code](src/c09e8968-c767-4175-bb3d-8432f206a2c7/code.php) | [Settings](src/c09e8968-c767-4175-bb3d-8432f206a2c7/settings.json) | SPK: `Super---c09e8968_c767_4175_bb3d_8432f206a2c7---Power`
|
||||||
- **trait IsString** | [Details](src/ff7d0111-8f79-42aa-ac14-b53ba2c49369) | [Code](src/ff7d0111-8f79-42aa-ac14-b53ba2c49369/code.php) | [Settings](src/ff7d0111-8f79-42aa-ac14-b53ba2c49369/settings.json) | SPK: `Super---ff7d0111_8f79_42aa_ac14_b53ba2c49369---Power`
|
- **trait IsString** | [Details](src/ff7d0111-8f79-42aa-ac14-b53ba2c49369) | [Code](src/ff7d0111-8f79-42aa-ac14-b53ba2c49369/code.php) | [Settings](src/ff7d0111-8f79-42aa-ac14-b53ba2c49369/settings.json) | SPK: `Super---ff7d0111_8f79_42aa_ac14_b53ba2c49369---Power`
|
||||||
- **trait ToString** | [Details](src/7d494d91-ab60-43cd-aecf-d50e07f7f30e) | [Code](src/7d494d91-ab60-43cd-aecf-d50e07f7f30e/code.php) | [Settings](src/7d494d91-ab60-43cd-aecf-d50e07f7f30e/settings.json) | SPK: `Super---7d494d91_ab60_43cd_aecf_d50e07f7f30e---Power`
|
- **trait PathCount** | [Details](src/11572d9b-e3d5-4b29-904c-9618d8f2bfd8) | [Code](src/11572d9b-e3d5-4b29-904c-9618d8f2bfd8/code.php) | [Settings](src/11572d9b-e3d5-4b29-904c-9618d8f2bfd8/settings.json) | SPK: `Super---11572d9b_e3d5_4b29_904c_9618d8f2bfd8---Power`
|
||||||
|
- **trait PathToString** | [Details](src/7d494d91-ab60-43cd-aecf-d50e07f7f30e) | [Code](src/7d494d91-ab60-43cd-aecf-d50e07f7f30e/code.php) | [Settings](src/7d494d91-ab60-43cd-aecf-d50e07f7f30e/settings.json) | SPK: `Super---7d494d91_ab60_43cd_aecf_d50e07f7f30e---Power`
|
||||||
- **trait VarExport** | [Details](src/52a1d14f-304a-431c-8fa4-411179942db5) | [Code](src/52a1d14f-304a-431c-8fa4-411179942db5/code.php) | [Settings](src/52a1d14f-304a-431c-8fa4-411179942db5/settings.json) | SPK: `Super---52a1d14f_304a_431c_8fa4_411179942db5---Power`
|
- **trait VarExport** | [Details](src/52a1d14f-304a-431c-8fa4-411179942db5) | [Code](src/52a1d14f-304a-431c-8fa4-411179942db5/code.php) | [Settings](src/52a1d14f-304a-431c-8fa4-411179942db5/settings.json) | SPK: `Super---52a1d14f_304a_431c_8fa4_411179942db5---Power`
|
||||||
|
- **Namespace**: [VDM\Joomla\Componentbuilder\Data\Migrator](#vdm-joomla-componentbuilder-data-migrator)
|
||||||
|
|
||||||
|
- **abstract class Factory** | [Details](src/f04c13b3-e24e-4cb5-b858-c4fe83c6f991) | [Code](src/f04c13b3-e24e-4cb5-b858-c4fe83c6f991/code.php) | [Settings](src/f04c13b3-e24e-4cb5-b858-c4fe83c6f991/settings.json) | SPK: `Super---f04c13b3_e24e_4cb5_b858_c4fe83c6f991---Power`
|
||||||
|
- **Namespace**: [VDM\Joomla\Componentbuilder\File\Service](#vdm-joomla-componentbuilder-file-service)
|
||||||
|
|
||||||
|
- **class File** | [Details](src/202ccd9e-dfcf-4cde-a0ce-bde1fd27f088) | [Code](src/202ccd9e-dfcf-4cde-a0ce-bde1fd27f088/code.php) | [Settings](src/202ccd9e-dfcf-4cde-a0ce-bde1fd27f088/settings.json) | SPK: `Super---202ccd9e_dfcf_4cde_a0ce_bde1fd27f088---Power`
|
||||||
|
- **Namespace**: [VDM\Joomla\Componentbuilder\Import\Service](#vdm-joomla-componentbuilder-import-service)
|
||||||
|
|
||||||
|
- **class Import** | [Details](src/21754a8b-2323-4a77-8459-378a74c1ec97) | [Code](src/21754a8b-2323-4a77-8459-378a74c1ec97/code.php) | [Settings](src/21754a8b-2323-4a77-8459-378a74c1ec97/settings.json) | SPK: `Super---21754a8b_2323_4a77_8459_378a74c1ec97---Power`
|
||||||
|
- **Namespace**: [VDM\Joomla\Componentbuilder\Interfaces\Spreadsheet](#vdm-joomla-componentbuilder-interfaces-spreadsheet)
|
||||||
|
|
||||||
|
- **interface FileReaderInterface** | [Details](src/61d1146f-2c2e-4e42-8492-d076f945cf35) | [Code](src/61d1146f-2c2e-4e42-8492-d076f945cf35/code.php) | [Settings](src/61d1146f-2c2e-4e42-8492-d076f945cf35/settings.json) | SPK: `Super---61d1146f_2c2e_4e42_8492_d076f945cf35---Power`
|
||||||
|
- **interface ImportCliInterface** | [Details](src/0f3f7188-3e0d-4d1a-8dee-7f8026cb65a9) | [Code](src/0f3f7188-3e0d-4d1a-8dee-7f8026cb65a9/code.php) | [Settings](src/0f3f7188-3e0d-4d1a-8dee-7f8026cb65a9/settings.json) | SPK: `Super---0f3f7188_3e0d_4d1a_8dee_7f8026cb65a9---Power`
|
||||||
|
- **interface RowDataProcessorInterface** | [Details](src/9ffc54fa-a71e-412f-bc8b-064fc3b69167) | [Code](src/9ffc54fa-a71e-412f-bc8b-064fc3b69167/code.php) | [Settings](src/9ffc54fa-a71e-412f-bc8b-064fc3b69167/settings.json) | SPK: `Super---9ffc54fa_a71e_412f_bc8b_064fc3b69167---Power`
|
||||||
|
- **Namespace**: [VDM\Joomla\Componentbuilder\Item\Import](#vdm-joomla-componentbuilder-item-import)
|
||||||
|
|
||||||
|
- **final class JoinTables** | [Details](src/db00768d-c7a6-421d-8f39-577550ddf792) | [Code](src/db00768d-c7a6-421d-8f39-577550ddf792/code.php) | [Settings](src/db00768d-c7a6-421d-8f39-577550ddf792/settings.json) | SPK: `Super---db00768d_c7a6_421d_8f39_577550ddf792---Power`
|
||||||
|
- **final class ParentTable** | [Details](src/cc923dc9-8f5c-46ea-810c-d93df2e5752b) | [Code](src/cc923dc9-8f5c-46ea-810c-d93df2e5752b/code.php) | [Settings](src/cc923dc9-8f5c-46ea-810c-d93df2e5752b/settings.json) | SPK: `Super---cc923dc9_8f5c_46ea_810c_d93df2e5752b---Power`
|
||||||
|
- **Namespace**: [VDM\Joomla\Componentbuilder\Service\Item](#vdm-joomla-componentbuilder-service-item)
|
||||||
|
|
||||||
|
- **class Import** | [Details](src/b5184f80-613e-46c8-b40a-b60de779bb78) | [Code](src/b5184f80-613e-46c8-b40a-b60de779bb78/code.php) | [Settings](src/b5184f80-613e-46c8-b40a-b60de779bb78/settings.json) | SPK: `Super---b5184f80_613e_46c8_b40a_b60de779bb78---Power`
|
||||||
|
- **Namespace**: [VDM\Joomla\Componentbuilder\Utilities\Exception](#vdm-joomla-componentbuilder-utilities-exception)
|
||||||
|
|
||||||
|
- **class NoUserIdFoundException** | [Details](src/1c10a5f1-204d-4f17-ad9f-0e0684f2030d) | [Code](src/1c10a5f1-204d-4f17-ad9f-0e0684f2030d/code.php) | [Settings](src/1c10a5f1-204d-4f17-ad9f-0e0684f2030d/settings.json) | SPK: `Super---1c10a5f1_204d_4f17_ad9f_0e0684f2030d---Power`
|
||||||
- **Namespace**: [VDM\Joomla\Interfaces\Git\Repository](#vdm-joomla-interfaces-git-repository)
|
- **Namespace**: [VDM\Joomla\Interfaces\Git\Repository](#vdm-joomla-interfaces-git-repository)
|
||||||
|
|
||||||
- **interface ContentsInterface** | [Details](src/d1de5d5b-bf29-4031-8094-76c4f6c75900) | [Code](src/d1de5d5b-bf29-4031-8094-76c4f6c75900/code.php) | [Settings](src/d1de5d5b-bf29-4031-8094-76c4f6c75900/settings.json) | SPK: `Super---d1de5d5b_bf29_4031_8094_76c4f6c75900---Power`
|
- **interface ContentsInterface** | [Details](src/d1de5d5b-bf29-4031-8094-76c4f6c75900) | [Code](src/d1de5d5b-bf29-4031-8094-76c4f6c75900/code.php) | [Settings](src/d1de5d5b-bf29-4031-8094-76c4f6c75900/settings.json) | SPK: `Super---d1de5d5b_bf29_4031_8094_76c4f6c75900---Power`
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"add_head": "0",
|
"add_head": 0,
|
||||||
"add_licensing_template": "2",
|
"add_licensing_template": 2,
|
||||||
"extends": "",
|
"extends": "",
|
||||||
"guid": "008d111c-9d43-427c-8dd4-2653e8b74be8",
|
"guid": "008d111c-9d43-427c-8dd4-2653e8b74be8",
|
||||||
"implements": [
|
"implements": [
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"add_head": "0",
|
"add_head": 0,
|
||||||
"add_licensing_template": "2",
|
"add_licensing_template": 2,
|
||||||
"extends": "",
|
"extends": "",
|
||||||
"guid": "03bbc8d5-86e8-4d2f-ae5f-0d44a4f7af13",
|
"guid": "03bbc8d5-86e8-4d2f-ae5f-0d44a4f7af13",
|
||||||
"implements": null,
|
"implements": null,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"add_head": "0",
|
"add_head": 0,
|
||||||
"add_licensing_template": "2",
|
"add_licensing_template": 2,
|
||||||
"extends": "",
|
"extends": "",
|
||||||
"guid": "05744dd3-4030-4cf8-8dda-a93ab809b473",
|
"guid": "05744dd3-4030-4cf8-8dda-a93ab809b473",
|
||||||
"implements": null,
|
"implements": null,
|
||||||
|
45
src/05f23281-58e3-482e-be42-2dc1355ef4ea/README.md
Normal file
45
src/05f23281-58e3-482e-be42-2dc1355ef4ea/README.md
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
```
|
||||||
|
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||||
|
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||||
|
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||||
|
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||||
|
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||||
|
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||||
|
```
|
||||||
|
# class Data (Details)
|
||||||
|
> namespace: **VDM\Joomla\Componentbuilder\Import**
|
||||||
|
> extends: **Registry**
|
||||||
|
|
||||||
|
```uml
|
||||||
|
@startuml
|
||||||
|
class Data #Gold {
|
||||||
|
}
|
||||||
|
|
||||||
|
@enduml
|
||||||
|
```
|
||||||
|
|
||||||
|
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
|
||||||
|
|
||||||
|
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
|
||||||
|
|
||||||
|
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
|
||||||
|
|
||||||
|
To add this specific Power to your project in JCB:
|
||||||
|
|
||||||
|
> simply use this SPK
|
||||||
|
```
|
||||||
|
Super---05f23281_58e3_482e_be42_2dc1355ef4ea---Power
|
||||||
|
```
|
||||||
|
> remember to replace the `---` with `___` to activate this Power in your code
|
||||||
|
|
||||||
|
---
|
||||||
|
```
|
||||||
|
██╗ ██████╗██████╗
|
||||||
|
██║██╔════╝██╔══██╗
|
||||||
|
██║██║ ██████╔╝
|
||||||
|
██ ██║██║ ██╔══██╗
|
||||||
|
╚█████╔╝╚██████╗██████╔╝
|
||||||
|
╚════╝ ╚═════╝╚═════╝
|
||||||
|
```
|
||||||
|
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||||
|
|
26
src/05f23281-58e3-482e-be42-2dc1355ef4ea/code.php
Normal file
26
src/05f23281-58e3-482e-be42-2dc1355ef4ea/code.php
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?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\Import;
|
||||||
|
|
||||||
|
|
||||||
|
use VDM\Joomla\Abstraction\Registry;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Import Data Registry
|
||||||
|
*
|
||||||
|
* @since 3.2.0
|
||||||
|
*/
|
||||||
|
class Data extends Registry
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
0
src/05f23281-58e3-482e-be42-2dc1355ef4ea/code.power
Normal file
0
src/05f23281-58e3-482e-be42-2dc1355ef4ea/code.power
Normal file
19
src/05f23281-58e3-482e-be42-2dc1355ef4ea/settings.json
Normal file
19
src/05f23281-58e3-482e-be42-2dc1355ef4ea/settings.json
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"add_head": 0,
|
||||||
|
"add_licensing_template": 2,
|
||||||
|
"extends": "7e822c03-1b20-41d1-9427-f5b8d5836af7",
|
||||||
|
"guid": "05f23281-58e3-482e-be42-2dc1355ef4ea",
|
||||||
|
"implements": null,
|
||||||
|
"load_selection": null,
|
||||||
|
"name": "Data",
|
||||||
|
"power_version": "1.0.0",
|
||||||
|
"system_name": "JCB.Import.Data",
|
||||||
|
"type": "class",
|
||||||
|
"use_selection": null,
|
||||||
|
"extendsinterfaces": null,
|
||||||
|
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Import.Data",
|
||||||
|
"description": "Import Data Registry\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": ""
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"add_head": "0",
|
"add_head": 0,
|
||||||
"add_licensing_template": "2",
|
"add_licensing_template": 2,
|
||||||
"extends": "6cbef8f8-4813-48e3-b05a-65e1aea95171",
|
"extends": "6cbef8f8-4813-48e3-b05a-65e1aea95171",
|
||||||
"guid": "06f8eada-d59b-441c-b287-0aea1793da5a",
|
"guid": "06f8eada-d59b-441c-b287-0aea1793da5a",
|
||||||
"implements": [
|
"implements": [
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"add_head": "0",
|
"add_head": 0,
|
||||||
"add_licensing_template": "2",
|
"add_licensing_template": 2,
|
||||||
"extends": "",
|
"extends": "",
|
||||||
"guid": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a",
|
"guid": "0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a",
|
||||||
"implements": null,
|
"implements": null,
|
||||||
|
173
src/0b746305-d34e-4c21-bc20-898c4aeac376/README.md
Normal file
173
src/0b746305-d34e-4c21-bc20-898c4aeac376/README.md
Normal file
@ -0,0 +1,173 @@
|
|||||||
|
```
|
||||||
|
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||||
|
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||||
|
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||||
|
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||||
|
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||||
|
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||||
|
```
|
||||||
|
# final class Guid (Details)
|
||||||
|
> namespace: **VDM\Joomla\Data\Migrator**
|
||||||
|
|
||||||
|
```uml
|
||||||
|
@startuml
|
||||||
|
class Guid << (F,LightGreen) >> #RoyalBlue {
|
||||||
|
# Items $items
|
||||||
|
# Load $load
|
||||||
|
# Update $update
|
||||||
|
# array $guidCache
|
||||||
|
# string $table
|
||||||
|
- array $success
|
||||||
|
+ __construct(Items $items, Load $load, ...)
|
||||||
|
+ process(array $config) : array
|
||||||
|
- processMapping(array $mapping) : void
|
||||||
|
- processBasicValue(array $mapping) : void
|
||||||
|
- processSubformValue(array $mapping) : void
|
||||||
|
- processSubSubformValue(array $mapping) : void
|
||||||
|
- getItemGuid(string $table, string $column, ...) : ?string
|
||||||
|
- processJson(string $values, string $linkedTable, ...) : string
|
||||||
|
- processArray(array $values, string $linkedTable, ...) : array
|
||||||
|
- updateValue(string $table, string $column, ...) : bool
|
||||||
|
- setTable(string $table) : void
|
||||||
|
- getTable() : string
|
||||||
|
}
|
||||||
|
|
||||||
|
note right of Guid::__construct
|
||||||
|
Constructor.
|
||||||
|
|
||||||
|
since: 5.0.4
|
||||||
|
|
||||||
|
arguments:
|
||||||
|
Items $items
|
||||||
|
Load $load
|
||||||
|
Update $update
|
||||||
|
end note
|
||||||
|
|
||||||
|
note left of Guid::process
|
||||||
|
Processes the configuration to migrate IDs to GUIDs.
|
||||||
|
|
||||||
|
since: 5.0.4
|
||||||
|
return: array
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Guid::processMapping
|
||||||
|
Processes a single mapping based on its type.
|
||||||
|
|
||||||
|
since: 5.0.4
|
||||||
|
return: void
|
||||||
|
end note
|
||||||
|
|
||||||
|
note left of Guid::processBasicValue
|
||||||
|
Processes basic values in a table and replaces IDs with GUIDs.
|
||||||
|
|
||||||
|
since: 5.0.4
|
||||||
|
return: void
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Guid::processSubformValue
|
||||||
|
Processes subform values in a table and replaces IDs with GUIDs.
|
||||||
|
|
||||||
|
since: 5.0.4
|
||||||
|
return: void
|
||||||
|
end note
|
||||||
|
|
||||||
|
note left of Guid::processSubSubformValue
|
||||||
|
Processes sub-subform values in a table and replaces IDs with GUIDs.
|
||||||
|
|
||||||
|
since: 5.0.4
|
||||||
|
return: void
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Guid::getItemGuid
|
||||||
|
Retrieves or creates a GUID for a given linked table and ID (ITEM).
|
||||||
|
|
||||||
|
since: 5.0.4
|
||||||
|
return: ?string
|
||||||
|
|
||||||
|
arguments:
|
||||||
|
string $table
|
||||||
|
string $column
|
||||||
|
mixed $value
|
||||||
|
end note
|
||||||
|
|
||||||
|
note left of Guid::processJson
|
||||||
|
Processes an json-array of basic values and replaces them with GUIDs.
|
||||||
|
|
||||||
|
since: 5.0.4
|
||||||
|
return: string
|
||||||
|
|
||||||
|
arguments:
|
||||||
|
string $values
|
||||||
|
string $linkedTable
|
||||||
|
string $linkedColumn
|
||||||
|
string $hasUpdate
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Guid::processArray
|
||||||
|
Processes an array values and replaces them with GUIDs.
|
||||||
|
|
||||||
|
since: 5.0.4
|
||||||
|
return: array
|
||||||
|
|
||||||
|
arguments:
|
||||||
|
array $values
|
||||||
|
string $linkedTable
|
||||||
|
string $linkedColumn
|
||||||
|
string $hasUpdate
|
||||||
|
end note
|
||||||
|
|
||||||
|
note left of Guid::updateValue
|
||||||
|
Updates a value in the database.
|
||||||
|
|
||||||
|
since: 5.0.4
|
||||||
|
return: bool
|
||||||
|
|
||||||
|
arguments:
|
||||||
|
string $table
|
||||||
|
string $column
|
||||||
|
string $value
|
||||||
|
int $id
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Guid::setTable
|
||||||
|
Set the current active table
|
||||||
|
|
||||||
|
since: 5.0.4
|
||||||
|
return: void
|
||||||
|
end note
|
||||||
|
|
||||||
|
note left of Guid::getTable
|
||||||
|
Get the current active table
|
||||||
|
|
||||||
|
since: 5.0.4
|
||||||
|
return: string
|
||||||
|
end note
|
||||||
|
|
||||||
|
@enduml
|
||||||
|
```
|
||||||
|
|
||||||
|
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
|
||||||
|
|
||||||
|
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
|
||||||
|
|
||||||
|
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
|
||||||
|
|
||||||
|
To add this specific Power to your project in JCB:
|
||||||
|
|
||||||
|
> simply use this SPK
|
||||||
|
```
|
||||||
|
Super---0b746305_d34e_4c21_bc20_898c4aeac376---Power
|
||||||
|
```
|
||||||
|
> remember to replace the `---` with `___` to activate this Power in your code
|
||||||
|
|
||||||
|
---
|
||||||
|
```
|
||||||
|
██╗ ██████╗██████╗
|
||||||
|
██║██╔════╝██╔══██╗
|
||||||
|
██║██║ ██████╔╝
|
||||||
|
██ ██║██║ ██╔══██╗
|
||||||
|
╚█████╔╝╚██████╗██████╔╝
|
||||||
|
╚════╝ ╚═════╝╚═════╝
|
||||||
|
```
|
||||||
|
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||||
|
|
548
src/0b746305-d34e-4c21-bc20-898c4aeac376/code.php
Normal file
548
src/0b746305-d34e-4c21-bc20-898c4aeac376/code.php
Normal file
@ -0,0 +1,548 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Component.Builder
|
||||||
|
*
|
||||||
|
* @created 4th September, 2020
|
||||||
|
* @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\Data\Migrator;
|
||||||
|
|
||||||
|
|
||||||
|
use Joomla\Registry\Registry;
|
||||||
|
use VDM\Joomla\Data\Items;
|
||||||
|
use VDM\Joomla\Database\Load;
|
||||||
|
use VDM\Joomla\Database\Update;
|
||||||
|
use VDM\Joomla\Data\Guid as TraitGuid;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Migrator To Globally Unique Identifier
|
||||||
|
*
|
||||||
|
* @since 5.0.4
|
||||||
|
*/
|
||||||
|
final class Guid
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The Globally Unique Identifier.
|
||||||
|
*
|
||||||
|
* @since 5.0.4
|
||||||
|
*/
|
||||||
|
use TraitGuid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Items Class.
|
||||||
|
*
|
||||||
|
* @var Items
|
||||||
|
* @since 5.0.4
|
||||||
|
*/
|
||||||
|
protected Items $items;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Load Class.
|
||||||
|
*
|
||||||
|
* @var Load
|
||||||
|
* @since 5.0.4
|
||||||
|
*/
|
||||||
|
protected Load $load;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Update Class.
|
||||||
|
*
|
||||||
|
* @var Update
|
||||||
|
* @since 5.0.4
|
||||||
|
*/
|
||||||
|
protected Update $update;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cache for storing GUIDs to minimize redundant database queries.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 5.0.4
|
||||||
|
*/
|
||||||
|
protected array $guidCache = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Table Name
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 5.0.4
|
||||||
|
*/
|
||||||
|
protected string $table;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cache all success messages.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 5.0.4
|
||||||
|
*/
|
||||||
|
private array $success = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param Items $items The Items Class.
|
||||||
|
* @param Load $load The Load Class.
|
||||||
|
* @param Update $update The Update Class.
|
||||||
|
*
|
||||||
|
* @since 5.0.4
|
||||||
|
*/
|
||||||
|
public function __construct(Items $items, Load $load, Update $update)
|
||||||
|
{
|
||||||
|
$this->items = $items;
|
||||||
|
$this->load = $load;
|
||||||
|
$this->update = $update;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Processes the configuration to migrate IDs to GUIDs.
|
||||||
|
*
|
||||||
|
* @param array $config Configuration array defining table and column mappings.
|
||||||
|
*
|
||||||
|
* @return array of success messages
|
||||||
|
* @since 5.0.4
|
||||||
|
*/
|
||||||
|
public function process(array $config): array
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$size = count($config);
|
||||||
|
$this->success = [
|
||||||
|
"Success: scan to migrate linked IDs to linked GUIDs has started on {$size} field areas."
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($config as $mapping)
|
||||||
|
{
|
||||||
|
$this->processMapping($mapping);
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw new \Exception("Error: migrating linked IDs to linked GUIDs. " . $e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($this->success) == 1)
|
||||||
|
{
|
||||||
|
$this->success[] = "Success: migration completed and all linked IDs are now migrated to linked GUIDs (on previous run).";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->success[] = "Success: migration completed and all linked IDs are now migrated to linked GUIDs.";
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Processes a single mapping based on its type.
|
||||||
|
*
|
||||||
|
* @param array $mapping Configuration for the current table and column.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 5.0.4
|
||||||
|
*/
|
||||||
|
private function processMapping(array $mapping): void
|
||||||
|
{
|
||||||
|
if ($mapping['valueType'] == 1)
|
||||||
|
{
|
||||||
|
$this->processBasicValue($mapping);
|
||||||
|
}
|
||||||
|
elseif ($mapping['valueType'] == 2)
|
||||||
|
{
|
||||||
|
$this->processSubformValue($mapping);
|
||||||
|
}
|
||||||
|
elseif ($mapping['valueType'] == 3)
|
||||||
|
{
|
||||||
|
$this->processSubSubformValue($mapping);
|
||||||
|
}
|
||||||
|
// allow for down stream function
|
||||||
|
elseif ($mapping['valueType'] == 4 &&
|
||||||
|
isset($mapping['function']) &&
|
||||||
|
method_exists($this, $mapping['function']))
|
||||||
|
{
|
||||||
|
$this->{$mapping['function']}($mapping);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Processes basic values in a table and replaces IDs with GUIDs.
|
||||||
|
*
|
||||||
|
* @param array $mapping Configuration for the current table and column.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 5.0.4
|
||||||
|
*/
|
||||||
|
private function processBasicValue(array $mapping): void
|
||||||
|
{
|
||||||
|
$table = $mapping['table'];
|
||||||
|
$column = $mapping['column'];
|
||||||
|
$linkedTable = $mapping['linkedTable'];
|
||||||
|
$linkedColumn = $mapping['linkedColumn'];
|
||||||
|
$isArray = $mapping['array'];
|
||||||
|
|
||||||
|
$update = false;
|
||||||
|
|
||||||
|
$rows = $this->load->rows(["a.{$column}" => $column, 'a.id' => 'id'], ['a' => $table]) ?? [];
|
||||||
|
|
||||||
|
foreach ($rows as $row)
|
||||||
|
{
|
||||||
|
$parentId = $row['id'];
|
||||||
|
$value = $row[$column] ?? null;
|
||||||
|
|
||||||
|
$hasUpdate = false;
|
||||||
|
$updatedValue = null;
|
||||||
|
|
||||||
|
if (empty($value))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($isArray)
|
||||||
|
{
|
||||||
|
$updatedValue = (is_array($value))
|
||||||
|
? $this->processArray($value, $linkedTable, $linkedColumn, $hasUpdate)
|
||||||
|
: $this->processJson($value, $linkedTable, $linkedColumn, $hasUpdate);
|
||||||
|
}
|
||||||
|
elseif (is_numeric($value))
|
||||||
|
{
|
||||||
|
$guid = $this->getItemGuid($linkedTable, $linkedColumn, $value);
|
||||||
|
if ($guid !== null)
|
||||||
|
{
|
||||||
|
$updatedValue = $guid;
|
||||||
|
$hasUpdate = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$hasUpdate || $updatedValue === null)
|
||||||
|
{
|
||||||
|
continue; // Skip if no GUID updated or returned
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->updateValue($table, $column, $updatedValue, $parentId))
|
||||||
|
{
|
||||||
|
$update = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($update)
|
||||||
|
{
|
||||||
|
$this->success[] = "Success: migrated {$column}:field in {$table}:table to GUIDs from {$linkedTable}:table.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Processes subform values in a table and replaces IDs with GUIDs.
|
||||||
|
*
|
||||||
|
* @param array $mapping Configuration for the current table and subform column/field.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 5.0.4
|
||||||
|
*/
|
||||||
|
private function processSubformValue(array $mapping): void
|
||||||
|
{
|
||||||
|
$table = $mapping['table'];
|
||||||
|
$column = $mapping['column'];
|
||||||
|
$field = $mapping['field'];
|
||||||
|
$linkedTable = $mapping['linkedTable'];
|
||||||
|
$linkedColumn = $mapping['linkedColumn'];
|
||||||
|
$isArray = $mapping['array'];
|
||||||
|
|
||||||
|
$update = false;
|
||||||
|
|
||||||
|
$rows = $this->load->rows(["a.{$column}" => $column, 'a.id' => 'id'], ['a' => $table]) ?? [];
|
||||||
|
|
||||||
|
foreach ($rows as $row)
|
||||||
|
{
|
||||||
|
$parentId = $row['id'];
|
||||||
|
$jsonData = $row[$column] ?? null;
|
||||||
|
|
||||||
|
if (empty($jsonData))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$registry = new Registry($jsonData);
|
||||||
|
$subformData = $registry->toArray();
|
||||||
|
|
||||||
|
$hasUpdate = false;
|
||||||
|
|
||||||
|
foreach ($subformData as &$item)
|
||||||
|
{
|
||||||
|
if (!empty($item[$field]))
|
||||||
|
{
|
||||||
|
if ($isArray)
|
||||||
|
{
|
||||||
|
$item[$field] = (is_array($item[$field]))
|
||||||
|
? $this->processArray($item[$field], $linkedTable, $linkedColumn, $hasUpdate)
|
||||||
|
: $this->processJson($item[$field], $linkedTable, $linkedColumn, $hasUpdate);
|
||||||
|
}
|
||||||
|
elseif (is_numeric($item[$field]))
|
||||||
|
{
|
||||||
|
$guid = $this->getItemGuid($linkedTable, $linkedColumn, $item[$field]);
|
||||||
|
if ($guid !== null)
|
||||||
|
{
|
||||||
|
$item[$field] = $guid;
|
||||||
|
$hasUpdate = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$hasUpdate)
|
||||||
|
{
|
||||||
|
continue; // Skip if no GUID updated
|
||||||
|
}
|
||||||
|
|
||||||
|
$updatedJson = (string) new Registry($subformData);
|
||||||
|
|
||||||
|
if ($this->updateValue($table, $column, $updatedJson, $parentId))
|
||||||
|
{
|
||||||
|
$update = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($update)
|
||||||
|
{
|
||||||
|
$this->success[] = "Success: migrated {$column}->{$field}:field in {$table}:table to GUIDs from {$linkedTable}:table.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Processes sub-subform values in a table and replaces IDs with GUIDs.
|
||||||
|
*
|
||||||
|
* @param array $mapping Configuration for the current table and subform column/field.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 5.0.4
|
||||||
|
*/
|
||||||
|
private function processSubSubformValue(array $mapping): void
|
||||||
|
{
|
||||||
|
$table = $mapping['table'];
|
||||||
|
$column = $mapping['column'];
|
||||||
|
$sub = $mapping['sub'];
|
||||||
|
$field = $mapping['field'];
|
||||||
|
$linkedTable = $mapping['linkedTable'];
|
||||||
|
$linkedColumn = $mapping['linkedColumn'];
|
||||||
|
$isArray = $mapping['array'];
|
||||||
|
|
||||||
|
$update = false;
|
||||||
|
|
||||||
|
$rows = $this->load->rows(["a.{$column}" => $column, 'a.id' => 'id'], ['a' => $table]) ?? [];
|
||||||
|
|
||||||
|
foreach ($rows as $row)
|
||||||
|
{
|
||||||
|
$parentId = $row['id'];
|
||||||
|
$jsonData = $row[$column] ?? null;
|
||||||
|
|
||||||
|
if (empty($jsonData))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$registry = new Registry($jsonData);
|
||||||
|
$subformData = $registry->toArray();
|
||||||
|
|
||||||
|
$hasUpdate = false;
|
||||||
|
|
||||||
|
foreach ($subformData as &$item)
|
||||||
|
{
|
||||||
|
if (isset($item[$sub]) && is_array($item[$sub]))
|
||||||
|
{
|
||||||
|
foreach ($item[$sub] as &$subItem)
|
||||||
|
{
|
||||||
|
if (!empty($subItem[$field]))
|
||||||
|
{
|
||||||
|
if ($isArray)
|
||||||
|
{
|
||||||
|
$subItem[$field] = (is_array($subItem[$field]))
|
||||||
|
? $this->processArray($subItem[$field], $linkedTable, $linkedColumn, $hasUpdate)
|
||||||
|
: $this->processJson($subItem[$field], $linkedTable, $linkedColumn, $hasUpdate);
|
||||||
|
}
|
||||||
|
elseif (is_numeric($subItem[$field]))
|
||||||
|
{
|
||||||
|
$guid = $this->getItemGuid($linkedTable, $linkedColumn, $subItem[$field]);
|
||||||
|
if ($guid !== null)
|
||||||
|
{
|
||||||
|
$subItem[$field] = $guid;
|
||||||
|
$hasUpdate = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$hasUpdate)
|
||||||
|
{
|
||||||
|
continue; // Skip if no GUID updated
|
||||||
|
}
|
||||||
|
|
||||||
|
$updatedJson = (string) new Registry($subformData);
|
||||||
|
|
||||||
|
if ($this->updateValue($table, $column, $updatedJson, $parentId))
|
||||||
|
{
|
||||||
|
$update = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($update)
|
||||||
|
{
|
||||||
|
$this->success[] = "Success: migrated {$column}->{$sub}->{$field}:field in {$table}:table to GUIDs from {$linkedTable}:table.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves or creates a GUID for a given linked table and ID (ITEM).
|
||||||
|
*
|
||||||
|
* @param string $table The linked table name.
|
||||||
|
* @param string $column The column name in the linked table.
|
||||||
|
* @param mixed $value The value to check or convert.
|
||||||
|
*
|
||||||
|
* @return string|null The GUID for the given value, or null if skipped.
|
||||||
|
* @throws \Exception If the value is invalid.
|
||||||
|
* @since 5.0.4
|
||||||
|
*/
|
||||||
|
private function getItemGuid(string $table, string $column, $value): ?string
|
||||||
|
{
|
||||||
|
if (is_numeric($value))
|
||||||
|
{
|
||||||
|
// Check if already in cache
|
||||||
|
$cacheKey = "$table:$column:$value";
|
||||||
|
|
||||||
|
if (isset($this->guidCache[$cacheKey]))
|
||||||
|
{
|
||||||
|
return $this->guidCache[$cacheKey];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Retrieve GUID from database
|
||||||
|
$guid = $this->load->value(['a.guid' => 'guid'], ['a' => $table], ["a.{$column}" => $value]);
|
||||||
|
|
||||||
|
if (!$this->validateGuid($guid))
|
||||||
|
{
|
||||||
|
// Create a new GUID
|
||||||
|
$this->setTable($table);
|
||||||
|
$guid = $this->getGuid('guid');
|
||||||
|
$this->updateValue($table, 'guid', $guid, $value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cache the GUID
|
||||||
|
$this->guidCache[$cacheKey] = $guid;
|
||||||
|
|
||||||
|
return $guid;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if the value is already a GUID
|
||||||
|
if ($this->validateGuid($value))
|
||||||
|
{
|
||||||
|
return null; // Skip, already a GUID
|
||||||
|
}
|
||||||
|
|
||||||
|
// convert to visible result
|
||||||
|
$value_printed = var_export($value, true);
|
||||||
|
|
||||||
|
// Raise an exception for invalid values
|
||||||
|
throw new \Exception("Invalid value detected: ({$table}:table)->({$column}:column)->({$value_printed}:value). Must be either an integer or a valid GUID.");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Processes an json-array of basic values and replaces them with GUIDs.
|
||||||
|
*
|
||||||
|
* @param string $values JSON string containing the IDs.
|
||||||
|
* @param string $linkedTable The linked table name.
|
||||||
|
* @param string $linkedColumn The linked column name.
|
||||||
|
* @param string $hasUpdate The switch to manage updates.
|
||||||
|
*
|
||||||
|
* @return string JSON string with updated GUIDs.
|
||||||
|
* @since 5.0.4
|
||||||
|
*/
|
||||||
|
private function processJson(string $values, string $linkedTable, string $linkedColumn, bool &$hasUpdate): string
|
||||||
|
{
|
||||||
|
$array = json_decode($values, true);
|
||||||
|
$bucket = [];
|
||||||
|
foreach ($array as $key => $value)
|
||||||
|
{
|
||||||
|
if (!empty($value))
|
||||||
|
{
|
||||||
|
$val = $this->getItemGuid($linkedTable, $linkedColumn, $value);
|
||||||
|
if ($val !== null)
|
||||||
|
{
|
||||||
|
$bucket[$key] = $val;
|
||||||
|
$hasUpdate = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return json_encode($bucket);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Processes an array values and replaces them with GUIDs.
|
||||||
|
*
|
||||||
|
* @param array $values Array of IDs from the subform field.
|
||||||
|
* @param string $linkedTable The linked table name.
|
||||||
|
* @param string $linkedColumn The linked column name.
|
||||||
|
* @param string $hasUpdate The switch to manage updates.
|
||||||
|
*
|
||||||
|
* @return array The updated array with GUIDs.
|
||||||
|
* @since 5.0.4
|
||||||
|
*/
|
||||||
|
private function processArray(array $values, string $linkedTable, string $linkedColumn, bool &$hasUpdate): array
|
||||||
|
{
|
||||||
|
$bucket = [];
|
||||||
|
foreach ($values as $key => $value)
|
||||||
|
{
|
||||||
|
if (!empty($value))
|
||||||
|
{
|
||||||
|
$val = $this->getItemGuid($linkedTable, $linkedColumn, $value);
|
||||||
|
if ($val !== null)
|
||||||
|
{
|
||||||
|
$bucket[$key] = $val;
|
||||||
|
$hasUpdate = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $bucket;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates a value in the database.
|
||||||
|
*
|
||||||
|
* @param string $table The table name.
|
||||||
|
* @param string $column The column to update.
|
||||||
|
* @param string $value The updated value.
|
||||||
|
* @param int $id The ID of the row to update.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
* @since 5.0.4
|
||||||
|
*/
|
||||||
|
private function updateValue(string $table, string $column, string $value, int $id): bool
|
||||||
|
{
|
||||||
|
return $this->update->row(['id' => $id, $column => $value], 'id', $table);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the current active table
|
||||||
|
*
|
||||||
|
* @param string $table The table that should be active
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 5.0.4
|
||||||
|
*/
|
||||||
|
private function setTable(string $table): void
|
||||||
|
{
|
||||||
|
$this->table = $table;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current active table
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @since 5.0.4
|
||||||
|
*/
|
||||||
|
private function getTable(): string
|
||||||
|
{
|
||||||
|
return $this->table;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
518
src/0b746305-d34e-4c21-bc20-898c4aeac376/code.power
Normal file
518
src/0b746305-d34e-4c21-bc20-898c4aeac376/code.power
Normal file
@ -0,0 +1,518 @@
|
|||||||
|
/**
|
||||||
|
* The Globally Unique Identifier.
|
||||||
|
*
|
||||||
|
* @since 5.0.4
|
||||||
|
*/
|
||||||
|
use TraitGuid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Items Class.
|
||||||
|
*
|
||||||
|
* @var Items
|
||||||
|
* @since 5.0.4
|
||||||
|
*/
|
||||||
|
protected Items $items;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Load Class.
|
||||||
|
*
|
||||||
|
* @var Load
|
||||||
|
* @since 5.0.4
|
||||||
|
*/
|
||||||
|
protected Load $load;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Update Class.
|
||||||
|
*
|
||||||
|
* @var Update
|
||||||
|
* @since 5.0.4
|
||||||
|
*/
|
||||||
|
protected Update $update;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cache for storing GUIDs to minimize redundant database queries.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 5.0.4
|
||||||
|
*/
|
||||||
|
protected array $guidCache = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Table Name
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 5.0.4
|
||||||
|
*/
|
||||||
|
protected string $table;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cache all success messages.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 5.0.4
|
||||||
|
*/
|
||||||
|
private array $success = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param Items $items The Items Class.
|
||||||
|
* @param Load $load The Load Class.
|
||||||
|
* @param Update $update The Update Class.
|
||||||
|
*
|
||||||
|
* @since 5.0.4
|
||||||
|
*/
|
||||||
|
public function __construct(Items $items, Load $load, Update $update)
|
||||||
|
{
|
||||||
|
$this->items = $items;
|
||||||
|
$this->load = $load;
|
||||||
|
$this->update = $update;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Processes the configuration to migrate IDs to GUIDs.
|
||||||
|
*
|
||||||
|
* @param array $config Configuration array defining table and column mappings.
|
||||||
|
*
|
||||||
|
* @return array of success messages
|
||||||
|
* @since 5.0.4
|
||||||
|
*/
|
||||||
|
public function process(array $config): array
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$size = count($config);
|
||||||
|
$this->success = [
|
||||||
|
"Success: scan to migrate linked IDs to linked GUIDs has started on {$size} field areas."
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($config as $mapping)
|
||||||
|
{
|
||||||
|
$this->processMapping($mapping);
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw new \Exception("Error: migrating linked IDs to linked GUIDs. " . $e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($this->success) == 1)
|
||||||
|
{
|
||||||
|
$this->success[] = "Success: migration completed and all linked IDs are now migrated to linked GUIDs (on previous run).";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->success[] = "Success: migration completed and all linked IDs are now migrated to linked GUIDs.";
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Processes a single mapping based on its type.
|
||||||
|
*
|
||||||
|
* @param array $mapping Configuration for the current table and column.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 5.0.4
|
||||||
|
*/
|
||||||
|
private function processMapping(array $mapping): void
|
||||||
|
{
|
||||||
|
if ($mapping['valueType'] == 1)
|
||||||
|
{
|
||||||
|
$this->processBasicValue($mapping);
|
||||||
|
}
|
||||||
|
elseif ($mapping['valueType'] == 2)
|
||||||
|
{
|
||||||
|
$this->processSubformValue($mapping);
|
||||||
|
}
|
||||||
|
elseif ($mapping['valueType'] == 3)
|
||||||
|
{
|
||||||
|
$this->processSubSubformValue($mapping);
|
||||||
|
}
|
||||||
|
// allow for down stream function
|
||||||
|
elseif ($mapping['valueType'] == 4 &&
|
||||||
|
isset($mapping['function']) &&
|
||||||
|
method_exists($this, $mapping['function']))
|
||||||
|
{
|
||||||
|
$this->{$mapping['function']}($mapping);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Processes basic values in a table and replaces IDs with GUIDs.
|
||||||
|
*
|
||||||
|
* @param array $mapping Configuration for the current table and column.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 5.0.4
|
||||||
|
*/
|
||||||
|
private function processBasicValue(array $mapping): void
|
||||||
|
{
|
||||||
|
$table = $mapping['table'];
|
||||||
|
$column = $mapping['column'];
|
||||||
|
$linkedTable = $mapping['linkedTable'];
|
||||||
|
$linkedColumn = $mapping['linkedColumn'];
|
||||||
|
$isArray = $mapping['array'];
|
||||||
|
|
||||||
|
$update = false;
|
||||||
|
|
||||||
|
$rows = $this->load->rows(["a.{$column}" => $column, 'a.id' => 'id'], ['a' => $table]) ?? [];
|
||||||
|
|
||||||
|
foreach ($rows as $row)
|
||||||
|
{
|
||||||
|
$parentId = $row['id'];
|
||||||
|
$value = $row[$column] ?? null;
|
||||||
|
|
||||||
|
$hasUpdate = false;
|
||||||
|
$updatedValue = null;
|
||||||
|
|
||||||
|
if (empty($value))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($isArray)
|
||||||
|
{
|
||||||
|
$updatedValue = (is_array($value))
|
||||||
|
? $this->processArray($value, $linkedTable, $linkedColumn, $hasUpdate)
|
||||||
|
: $this->processJson($value, $linkedTable, $linkedColumn, $hasUpdate);
|
||||||
|
}
|
||||||
|
elseif (is_numeric($value))
|
||||||
|
{
|
||||||
|
$guid = $this->getItemGuid($linkedTable, $linkedColumn, $value);
|
||||||
|
if ($guid !== null)
|
||||||
|
{
|
||||||
|
$updatedValue = $guid;
|
||||||
|
$hasUpdate = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$hasUpdate || $updatedValue === null)
|
||||||
|
{
|
||||||
|
continue; // Skip if no GUID updated or returned
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->updateValue($table, $column, $updatedValue, $parentId))
|
||||||
|
{
|
||||||
|
$update = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($update)
|
||||||
|
{
|
||||||
|
$this->success[] = "Success: migrated {$column}:field in {$table}:table to GUIDs from {$linkedTable}:table.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Processes subform values in a table and replaces IDs with GUIDs.
|
||||||
|
*
|
||||||
|
* @param array $mapping Configuration for the current table and subform column/field.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 5.0.4
|
||||||
|
*/
|
||||||
|
private function processSubformValue(array $mapping): void
|
||||||
|
{
|
||||||
|
$table = $mapping['table'];
|
||||||
|
$column = $mapping['column'];
|
||||||
|
$field = $mapping['field'];
|
||||||
|
$linkedTable = $mapping['linkedTable'];
|
||||||
|
$linkedColumn = $mapping['linkedColumn'];
|
||||||
|
$isArray = $mapping['array'];
|
||||||
|
|
||||||
|
$update = false;
|
||||||
|
|
||||||
|
$rows = $this->load->rows(["a.{$column}" => $column, 'a.id' => 'id'], ['a' => $table]) ?? [];
|
||||||
|
|
||||||
|
foreach ($rows as $row)
|
||||||
|
{
|
||||||
|
$parentId = $row['id'];
|
||||||
|
$jsonData = $row[$column] ?? null;
|
||||||
|
|
||||||
|
if (empty($jsonData))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$registry = new Registry($jsonData);
|
||||||
|
$subformData = $registry->toArray();
|
||||||
|
|
||||||
|
$hasUpdate = false;
|
||||||
|
|
||||||
|
foreach ($subformData as &$item)
|
||||||
|
{
|
||||||
|
if (!empty($item[$field]))
|
||||||
|
{
|
||||||
|
if ($isArray)
|
||||||
|
{
|
||||||
|
$item[$field] = (is_array($item[$field]))
|
||||||
|
? $this->processArray($item[$field], $linkedTable, $linkedColumn, $hasUpdate)
|
||||||
|
: $this->processJson($item[$field], $linkedTable, $linkedColumn, $hasUpdate);
|
||||||
|
}
|
||||||
|
elseif (is_numeric($item[$field]))
|
||||||
|
{
|
||||||
|
$guid = $this->getItemGuid($linkedTable, $linkedColumn, $item[$field]);
|
||||||
|
if ($guid !== null)
|
||||||
|
{
|
||||||
|
$item[$field] = $guid;
|
||||||
|
$hasUpdate = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$hasUpdate)
|
||||||
|
{
|
||||||
|
continue; // Skip if no GUID updated
|
||||||
|
}
|
||||||
|
|
||||||
|
$updatedJson = (string) new Registry($subformData);
|
||||||
|
|
||||||
|
if ($this->updateValue($table, $column, $updatedJson, $parentId))
|
||||||
|
{
|
||||||
|
$update = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($update)
|
||||||
|
{
|
||||||
|
$this->success[] = "Success: migrated {$column}->{$field}:field in {$table}:table to GUIDs from {$linkedTable}:table.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Processes sub-subform values in a table and replaces IDs with GUIDs.
|
||||||
|
*
|
||||||
|
* @param array $mapping Configuration for the current table and subform column/field.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 5.0.4
|
||||||
|
*/
|
||||||
|
private function processSubSubformValue(array $mapping): void
|
||||||
|
{
|
||||||
|
$table = $mapping['table'];
|
||||||
|
$column = $mapping['column'];
|
||||||
|
$sub = $mapping['sub'];
|
||||||
|
$field = $mapping['field'];
|
||||||
|
$linkedTable = $mapping['linkedTable'];
|
||||||
|
$linkedColumn = $mapping['linkedColumn'];
|
||||||
|
$isArray = $mapping['array'];
|
||||||
|
|
||||||
|
$update = false;
|
||||||
|
|
||||||
|
$rows = $this->load->rows(["a.{$column}" => $column, 'a.id' => 'id'], ['a' => $table]) ?? [];
|
||||||
|
|
||||||
|
foreach ($rows as $row)
|
||||||
|
{
|
||||||
|
$parentId = $row['id'];
|
||||||
|
$jsonData = $row[$column] ?? null;
|
||||||
|
|
||||||
|
if (empty($jsonData))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$registry = new Registry($jsonData);
|
||||||
|
$subformData = $registry->toArray();
|
||||||
|
|
||||||
|
$hasUpdate = false;
|
||||||
|
|
||||||
|
foreach ($subformData as &$item)
|
||||||
|
{
|
||||||
|
if (isset($item[$sub]) && is_array($item[$sub]))
|
||||||
|
{
|
||||||
|
foreach ($item[$sub] as &$subItem)
|
||||||
|
{
|
||||||
|
if (!empty($subItem[$field]))
|
||||||
|
{
|
||||||
|
if ($isArray)
|
||||||
|
{
|
||||||
|
$subItem[$field] = (is_array($subItem[$field]))
|
||||||
|
? $this->processArray($subItem[$field], $linkedTable, $linkedColumn, $hasUpdate)
|
||||||
|
: $this->processJson($subItem[$field], $linkedTable, $linkedColumn, $hasUpdate);
|
||||||
|
}
|
||||||
|
elseif (is_numeric($subItem[$field]))
|
||||||
|
{
|
||||||
|
$guid = $this->getItemGuid($linkedTable, $linkedColumn, $subItem[$field]);
|
||||||
|
if ($guid !== null)
|
||||||
|
{
|
||||||
|
$subItem[$field] = $guid;
|
||||||
|
$hasUpdate = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$hasUpdate)
|
||||||
|
{
|
||||||
|
continue; // Skip if no GUID updated
|
||||||
|
}
|
||||||
|
|
||||||
|
$updatedJson = (string) new Registry($subformData);
|
||||||
|
|
||||||
|
if ($this->updateValue($table, $column, $updatedJson, $parentId))
|
||||||
|
{
|
||||||
|
$update = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($update)
|
||||||
|
{
|
||||||
|
$this->success[] = "Success: migrated {$column}->{$sub}->{$field}:field in {$table}:table to GUIDs from {$linkedTable}:table.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves or creates a GUID for a given linked table and ID (ITEM).
|
||||||
|
*
|
||||||
|
* @param string $table The linked table name.
|
||||||
|
* @param string $column The column name in the linked table.
|
||||||
|
* @param mixed $value The value to check or convert.
|
||||||
|
*
|
||||||
|
* @return string|null The GUID for the given value, or null if skipped.
|
||||||
|
* @throws \Exception If the value is invalid.
|
||||||
|
* @since 5.0.4
|
||||||
|
*/
|
||||||
|
private function getItemGuid(string $table, string $column, $value): ?string
|
||||||
|
{
|
||||||
|
if (is_numeric($value))
|
||||||
|
{
|
||||||
|
// Check if already in cache
|
||||||
|
$cacheKey = "$table:$column:$value";
|
||||||
|
|
||||||
|
if (isset($this->guidCache[$cacheKey]))
|
||||||
|
{
|
||||||
|
return $this->guidCache[$cacheKey];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Retrieve GUID from database
|
||||||
|
$guid = $this->load->value(['a.guid' => 'guid'], ['a' => $table], ["a.{$column}" => $value]);
|
||||||
|
|
||||||
|
if (!$this->validateGuid($guid))
|
||||||
|
{
|
||||||
|
// Create a new GUID
|
||||||
|
$this->setTable($table);
|
||||||
|
$guid = $this->getGuid('guid');
|
||||||
|
$this->updateValue($table, 'guid', $guid, $value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cache the GUID
|
||||||
|
$this->guidCache[$cacheKey] = $guid;
|
||||||
|
|
||||||
|
return $guid;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if the value is already a GUID
|
||||||
|
if ($this->validateGuid($value))
|
||||||
|
{
|
||||||
|
return null; // Skip, already a GUID
|
||||||
|
}
|
||||||
|
|
||||||
|
// convert to visible result
|
||||||
|
$value_printed = var_export($value, true);
|
||||||
|
|
||||||
|
// Raise an exception for invalid values
|
||||||
|
throw new \Exception("Invalid value detected: ({$table}:table)->({$column}:column)->({$value_printed}:value). Must be either an integer or a valid GUID.");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Processes an json-array of basic values and replaces them with GUIDs.
|
||||||
|
*
|
||||||
|
* @param string $values JSON string containing the IDs.
|
||||||
|
* @param string $linkedTable The linked table name.
|
||||||
|
* @param string $linkedColumn The linked column name.
|
||||||
|
* @param string $hasUpdate The switch to manage updates.
|
||||||
|
*
|
||||||
|
* @return string JSON string with updated GUIDs.
|
||||||
|
* @since 5.0.4
|
||||||
|
*/
|
||||||
|
private function processJson(string $values, string $linkedTable, string $linkedColumn, bool &$hasUpdate): string
|
||||||
|
{
|
||||||
|
$array = json_decode($values, true);
|
||||||
|
$bucket = [];
|
||||||
|
foreach ($array as $key => $value)
|
||||||
|
{
|
||||||
|
if (!empty($value))
|
||||||
|
{
|
||||||
|
$val = $this->getItemGuid($linkedTable, $linkedColumn, $value);
|
||||||
|
if ($val !== null)
|
||||||
|
{
|
||||||
|
$bucket[$key] = $val;
|
||||||
|
$hasUpdate = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return json_encode($bucket);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Processes an array values and replaces them with GUIDs.
|
||||||
|
*
|
||||||
|
* @param array $values Array of IDs from the subform field.
|
||||||
|
* @param string $linkedTable The linked table name.
|
||||||
|
* @param string $linkedColumn The linked column name.
|
||||||
|
* @param string $hasUpdate The switch to manage updates.
|
||||||
|
*
|
||||||
|
* @return array The updated array with GUIDs.
|
||||||
|
* @since 5.0.4
|
||||||
|
*/
|
||||||
|
private function processArray(array $values, string $linkedTable, string $linkedColumn, bool &$hasUpdate): array
|
||||||
|
{
|
||||||
|
$bucket = [];
|
||||||
|
foreach ($values as $key => $value)
|
||||||
|
{
|
||||||
|
if (!empty($value))
|
||||||
|
{
|
||||||
|
$val = $this->getItemGuid($linkedTable, $linkedColumn, $value);
|
||||||
|
if ($val !== null)
|
||||||
|
{
|
||||||
|
$bucket[$key] = $val;
|
||||||
|
$hasUpdate = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $bucket;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates a value in the database.
|
||||||
|
*
|
||||||
|
* @param string $table The table name.
|
||||||
|
* @param string $column The column to update.
|
||||||
|
* @param string $value The updated value.
|
||||||
|
* @param int $id The ID of the row to update.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
* @since 5.0.4
|
||||||
|
*/
|
||||||
|
private function updateValue(string $table, string $column, string $value, int $id): bool
|
||||||
|
{
|
||||||
|
return $this->update->row(['id' => $id, $column => $value], 'id', $table);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the current active table
|
||||||
|
*
|
||||||
|
* @param string $table The table that should be active
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 5.0.4
|
||||||
|
*/
|
||||||
|
private function setTable(string $table): void
|
||||||
|
{
|
||||||
|
$this->table = $table;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current active table
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @since 5.0.4
|
||||||
|
*/
|
||||||
|
private function getTable(): string
|
||||||
|
{
|
||||||
|
return $this->table;
|
||||||
|
}
|
36
src/0b746305-d34e-4c21-bc20-898c4aeac376/settings.json
Normal file
36
src/0b746305-d34e-4c21-bc20-898c4aeac376/settings.json
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
{
|
||||||
|
"add_head": 1,
|
||||||
|
"add_licensing_template": 2,
|
||||||
|
"extends": "",
|
||||||
|
"guid": "0b746305-d34e-4c21-bc20-898c4aeac376",
|
||||||
|
"implements": null,
|
||||||
|
"load_selection": null,
|
||||||
|
"name": "Guid",
|
||||||
|
"power_version": "1.0.0",
|
||||||
|
"system_name": "VDM.Data.Migrator.Guid",
|
||||||
|
"type": "final class",
|
||||||
|
"use_selection": {
|
||||||
|
"use_selection0": {
|
||||||
|
"use": "21bca8a4-5b28-41c4-843e-8097f0ba7cca",
|
||||||
|
"as": "default"
|
||||||
|
},
|
||||||
|
"use_selection1": {
|
||||||
|
"use": "06f8eada-d59b-441c-b287-0aea1793da5a",
|
||||||
|
"as": "default"
|
||||||
|
},
|
||||||
|
"use_selection2": {
|
||||||
|
"use": "cce56585-58b0-4f72-a92c-e2635ea52d83",
|
||||||
|
"as": "default"
|
||||||
|
},
|
||||||
|
"use_selection3": {
|
||||||
|
"use": "5acded67-0e3d-4c6b-a6ea-b533b076de0c",
|
||||||
|
"as": "TraitGuid"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"extendsinterfaces": null,
|
||||||
|
"namespace": "[[[NamespacePrefix]]]\\Joomla\\Data.Migrator.Guid",
|
||||||
|
"description": "Migrator To Globally Unique Identifier\r\n\r\n@since 5.0.4",
|
||||||
|
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2020\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||||
|
"head": "use Joomla\\Registry\\Registry;",
|
||||||
|
"composer": ""
|
||||||
|
}
|
89
src/0e44d149-4863-47ec-8f0f-6a821ab3e77f/README.md
Normal file
89
src/0e44d149-4863-47ec-8f0f-6a821ab3e77f/README.md
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
```
|
||||||
|
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||||
|
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||||
|
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||||
|
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||||
|
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||||
|
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||||
|
```
|
||||||
|
# interface ImportStatusInterface (Details)
|
||||||
|
> namespace: **VDM\Joomla\Componentbuilder\Interfaces**
|
||||||
|
|
||||||
|
```uml
|
||||||
|
@startuml
|
||||||
|
interface ImportStatusInterface #Lavender {
|
||||||
|
+ set(int $status, string $guid) : void
|
||||||
|
+ table(string $table) : self
|
||||||
|
+ field(string $fieldName) : self
|
||||||
|
+ getTable() : string
|
||||||
|
+ getField() : string
|
||||||
|
}
|
||||||
|
|
||||||
|
note right of ImportStatusInterface::set
|
||||||
|
Updates the status in the database.
|
||||||
|
This method updates the import status in the database based on the result of the import process.
|
||||||
|
Status codes:
|
||||||
|
- 2: Being Processed.
|
||||||
|
- 3: Import completed successfully.
|
||||||
|
- 4: Import completed with errors.
|
||||||
|
|
||||||
|
since: 3.2.2
|
||||||
|
return: void
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of ImportStatusInterface::table
|
||||||
|
Set the current active table
|
||||||
|
|
||||||
|
since: 3.2.2
|
||||||
|
return: self
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of ImportStatusInterface::field
|
||||||
|
Set the current target status field name
|
||||||
|
|
||||||
|
since: 3.2.2
|
||||||
|
return: self
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of ImportStatusInterface::getTable
|
||||||
|
Get the current active table
|
||||||
|
|
||||||
|
since: 3.2.2
|
||||||
|
return: string
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of ImportStatusInterface::getField
|
||||||
|
Get the current target status field name
|
||||||
|
|
||||||
|
since: 3.2.2
|
||||||
|
return: string
|
||||||
|
end note
|
||||||
|
|
||||||
|
@enduml
|
||||||
|
```
|
||||||
|
|
||||||
|
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
|
||||||
|
|
||||||
|
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
|
||||||
|
|
||||||
|
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
|
||||||
|
|
||||||
|
To add this specific Power to your project in JCB:
|
||||||
|
|
||||||
|
> simply use this SPK
|
||||||
|
```
|
||||||
|
Super---0e44d149_4863_47ec_8f0f_6a821ab3e77f---Power
|
||||||
|
```
|
||||||
|
> remember to replace the `---` with `___` to activate this Power in your code
|
||||||
|
|
||||||
|
---
|
||||||
|
```
|
||||||
|
██╗ ██████╗██████╗
|
||||||
|
██║██╔════╝██╔══██╗
|
||||||
|
██║██║ ██████╔╝
|
||||||
|
██ ██║██║ ██╔══██╗
|
||||||
|
╚█████╔╝╚██████╗██████╔╝
|
||||||
|
╚════╝ ╚═════╝╚═════╝
|
||||||
|
```
|
||||||
|
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||||
|
|
75
src/0e44d149-4863-47ec-8f0f-6a821ab3e77f/code.php
Normal file
75
src/0e44d149-4863-47ec-8f0f-6a821ab3e77f/code.php
Normal 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\Interfaces;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Import Status Interface
|
||||||
|
*
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
interface ImportStatusInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Updates the status in the database.
|
||||||
|
*
|
||||||
|
* This method updates the import status in the database based on the result of the import process.
|
||||||
|
* Status codes:
|
||||||
|
* - 2: Being Processed.
|
||||||
|
* - 3: Import completed successfully.
|
||||||
|
* - 4: Import completed with errors.
|
||||||
|
*
|
||||||
|
* @param int $status The status code to set for the import (2 => processing, 3 => success, 4 => errors).
|
||||||
|
* @param string $guid The target import GUID
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function set(int $status, string $guid): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the current active table
|
||||||
|
*
|
||||||
|
* @param string $table The table that should be active
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function table(string $table): self;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the current target status field name
|
||||||
|
*
|
||||||
|
* @param string $fieldName The field name where the status is set
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function field(string $fieldName): self;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current active table
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function getTable(): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current target status field name
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function getField(): string;
|
||||||
|
}
|
||||||
|
|
52
src/0e44d149-4863-47ec-8f0f-6a821ab3e77f/code.power
Normal file
52
src/0e44d149-4863-47ec-8f0f-6a821ab3e77f/code.power
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
/**
|
||||||
|
* Updates the status in the database.
|
||||||
|
*
|
||||||
|
* This method updates the import status in the database based on the result of the import process.
|
||||||
|
* Status codes:
|
||||||
|
* - 2: Being Processed.
|
||||||
|
* - 3: Import completed successfully.
|
||||||
|
* - 4: Import completed with errors.
|
||||||
|
*
|
||||||
|
* @param int $status The status code to set for the import (2 => processing, 3 => success, 4 => errors).
|
||||||
|
* @param string $guid The target import GUID
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function set(int $status, string $guid): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the current active table
|
||||||
|
*
|
||||||
|
* @param string $table The table that should be active
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function table(string $table): self;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the current target status field name
|
||||||
|
*
|
||||||
|
* @param string $fieldName The field name where the status is set
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function field(string $fieldName): self;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current active table
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function getTable(): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current target status field name
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function getField(): string;
|
19
src/0e44d149-4863-47ec-8f0f-6a821ab3e77f/settings.json
Normal file
19
src/0e44d149-4863-47ec-8f0f-6a821ab3e77f/settings.json
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"add_head": 0,
|
||||||
|
"add_licensing_template": 2,
|
||||||
|
"extends": "",
|
||||||
|
"guid": "0e44d149-4863-47ec-8f0f-6a821ab3e77f",
|
||||||
|
"implements": null,
|
||||||
|
"load_selection": null,
|
||||||
|
"name": "ImportStatusInterface",
|
||||||
|
"power_version": "1.0.0",
|
||||||
|
"system_name": "VDM.ImportStatusInterface",
|
||||||
|
"type": "interface",
|
||||||
|
"use_selection": null,
|
||||||
|
"extendsinterfaces": null,
|
||||||
|
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Interfaces.ImportStatusInterface",
|
||||||
|
"description": "Import Status Interface\r\n\r\n@since 3.2.2",
|
||||||
|
"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": ""
|
||||||
|
}
|
60
src/0f3f7188-3e0d-4d1a-8dee-7f8026cb65a9/README.md
Normal file
60
src/0f3f7188-3e0d-4d1a-8dee-7f8026cb65a9/README.md
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
```
|
||||||
|
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||||
|
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||||
|
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||||
|
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||||
|
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||||
|
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||||
|
```
|
||||||
|
# interface ImportCliInterface (Details)
|
||||||
|
> namespace: **VDM\Joomla\Componentbuilder\Interfaces\Spreadsheet**
|
||||||
|
|
||||||
|
```uml
|
||||||
|
@startuml
|
||||||
|
interface ImportCliInterface #Lavender {
|
||||||
|
+ data(object $import) : void
|
||||||
|
+ message() : object
|
||||||
|
}
|
||||||
|
|
||||||
|
note right of ImportCliInterface::data
|
||||||
|
The trigger function called from the CLI to start the import on a spreadsheet
|
||||||
|
|
||||||
|
since: 5.0.2
|
||||||
|
return: void
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of ImportCliInterface::message
|
||||||
|
The message of the last import event
|
||||||
|
|
||||||
|
since: 5.0.2
|
||||||
|
return: object
|
||||||
|
end note
|
||||||
|
|
||||||
|
@enduml
|
||||||
|
```
|
||||||
|
|
||||||
|
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
|
||||||
|
|
||||||
|
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
|
||||||
|
|
||||||
|
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
|
||||||
|
|
||||||
|
To add this specific Power to your project in JCB:
|
||||||
|
|
||||||
|
> simply use this SPK
|
||||||
|
```
|
||||||
|
Super---0f3f7188_3e0d_4d1a_8dee_7f8026cb65a9---Power
|
||||||
|
```
|
||||||
|
> remember to replace the `---` with `___` to activate this Power in your code
|
||||||
|
|
||||||
|
---
|
||||||
|
```
|
||||||
|
██╗ ██████╗██████╗
|
||||||
|
██║██╔════╝██╔══██╗
|
||||||
|
██║██║ ██████╔╝
|
||||||
|
██ ██║██║ ██╔══██╗
|
||||||
|
╚█████╔╝╚██████╗██████╔╝
|
||||||
|
╚════╝ ╚═════╝╚═════╝
|
||||||
|
```
|
||||||
|
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||||
|
|
40
src/0f3f7188-3e0d-4d1a-8dee-7f8026cb65a9/code.php
Normal file
40
src/0f3f7188-3e0d-4d1a-8dee-7f8026cb65a9/code.php
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<?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\Spreadsheet;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Spreadsheet Import Cli Interface
|
||||||
|
*
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
interface ImportCliInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The trigger function called from the CLI to start the import on a spreadsheet
|
||||||
|
*
|
||||||
|
* @param object $import The spreadsheet data to import.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function data(object $import): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The message of the last import event
|
||||||
|
*
|
||||||
|
* @return object
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function message(): object;
|
||||||
|
}
|
||||||
|
|
17
src/0f3f7188-3e0d-4d1a-8dee-7f8026cb65a9/code.power
Normal file
17
src/0f3f7188-3e0d-4d1a-8dee-7f8026cb65a9/code.power
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
/**
|
||||||
|
* The trigger function called from the CLI to start the import on a spreadsheet
|
||||||
|
*
|
||||||
|
* @param object $import The spreadsheet data to import.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function data(object $import): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The message of the last import event
|
||||||
|
*
|
||||||
|
* @return object
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function message(): object;
|
19
src/0f3f7188-3e0d-4d1a-8dee-7f8026cb65a9/settings.json
Normal file
19
src/0f3f7188-3e0d-4d1a-8dee-7f8026cb65a9/settings.json
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"add_head": 0,
|
||||||
|
"add_licensing_template": 2,
|
||||||
|
"extends": "",
|
||||||
|
"guid": "0f3f7188-3e0d-4d1a-8dee-7f8026cb65a9",
|
||||||
|
"implements": null,
|
||||||
|
"load_selection": null,
|
||||||
|
"name": "ImportCliInterface",
|
||||||
|
"power_version": "1.0.0",
|
||||||
|
"system_name": "JCB.Interfaces.Spreadsheet.ImportCliInterface",
|
||||||
|
"type": "interface",
|
||||||
|
"use_selection": null,
|
||||||
|
"extendsinterfaces": null,
|
||||||
|
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Interfaces.Spreadsheet.ImportCliInterface",
|
||||||
|
"description": "Spreadsheet Import Cli Interface\r\n\r\n@since 3.2.2",
|
||||||
|
"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": ""
|
||||||
|
}
|
@ -6,16 +6,16 @@
|
|||||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||||
```
|
```
|
||||||
# trait Count (Details)
|
# trait PathCount (Details)
|
||||||
> namespace: **VDM\Joomla\Abstraction\Registry\Traits**
|
> namespace: **VDM\Joomla\Abstraction\Registry\Traits**
|
||||||
|
|
||||||
```uml
|
```uml
|
||||||
@startuml
|
@startuml
|
||||||
class Count << (T,Orange) >> #Turquoise {
|
class PathCount << (T,Orange) >> #Turquoise {
|
||||||
+ count(string $path) : int
|
+ pathCount(string $path) : int
|
||||||
}
|
}
|
||||||
|
|
||||||
note right of Count::count
|
note right of PathCount::pathCount
|
||||||
Retrieves number of values (or sub-array) from the storage using multiple keys.
|
Retrieves number of values (or sub-array) from the storage using multiple keys.
|
||||||
|
|
||||||
since: 3.2.0
|
since: 3.2.0
|
||||||
|
@ -13,11 +13,12 @@ namespace VDM\Joomla\Abstraction\Registry\Traits;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Count Values
|
* Count Values in a Path
|
||||||
*
|
*
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
|
* @since 5.0.2 name changed to PathCount to avoid collusion in core registry class
|
||||||
*/
|
*/
|
||||||
trait Count
|
trait PathCount
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Retrieves number of values (or sub-array) from the storage using multiple keys.
|
* Retrieves number of values (or sub-array) from the storage using multiple keys.
|
||||||
@ -28,7 +29,7 @@ trait Count
|
|||||||
* @return int The number of values
|
* @return int The number of values
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
*/
|
*/
|
||||||
public function count(string $path): int
|
public function pathCount(string $path): int
|
||||||
{
|
{
|
||||||
if (($values = $this->get($path)) === null)
|
if (($values = $this->get($path)) === null)
|
||||||
{
|
{
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* @return int The number of values
|
* @return int The number of values
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
*/
|
*/
|
||||||
public function count(string $path): int
|
public function pathCount(string $path): int
|
||||||
{
|
{
|
||||||
if (($values = $this->get($path)) === null)
|
if (($values = $this->get($path)) === null)
|
||||||
{
|
{
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
{
|
{
|
||||||
"add_head": "0",
|
"add_head": 0,
|
||||||
"add_licensing_template": "2",
|
"add_licensing_template": 2,
|
||||||
"extends": "",
|
"extends": "",
|
||||||
"guid": "11572d9b-e3d5-4b29-904c-9618d8f2bfd8",
|
"guid": "11572d9b-e3d5-4b29-904c-9618d8f2bfd8",
|
||||||
"implements": null,
|
"implements": null,
|
||||||
"load_selection": null,
|
"load_selection": null,
|
||||||
"name": "Count",
|
"name": "PathCount",
|
||||||
"power_version": "1.0.0",
|
"power_version": "1.0.0",
|
||||||
"system_name": "VDM.Abstraction.Registry.Traits.Count",
|
"system_name": "VDM.Abstraction.Registry.Traits.PathCount",
|
||||||
"type": "trait",
|
"type": "trait",
|
||||||
"use_selection": null,
|
"use_selection": null,
|
||||||
"extendsinterfaces": null,
|
"extendsinterfaces": null,
|
||||||
"namespace": "[[[NamespacePrefix]]]\\Joomla\\Abstraction.Registry.Traits.Count",
|
"namespace": "[[[NamespacePrefix]]]\\Joomla\\Abstraction.Registry.Traits.PathCount",
|
||||||
"description": "Count Values\r\n\r\n@since 3.2.0",
|
"description": "Count Values in a Path\r\n\r\n@since 3.2.0\r\n@since 5.0.2 name changed to PathCount to avoid collusion in core registry class",
|
||||||
"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",
|
"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": "",
|
"head": "",
|
||||||
"composer": ""
|
"composer": ""
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"add_head": "1",
|
"add_head": 1,
|
||||||
"add_licensing_template": "2",
|
"add_licensing_template": 2,
|
||||||
"extends": "",
|
"extends": "",
|
||||||
"guid": "1198aecf-84c6-45d2-aea8-d531aa4afdfa",
|
"guid": "1198aecf-84c6-45d2-aea8-d531aa4afdfa",
|
||||||
"implements": null,
|
"implements": null,
|
||||||
|
138
src/12a2a8de-a893-4dbb-a53d-b52de4f6cb0e/README.md
Normal file
138
src/12a2a8de-a893-4dbb-a53d-b52de4f6cb0e/README.md
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
```
|
||||||
|
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||||
|
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||||
|
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||||
|
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||||
|
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||||
|
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||||
|
```
|
||||||
|
# final class Type (Details)
|
||||||
|
> namespace: **VDM\Joomla\Componentbuilder\File**
|
||||||
|
|
||||||
|
```uml
|
||||||
|
@startuml
|
||||||
|
class Type << (F,LightGreen) >> #RoyalBlue {
|
||||||
|
# Item $item
|
||||||
|
# array $fileTypes
|
||||||
|
+ __construct(Item $item)
|
||||||
|
+ get(string $guid, string $target) : ?array
|
||||||
|
+ load(string $guid, string $target) : ?array
|
||||||
|
+ details(string $guid) : ?object
|
||||||
|
# validTarget(object $data, string $target) : bool
|
||||||
|
# getFieldName(object $data) : string
|
||||||
|
# getAllow(object $data) : string
|
||||||
|
# getAllowSpan(object $data) : string
|
||||||
|
# getAllowFormats(object $data) : ?array
|
||||||
|
# getFileTypePath(object $data) : ?string
|
||||||
|
# getLastFolderName(string $path) : ?string
|
||||||
|
}
|
||||||
|
|
||||||
|
note right of Type::__construct
|
||||||
|
Constructor.
|
||||||
|
|
||||||
|
since: 5.0.2
|
||||||
|
end note
|
||||||
|
|
||||||
|
note left of Type::get
|
||||||
|
Retrieves the file type details (ajax)
|
||||||
|
|
||||||
|
since: 5.0.2
|
||||||
|
return: ?array
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Type::load
|
||||||
|
Retrieves the file type details (upload)
|
||||||
|
|
||||||
|
since: 5.0.2
|
||||||
|
return: ?array
|
||||||
|
end note
|
||||||
|
|
||||||
|
note left of Type::details
|
||||||
|
Retrieves the file type details
|
||||||
|
|
||||||
|
since: 5.0.2
|
||||||
|
return: ?object
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Type::validTarget
|
||||||
|
Valid if this is a correct target trying to call this file type
|
||||||
|
|
||||||
|
since: 5.0.2
|
||||||
|
return: bool
|
||||||
|
end note
|
||||||
|
|
||||||
|
note left of Type::getFieldName
|
||||||
|
Retrieves the field name
|
||||||
|
|
||||||
|
since: 5.0.2
|
||||||
|
return: string
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Type::getAllow
|
||||||
|
Retrieves the allow formats (for script)
|
||||||
|
|
||||||
|
since: 5.0.2
|
||||||
|
return: string
|
||||||
|
end note
|
||||||
|
|
||||||
|
note left of Type::getAllowSpan
|
||||||
|
Retrieves the allow formats (for span)
|
||||||
|
|
||||||
|
since: 5.0.2
|
||||||
|
return: string
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Type::getAllowFormats
|
||||||
|
Retrieves the allow formats
|
||||||
|
|
||||||
|
since: 5.0.2
|
||||||
|
return: ?array
|
||||||
|
end note
|
||||||
|
|
||||||
|
note left of Type::getFileTypePath
|
||||||
|
Retrieves the file type path based on provided data.
|
||||||
|
Performs safety checks and returns either a cleaned path if it exists
|
||||||
|
and is a writable directory, or constructs a relative path to the 'images' folder
|
||||||
|
based on the last folder name from the given path.
|
||||||
|
|
||||||
|
since: 5.0.2
|
||||||
|
return: ?string
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Type::getLastFolderName
|
||||||
|
Recursively retrieves the last folder name from a given path, ignoring any file names.
|
||||||
|
If the last part of the path contains a dot (indicating a file), it moves up the directory tree
|
||||||
|
until it finds a valid folder name. Returns null if no valid folder is found.
|
||||||
|
|
||||||
|
since: 5.0.2
|
||||||
|
return: ?string
|
||||||
|
end note
|
||||||
|
|
||||||
|
@enduml
|
||||||
|
```
|
||||||
|
|
||||||
|
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
|
||||||
|
|
||||||
|
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
|
||||||
|
|
||||||
|
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
|
||||||
|
|
||||||
|
To add this specific Power to your project in JCB:
|
||||||
|
|
||||||
|
> simply use this SPK
|
||||||
|
```
|
||||||
|
Super---12a2a8de_a893_4dbb_a53d_b52de4f6cb0e---Power
|
||||||
|
```
|
||||||
|
> remember to replace the `---` with `___` to activate this Power in your code
|
||||||
|
|
||||||
|
---
|
||||||
|
```
|
||||||
|
██╗ ██████╗██████╗
|
||||||
|
██║██╔════╝██╔══██╗
|
||||||
|
██║██║ ██████╔╝
|
||||||
|
██ ██║██║ ██╔══██╗
|
||||||
|
╚█████╔╝╚██████╗██████╔╝
|
||||||
|
╚════╝ ╚═════╝╚═════╝
|
||||||
|
```
|
||||||
|
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||||
|
|
301
src/12a2a8de-a893-4dbb-a53d-b52de4f6cb0e/code.php
Normal file
301
src/12a2a8de-a893-4dbb-a53d-b52de4f6cb0e/code.php
Normal file
@ -0,0 +1,301 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Component.Builder
|
||||||
|
*
|
||||||
|
* @created 4th September, 2020
|
||||||
|
* @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\File;
|
||||||
|
|
||||||
|
|
||||||
|
use Joomla\Filesystem\Path;
|
||||||
|
use VDM\Joomla\Interfaces\Data\ItemInterface as Item;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* File Type Class
|
||||||
|
*
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
final class Type
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The Item Class.
|
||||||
|
*
|
||||||
|
* @var Item
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected Item $item;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The File Types
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected array $fileTypes = [1 => 'image' , 2 => 'document' , 3 => 'media', 4 => 'file'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param Item $item The Item Class.
|
||||||
|
*
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function __construct(Item $item)
|
||||||
|
{
|
||||||
|
$this->item = $item;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the file type details (ajax)
|
||||||
|
*
|
||||||
|
* @param string $guid The GUID (Globally Unique Identifier) used as the key to retrieve the file type
|
||||||
|
* @param string $target The entity target name.
|
||||||
|
*
|
||||||
|
* @return array|null The item object if found, or null if the item does not exist.
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function get(string $guid, string $target): ?array
|
||||||
|
{
|
||||||
|
if (($fileType = $this->details($guid)) !== null &&
|
||||||
|
$this->validTarget($fileType, $target))
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'name' => $this->getFieldName($fileType),
|
||||||
|
'allow' => $this->getAllow($fileType),
|
||||||
|
'allow_span' => $this->getAllowSpan($fileType),
|
||||||
|
'file_type_span' => $fileType->name ?? 'file',
|
||||||
|
'display_fields' => $fileType->display_fields ?? null,
|
||||||
|
'param_fields' => $fileType->param_fields ?? null,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the file type details (upload)
|
||||||
|
*
|
||||||
|
* @param string $guid The GUID (Globally Unique Identifier) used as the key to retrieve the file type
|
||||||
|
* @param string $target The entity target name.
|
||||||
|
*
|
||||||
|
* @return array|null The item object if found, or null if the item does not exist.
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function load(string $guid, string $target): ?array
|
||||||
|
{
|
||||||
|
if (($fileType = $this->details($guid)) !== null &&
|
||||||
|
$this->validTarget($fileType, $target))
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'name' => $fileType->name ?? 'files',
|
||||||
|
'access' => $fileType->access ?? 1,
|
||||||
|
'download_access' => $fileType->download_access ?? 1,
|
||||||
|
'field' => $this->getFieldName($fileType),
|
||||||
|
'type' => $this->getFieldName($fileType),
|
||||||
|
'formats' => $this->getAllowFormats($fileType) ?? [],
|
||||||
|
'filter' => $fileType->filter ?? null,
|
||||||
|
'path' => $this->getFileTypePath($fileType)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the file type details
|
||||||
|
*
|
||||||
|
* @param string $guid The GUID (Globally Unique Identifier) used as the key to retrieve the file type.
|
||||||
|
*
|
||||||
|
* @return object|null The item object if found, or null if the item does not exist.
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function details(string $guid): ?object
|
||||||
|
{
|
||||||
|
return $this->item->table('file_type')->get($guid);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Valid if this is a correct target trying to call this file type
|
||||||
|
*
|
||||||
|
* @param object $data The type data array
|
||||||
|
* @param string $target The entity target name.
|
||||||
|
*
|
||||||
|
* @return bool True if valid target
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected function validTarget(object $data, string $target): bool
|
||||||
|
{
|
||||||
|
$targets = $data->target ?? null;
|
||||||
|
if (!empty($targets))
|
||||||
|
{
|
||||||
|
$targets = (array) $targets;
|
||||||
|
return in_array($target, $targets);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the field name
|
||||||
|
*
|
||||||
|
* @param object $data The type data array
|
||||||
|
*
|
||||||
|
* @return string The field name
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected function getFieldName(object $data): string
|
||||||
|
{
|
||||||
|
$type = $data->type ?? 4;
|
||||||
|
if (isset($this->fileTypes[$type]))
|
||||||
|
{
|
||||||
|
return $this->fileTypes[$type];
|
||||||
|
}
|
||||||
|
return 'file';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the allow formats (for script)
|
||||||
|
*
|
||||||
|
* @param object $data The type data array
|
||||||
|
*
|
||||||
|
* @return string The allow values
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected function getAllow(object $data): string
|
||||||
|
{
|
||||||
|
$formats = $this->getAllowFormats($data);
|
||||||
|
if (!empty($formats))
|
||||||
|
{
|
||||||
|
return '*.(' . implode('|', $formats) . ')';
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the allow formats (for span)
|
||||||
|
*
|
||||||
|
* @param object $data The type data array
|
||||||
|
*
|
||||||
|
* @return string The allow values
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected function getAllowSpan(object $data): string
|
||||||
|
{
|
||||||
|
$formats = $this->getAllowFormats($data);
|
||||||
|
if (!empty($formats))
|
||||||
|
{
|
||||||
|
return '(formats allowed: <b>' . implode(', ', $formats) . '</b>)';
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the allow formats
|
||||||
|
*
|
||||||
|
* @param object|null $data The type data array
|
||||||
|
*
|
||||||
|
* @return array|null The allow values
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected function getAllowFormats(object $data): ?array
|
||||||
|
{
|
||||||
|
$type = $data->type ?? 4;
|
||||||
|
switch ($type)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
$formats = $data->image_formats ?? null;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
$formats = $data->document_formats ?? null;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
$formats = $data->media_formats ?? null;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$formats = $data->file_formats ?? null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($formats)
|
||||||
|
{
|
||||||
|
return (array) $formats;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the file type path based on provided data.
|
||||||
|
*
|
||||||
|
* Performs safety checks and returns either a cleaned path if it exists
|
||||||
|
* and is a writable directory, or constructs a relative path to the 'images' folder
|
||||||
|
* based on the last folder name from the given path.
|
||||||
|
*
|
||||||
|
* @param object $data The type data object containing path information.
|
||||||
|
*
|
||||||
|
* @return string|null Returns the cleaned file path or null if no valid path is found.
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected function getFileTypePath(object $data): ?string
|
||||||
|
{
|
||||||
|
// Validate the provided path data
|
||||||
|
$path = isset($data->path) && is_string($data->path) && trim($data->path) !== '' ?
|
||||||
|
Path::clean(trim($data->path)) : null;
|
||||||
|
|
||||||
|
// Return the path if it's a valid directory and writable
|
||||||
|
if ($path !== null && is_dir($path) && is_writable($path))
|
||||||
|
{
|
||||||
|
return $path;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If no valid path is found, try to derive a relative path from the 'images' folder
|
||||||
|
if ($path !== null && ($folder = $this->getLastFolderName($path)) !== null)
|
||||||
|
{
|
||||||
|
return JPATH_SITE . '/images/' . $folder;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recursively retrieves the last folder name from a given path, ignoring any file names.
|
||||||
|
* If the last part of the path contains a dot (indicating a file), it moves up the directory tree
|
||||||
|
* until it finds a valid folder name. Returns null if no valid folder is found.
|
||||||
|
*
|
||||||
|
* @param string $path The file system path from which to extract the last folder name.
|
||||||
|
*
|
||||||
|
* @return string|null Returns the last folder name if found, or null if no valid folder exists.
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected function getLastFolderName(string $path): ?string
|
||||||
|
{
|
||||||
|
// Remove any trailing slashes to avoid an empty result
|
||||||
|
$path = rtrim($path, '/\\');
|
||||||
|
|
||||||
|
// If the path becomes empty, return null (base case)
|
||||||
|
if (empty($path))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the last part of the path
|
||||||
|
$lastPart = basename($path);
|
||||||
|
|
||||||
|
// If the last part contains a dot (and it's not a hidden folder), move up the directory tree
|
||||||
|
if (strpos($lastPart, '.') > 0)
|
||||||
|
{
|
||||||
|
// If it contains a dot, treat it as a file and move up one level
|
||||||
|
return $this->getLastFolderName(dirname($path));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the last folder name (if it's valid and not a file)
|
||||||
|
return $lastPart;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
274
src/12a2a8de-a893-4dbb-a53d-b52de4f6cb0e/code.power
Normal file
274
src/12a2a8de-a893-4dbb-a53d-b52de4f6cb0e/code.power
Normal file
@ -0,0 +1,274 @@
|
|||||||
|
/**
|
||||||
|
* The Item Class.
|
||||||
|
*
|
||||||
|
* @var Item
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected Item $item;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The File Types
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected array $fileTypes = [1 => 'image' , 2 => 'document' , 3 => 'media', 4 => 'file'];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param Item $item The Item Class.
|
||||||
|
*
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function __construct(Item $item)
|
||||||
|
{
|
||||||
|
$this->item = $item;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the file type details (ajax)
|
||||||
|
*
|
||||||
|
* @param string $guid The GUID (Globally Unique Identifier) used as the key to retrieve the file type
|
||||||
|
* @param string $target The entity target name.
|
||||||
|
*
|
||||||
|
* @return array|null The item object if found, or null if the item does not exist.
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function get(string $guid, string $target): ?array
|
||||||
|
{
|
||||||
|
if (($fileType = $this->details($guid)) !== null &&
|
||||||
|
$this->validTarget($fileType, $target))
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'name' => $this->getFieldName($fileType),
|
||||||
|
'allow' => $this->getAllow($fileType),
|
||||||
|
'allow_span' => $this->getAllowSpan($fileType),
|
||||||
|
'file_type_span' => $fileType->name ?? 'file',
|
||||||
|
'display_fields' => $fileType->display_fields ?? null,
|
||||||
|
'param_fields' => $fileType->param_fields ?? null,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the file type details (upload)
|
||||||
|
*
|
||||||
|
* @param string $guid The GUID (Globally Unique Identifier) used as the key to retrieve the file type
|
||||||
|
* @param string $target The entity target name.
|
||||||
|
*
|
||||||
|
* @return array|null The item object if found, or null if the item does not exist.
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function load(string $guid, string $target): ?array
|
||||||
|
{
|
||||||
|
if (($fileType = $this->details($guid)) !== null &&
|
||||||
|
$this->validTarget($fileType, $target))
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'name' => $fileType->name ?? 'files',
|
||||||
|
'access' => $fileType->access ?? 1,
|
||||||
|
'download_access' => $fileType->download_access ?? 1,
|
||||||
|
'field' => $this->getFieldName($fileType),
|
||||||
|
'type' => $this->getFieldName($fileType),
|
||||||
|
'formats' => $this->getAllowFormats($fileType) ?? [],
|
||||||
|
'filter' => $fileType->filter ?? null,
|
||||||
|
'path' => $this->getFileTypePath($fileType)
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the file type details
|
||||||
|
*
|
||||||
|
* @param string $guid The GUID (Globally Unique Identifier) used as the key to retrieve the file type.
|
||||||
|
*
|
||||||
|
* @return object|null The item object if found, or null if the item does not exist.
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function details(string $guid): ?object
|
||||||
|
{
|
||||||
|
return $this->item->table('file_type')->get($guid);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Valid if this is a correct target trying to call this file type
|
||||||
|
*
|
||||||
|
* @param object $data The type data array
|
||||||
|
* @param string $target The entity target name.
|
||||||
|
*
|
||||||
|
* @return bool True if valid target
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected function validTarget(object $data, string $target): bool
|
||||||
|
{
|
||||||
|
$targets = $data->target ?? null;
|
||||||
|
if (!empty($targets))
|
||||||
|
{
|
||||||
|
$targets = (array) $targets;
|
||||||
|
return in_array($target, $targets);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the field name
|
||||||
|
*
|
||||||
|
* @param object $data The type data array
|
||||||
|
*
|
||||||
|
* @return string The field name
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected function getFieldName(object $data): string
|
||||||
|
{
|
||||||
|
$type = $data->type ?? 4;
|
||||||
|
if (isset($this->fileTypes[$type]))
|
||||||
|
{
|
||||||
|
return $this->fileTypes[$type];
|
||||||
|
}
|
||||||
|
return 'file';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the allow formats (for script)
|
||||||
|
*
|
||||||
|
* @param object $data The type data array
|
||||||
|
*
|
||||||
|
* @return string The allow values
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected function getAllow(object $data): string
|
||||||
|
{
|
||||||
|
$formats = $this->getAllowFormats($data);
|
||||||
|
if (!empty($formats))
|
||||||
|
{
|
||||||
|
return '*.(' . implode('|', $formats) . ')';
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the allow formats (for span)
|
||||||
|
*
|
||||||
|
* @param object $data The type data array
|
||||||
|
*
|
||||||
|
* @return string The allow values
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected function getAllowSpan(object $data): string
|
||||||
|
{
|
||||||
|
$formats = $this->getAllowFormats($data);
|
||||||
|
if (!empty($formats))
|
||||||
|
{
|
||||||
|
return '(formats allowed: <b>' . implode(', ', $formats) . '</b>)';
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the allow formats
|
||||||
|
*
|
||||||
|
* @param object|null $data The type data array
|
||||||
|
*
|
||||||
|
* @return array|null The allow values
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected function getAllowFormats(object $data): ?array
|
||||||
|
{
|
||||||
|
$type = $data->type ?? 4;
|
||||||
|
switch ($type)
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
$formats = $data->image_formats ?? null;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
$formats = $data->document_formats ?? null;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
$formats = $data->media_formats ?? null;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$formats = $data->file_formats ?? null;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($formats)
|
||||||
|
{
|
||||||
|
return (array) $formats;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the file type path based on provided data.
|
||||||
|
*
|
||||||
|
* Performs safety checks and returns either a cleaned path if it exists
|
||||||
|
* and is a writable directory, or constructs a relative path to the 'images' folder
|
||||||
|
* based on the last folder name from the given path.
|
||||||
|
*
|
||||||
|
* @param object $data The type data object containing path information.
|
||||||
|
*
|
||||||
|
* @return string|null Returns the cleaned file path or null if no valid path is found.
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected function getFileTypePath(object $data): ?string
|
||||||
|
{
|
||||||
|
// Validate the provided path data
|
||||||
|
$path = isset($data->path) && is_string($data->path) && trim($data->path) !== '' ?
|
||||||
|
Path::clean(trim($data->path)) : null;
|
||||||
|
|
||||||
|
// Return the path if it's a valid directory and writable
|
||||||
|
if ($path !== null && is_dir($path) && is_writable($path))
|
||||||
|
{
|
||||||
|
return $path;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If no valid path is found, try to derive a relative path from the 'images' folder
|
||||||
|
if ($path !== null && ($folder = $this->getLastFolderName($path)) !== null)
|
||||||
|
{
|
||||||
|
return JPATH_SITE . '/images/' . $folder;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recursively retrieves the last folder name from a given path, ignoring any file names.
|
||||||
|
* If the last part of the path contains a dot (indicating a file), it moves up the directory tree
|
||||||
|
* until it finds a valid folder name. Returns null if no valid folder is found.
|
||||||
|
*
|
||||||
|
* @param string $path The file system path from which to extract the last folder name.
|
||||||
|
*
|
||||||
|
* @return string|null Returns the last folder name if found, or null if no valid folder exists.
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected function getLastFolderName(string $path): ?string
|
||||||
|
{
|
||||||
|
// Remove any trailing slashes to avoid an empty result
|
||||||
|
$path = rtrim($path, '/\\');
|
||||||
|
|
||||||
|
// If the path becomes empty, return null (base case)
|
||||||
|
if (empty($path))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the last part of the path
|
||||||
|
$lastPart = basename($path);
|
||||||
|
|
||||||
|
// If the last part contains a dot (and it's not a hidden folder), move up the directory tree
|
||||||
|
if (strpos($lastPart, '.') > 0)
|
||||||
|
{
|
||||||
|
// If it contains a dot, treat it as a file and move up one level
|
||||||
|
return $this->getLastFolderName(dirname($path));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return the last folder name (if it's valid and not a file)
|
||||||
|
return $lastPart;
|
||||||
|
}
|
24
src/12a2a8de-a893-4dbb-a53d-b52de4f6cb0e/settings.json
Normal file
24
src/12a2a8de-a893-4dbb-a53d-b52de4f6cb0e/settings.json
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"add_head": 1,
|
||||||
|
"add_licensing_template": 2,
|
||||||
|
"extends": "",
|
||||||
|
"guid": "12a2a8de-a893-4dbb-a53d-b52de4f6cb0e",
|
||||||
|
"implements": null,
|
||||||
|
"load_selection": null,
|
||||||
|
"name": "Type",
|
||||||
|
"power_version": "1.0.0",
|
||||||
|
"system_name": "Joomla.File.Type",
|
||||||
|
"type": "final class",
|
||||||
|
"use_selection": {
|
||||||
|
"use_selection0": {
|
||||||
|
"use": "05744dd3-4030-4cf8-8dda-a93ab809b473",
|
||||||
|
"as": "Item"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"extendsinterfaces": null,
|
||||||
|
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].File.Type",
|
||||||
|
"description": "File Type Class\r\n\r\n@since 5.0.2",
|
||||||
|
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2020\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\\Filesystem\\Path;",
|
||||||
|
"composer": ""
|
||||||
|
}
|
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* @package Joomla.Component.Builder
|
* @package Joomla.Component.Builder
|
||||||
*
|
*
|
||||||
* @created 3rd September, 2020
|
* @created 4th September, 2020
|
||||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"add_head": "0",
|
"add_head": 0,
|
||||||
"add_licensing_template": "2",
|
"add_licensing_template": 2,
|
||||||
"extends": "",
|
"extends": "",
|
||||||
"guid": "13c2cac1-a70d-42d7-99fc-eb7ac3443069",
|
"guid": "13c2cac1-a70d-42d7-99fc-eb7ac3443069",
|
||||||
"implements": null,
|
"implements": null,
|
||||||
@ -13,7 +13,7 @@
|
|||||||
"extendsinterfaces": null,
|
"extendsinterfaces": null,
|
||||||
"namespace": "[[[NamespacePrefix]]]\\Joomla\\Utilities.ClassHelper",
|
"namespace": "[[[NamespacePrefix]]]\\Joomla\\Utilities.ClassHelper",
|
||||||
"description": "Class Helper for JCB Powers\r\n\r\n@since 3.2.2",
|
"description": "Class Helper for JCB Powers\r\n\r\n@since 3.2.2",
|
||||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 3rd September, 2020\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",
|
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2020\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": "",
|
"head": "",
|
||||||
"composer": ""
|
"composer": ""
|
||||||
}
|
}
|
@ -14,10 +14,12 @@
|
|||||||
abstract Grep #Orange {
|
abstract Grep #Orange {
|
||||||
+ ?string $path
|
+ ?string $path
|
||||||
+ ?array $paths
|
+ ?array $paths
|
||||||
|
# ?string $target
|
||||||
# array $order
|
# array $order
|
||||||
# Contents $contents
|
# Contents $contents
|
||||||
|
# Resolve $resolve
|
||||||
# CMSApplication $app
|
# CMSApplication $app
|
||||||
+ __construct(Contents $contents, array $paths, ...)
|
+ __construct(Contents $contents, Resolve $resolve, ...)
|
||||||
+ get(string $guid, ?array $order = null, ...) : ?object
|
+ get(string $guid, ?array $order = null, ...) : ?object
|
||||||
+ exists(string $guid, ?object $repo = null, ...) : bool
|
+ exists(string $guid, ?object $repo = null, ...) : bool
|
||||||
+ getRemoteGuid() : ?array
|
+ getRemoteGuid() : ?array
|
||||||
@ -25,6 +27,7 @@ abstract Grep #Orange {
|
|||||||
+ setBranchDefaultName(?string $name) : void
|
+ setBranchDefaultName(?string $name) : void
|
||||||
+ setIndexPath(string $indexPath) : void
|
+ setIndexPath(string $indexPath) : void
|
||||||
+ getRemoteIndex(string $guid) : ?object
|
+ getRemoteIndex(string $guid) : ?object
|
||||||
|
+ loadApi(Api $api, ?string $base, ...) : void
|
||||||
# {abstract} setRemoteIndexMessage(string $message, string $path, ...) : void
|
# {abstract} setRemoteIndexMessage(string $message, string $path, ...) : void
|
||||||
# getFunctionName(string $name, string $type = 'search') : ?string
|
# getFunctionName(string $name, string $type = 'search') : ?string
|
||||||
# searchSingleRepo(string $guid, array $order, ...) : ?object
|
# searchSingleRepo(string $guid, array $order, ...) : ?object
|
||||||
@ -53,6 +56,7 @@ note right of Grep::__construct
|
|||||||
|
|
||||||
arguments:
|
arguments:
|
||||||
Contents $contents
|
Contents $contents
|
||||||
|
Resolve $resolve
|
||||||
array $paths
|
array $paths
|
||||||
?string $path = null
|
?string $path = null
|
||||||
?CMSApplication $app = null
|
?CMSApplication $app = null
|
||||||
@ -117,7 +121,22 @@ note left of Grep::getRemoteIndex
|
|||||||
return: ?object
|
return: ?object
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note right of Grep::setRemoteIndexMessage
|
note right of Grep::loadApi
|
||||||
|
Loads API config using the provided base URL and token.
|
||||||
|
This method checks if the base URL contains 'https://git.vdm.dev/'.
|
||||||
|
If it does, it uses the token as is (which may be null).
|
||||||
|
If not, it ensures the token is not null by defaulting to an empty string.
|
||||||
|
|
||||||
|
since: 5.0.4
|
||||||
|
return: void
|
||||||
|
|
||||||
|
arguments:
|
||||||
|
Api $api
|
||||||
|
?string $base
|
||||||
|
?string $token
|
||||||
|
end note
|
||||||
|
|
||||||
|
note left of Grep::setRemoteIndexMessage
|
||||||
Set repository messages and errors based on given conditions.
|
Set repository messages and errors based on given conditions.
|
||||||
|
|
||||||
since: 3.2.0
|
since: 3.2.0
|
||||||
@ -131,14 +150,14 @@ note right of Grep::setRemoteIndexMessage
|
|||||||
?string $base
|
?string $base
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note left of Grep::getFunctionName
|
note right of Grep::getFunctionName
|
||||||
Get function name
|
Get function name
|
||||||
|
|
||||||
since: 3.2.0
|
since: 3.2.0
|
||||||
return: ?string
|
return: ?string
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note right of Grep::searchSingleRepo
|
note left of Grep::searchSingleRepo
|
||||||
Search a single repository for an item
|
Search a single repository for an item
|
||||||
|
|
||||||
since: 3.2.2
|
since: 3.2.2
|
||||||
@ -150,14 +169,14 @@ note right of Grep::searchSingleRepo
|
|||||||
object $repo
|
object $repo
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note left of Grep::searchAllRepos
|
note right of Grep::searchAllRepos
|
||||||
Search all repositories for an item
|
Search all repositories for an item
|
||||||
|
|
||||||
since: 3.2.2
|
since: 3.2.2
|
||||||
return: ?object
|
return: ?object
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note right of Grep::itemExistsInRepo
|
note left of Grep::itemExistsInRepo
|
||||||
Check if an item exists in a specific repository.
|
Check if an item exists in a specific repository.
|
||||||
|
|
||||||
since: 3.2.2
|
since: 3.2.2
|
||||||
@ -169,42 +188,42 @@ note right of Grep::itemExistsInRepo
|
|||||||
array $order
|
array $order
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note left of Grep::itemExistsInAllRepos
|
note right of Grep::itemExistsInAllRepos
|
||||||
Check if an item exists in any of the repositories.
|
Check if an item exists in any of the repositories.
|
||||||
|
|
||||||
since: 3.2.2
|
since: 3.2.2
|
||||||
return: bool
|
return: bool
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note right of Grep::getBranchField
|
note left of Grep::getBranchField
|
||||||
Get the branch field
|
Get the branch field
|
||||||
|
|
||||||
since: 3.2.2
|
since: 3.2.2
|
||||||
return: string
|
return: string
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note left of Grep::getBranchDefaultName
|
note right of Grep::getBranchDefaultName
|
||||||
Get the branch default name
|
Get the branch default name
|
||||||
|
|
||||||
since: 3.2.2
|
since: 3.2.2
|
||||||
return: ?string
|
return: ?string
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note right of Grep::getBranchName
|
note left of Grep::getBranchName
|
||||||
Get the branch name
|
Get the branch name
|
||||||
|
|
||||||
since: 3.2.2
|
since: 3.2.2
|
||||||
return: ?string
|
return: ?string
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note left of Grep::getIndexPath
|
note right of Grep::getIndexPath
|
||||||
Get the index path
|
Get the index path
|
||||||
|
|
||||||
since: 3.2.2
|
since: 3.2.2
|
||||||
return: string
|
return: string
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note right of Grep::itemExists
|
note left of Grep::itemExists
|
||||||
Check if an item exists in a specific repo and target.
|
Check if an item exists in a specific repo and target.
|
||||||
|
|
||||||
since: 3.2.2
|
since: 3.2.2
|
||||||
@ -216,56 +235,56 @@ note right of Grep::itemExists
|
|||||||
string $target
|
string $target
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note left of Grep::existsLocally
|
note right of Grep::existsLocally
|
||||||
Check if item exists locally
|
Check if item exists locally
|
||||||
|
|
||||||
since: 3.2.2
|
since: 3.2.2
|
||||||
return: ?object
|
return: ?object
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note right of Grep::existsRemotely
|
note left of Grep::existsRemotely
|
||||||
Check if item exists remotely
|
Check if item exists remotely
|
||||||
|
|
||||||
since: 3.2.2
|
since: 3.2.2
|
||||||
return: ?object
|
return: ?object
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note left of Grep::existsLocal
|
note right of Grep::existsLocal
|
||||||
Check if item exists locally
|
Check if item exists locally
|
||||||
|
|
||||||
since: 3.2.2
|
since: 3.2.2
|
||||||
return: bool
|
return: bool
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note right of Grep::existsRemote
|
note left of Grep::existsRemote
|
||||||
Check if item exists remotely
|
Check if item exists remotely
|
||||||
|
|
||||||
since: 3.2.2
|
since: 3.2.2
|
||||||
return: bool
|
return: bool
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note left of Grep::indexRemote
|
note right of Grep::indexRemote
|
||||||
Load the remote repository index of powers
|
Load the remote repository index of powers
|
||||||
|
|
||||||
since: 3.2.0
|
since: 3.2.0
|
||||||
return: void
|
return: void
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note right of Grep::indexLocal
|
note left of Grep::indexLocal
|
||||||
Load the local repository index of powers
|
Load the local repository index of powers
|
||||||
|
|
||||||
since: 3.2.0
|
since: 3.2.0
|
||||||
return: void
|
return: void
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note left of Grep::initializeInstances
|
note right of Grep::initializeInstances
|
||||||
Set path details
|
Set path details
|
||||||
|
|
||||||
since: 3.2.0
|
since: 3.2.0
|
||||||
return: void
|
return: void
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note right of Grep::loadRemoteFile
|
note left of Grep::loadRemoteFile
|
||||||
Load the remote file
|
Load the remote file
|
||||||
|
|
||||||
since: 3.2.0
|
since: 3.2.0
|
||||||
|
@ -17,6 +17,8 @@ use Joomla\CMS\Language\Text;
|
|||||||
use Joomla\CMS\Filesystem\Folder;
|
use Joomla\CMS\Filesystem\Folder;
|
||||||
use Joomla\CMS\Application\CMSApplication;
|
use Joomla\CMS\Application\CMSApplication;
|
||||||
use VDM\Joomla\Gitea\Repository\Contents;
|
use VDM\Joomla\Gitea\Repository\Contents;
|
||||||
|
use VDM\Joomla\Interfaces\Git\ApiInterface as Api;
|
||||||
|
use VDM\Joomla\Componentbuilder\Network\Resolve;
|
||||||
use VDM\Joomla\Utilities\FileHelper;
|
use VDM\Joomla\Utilities\FileHelper;
|
||||||
use VDM\Joomla\Utilities\JsonHelper;
|
use VDM\Joomla\Utilities\JsonHelper;
|
||||||
use VDM\Joomla\Interfaces\GrepInterface;
|
use VDM\Joomla\Interfaces\GrepInterface;
|
||||||
@ -50,6 +52,14 @@ abstract class Grep implements GrepInterface
|
|||||||
**/
|
**/
|
||||||
public ?array $paths;
|
public ?array $paths;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Grep target [network]
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 5.0.4
|
||||||
|
**/
|
||||||
|
protected ?string $target = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Order of global search
|
* Order of global search
|
||||||
*
|
*
|
||||||
@ -82,6 +92,14 @@ abstract class Grep implements GrepInterface
|
|||||||
*/
|
*/
|
||||||
protected string $index_path = 'index.json';
|
protected string $index_path = 'index.json';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The VDM global API base
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 5.0.4
|
||||||
|
**/
|
||||||
|
protected string $api_base = '//git.vdm.dev/';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gitea Repository Contents
|
* Gitea Repository Contents
|
||||||
*
|
*
|
||||||
@ -90,6 +108,14 @@ abstract class Grep implements GrepInterface
|
|||||||
**/
|
**/
|
||||||
protected Contents $contents;
|
protected Contents $contents;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Resolve Class.
|
||||||
|
*
|
||||||
|
* @var Resolve
|
||||||
|
* @since 5.0.4
|
||||||
|
*/
|
||||||
|
protected Resolve $resolve;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Joomla Application object
|
* Joomla Application object
|
||||||
*
|
*
|
||||||
@ -102,6 +128,7 @@ abstract class Grep implements GrepInterface
|
|||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param Contents $contents The Gitea Repository Contents object.
|
* @param Contents $contents The Gitea Repository Contents object.
|
||||||
|
* @param Resolve $resolve The Resolve Class.
|
||||||
* @param array $paths The approved paths
|
* @param array $paths The approved paths
|
||||||
* @param string|null $path The local path
|
* @param string|null $path The local path
|
||||||
* @param CMSApplication|null $app The CMS Application object.
|
* @param CMSApplication|null $app The CMS Application object.
|
||||||
@ -109,9 +136,13 @@ abstract class Grep implements GrepInterface
|
|||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
*/
|
*/
|
||||||
public function __construct(Contents $contents, array $paths, ?string $path = null, ?CMSApplication $app = null)
|
public function __construct(
|
||||||
|
Contents $contents, Resolve $resolve,
|
||||||
|
array $paths, ?string $path = null,
|
||||||
|
?CMSApplication $app = null)
|
||||||
{
|
{
|
||||||
$this->contents = $contents;
|
$this->contents = $contents;
|
||||||
|
$this->resolve = $resolve;
|
||||||
$this->paths = $paths;
|
$this->paths = $paths;
|
||||||
$this->path = $path;
|
$this->path = $path;
|
||||||
$this->app = $app ?: Factory::getApplication();
|
$this->app = $app ?: Factory::getApplication();
|
||||||
@ -264,6 +295,38 @@ abstract class Grep implements GrepInterface
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads API config using the provided base URL and token.
|
||||||
|
*
|
||||||
|
* This method checks if the base URL contains 'https://git.vdm.dev/'.
|
||||||
|
* If it does, it uses the token as is (which may be null).
|
||||||
|
* If not, it ensures the token is not null by defaulting to an empty string.
|
||||||
|
*
|
||||||
|
* @param Api $api The api object with a load_ method.
|
||||||
|
* @param string|null $base The base URL path.
|
||||||
|
* @param string|null $token The token for authentication (can be null).
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 5.0.4
|
||||||
|
*/
|
||||||
|
public function loadApi(Api $api, ?string $base, ?string $token): void
|
||||||
|
{
|
||||||
|
// Determine the token to use based on the base URL
|
||||||
|
if ($base && strpos($base, $this->api_base) !== false)
|
||||||
|
{
|
||||||
|
// If base contains $this->api_base = https://git.vdm.dev/, use the token as is
|
||||||
|
$tokenToUse = $token;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Otherwise, ensure the token is not null (use empty string if null)
|
||||||
|
$tokenToUse = $token ?? '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load the content with the determined base and token
|
||||||
|
$api->load_($base, $tokenToUse);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set repository messages and errors based on given conditions.
|
* Set repository messages and errors based on given conditions.
|
||||||
*
|
*
|
||||||
@ -584,7 +647,7 @@ abstract class Grep implements GrepInterface
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
// load the base and token if set
|
// load the base and token if set
|
||||||
$this->contents->load_($path->base ?? null, $path->token ?? null);
|
$this->loadApi($this->contents, $path->base ?? null, $path->token ?? null);
|
||||||
$path->index = $this->contents->get($path->organisation, $path->repository, $this->getIndexPath(), $this->getBranchName($path));
|
$path->index = $this->contents->get($path->organisation, $path->repository, $this->getIndexPath(), $this->getBranchName($path));
|
||||||
}
|
}
|
||||||
catch (\Exception $e)
|
catch (\Exception $e)
|
||||||
@ -640,6 +703,12 @@ abstract class Grep implements GrepInterface
|
|||||||
if (isset($path->organisation) && strlen($path->organisation) > 1 &&
|
if (isset($path->organisation) && strlen($path->organisation) > 1 &&
|
||||||
isset($path->repository) && strlen($path->repository) > 1)
|
isset($path->repository) && strlen($path->repository) > 1)
|
||||||
{
|
{
|
||||||
|
// resolve API if needed
|
||||||
|
if (!empty($path->base))
|
||||||
|
{
|
||||||
|
$this->resolve->api($this->target ?? $path->repository, $path->base, $path->organisation, $path->repository);
|
||||||
|
}
|
||||||
|
|
||||||
// build the path
|
// build the path
|
||||||
$path->path = trim($path->organisation) . '/' . trim($path->repository);
|
$path->path = trim($path->organisation) . '/' . trim($path->repository);
|
||||||
|
|
||||||
|
@ -14,6 +14,14 @@
|
|||||||
**/
|
**/
|
||||||
public ?array $paths;
|
public ?array $paths;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Grep target [network]
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 5.0.4
|
||||||
|
**/
|
||||||
|
protected ?string $target = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Order of global search
|
* Order of global search
|
||||||
*
|
*
|
||||||
@ -46,6 +54,14 @@
|
|||||||
*/
|
*/
|
||||||
protected string $index_path = 'index.json';
|
protected string $index_path = 'index.json';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The VDM global API base
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 5.0.4
|
||||||
|
**/
|
||||||
|
protected string $api_base = '//git.vdm.dev/';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gitea Repository Contents
|
* Gitea Repository Contents
|
||||||
*
|
*
|
||||||
@ -54,6 +70,14 @@
|
|||||||
**/
|
**/
|
||||||
protected Contents $contents;
|
protected Contents $contents;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Resolve Class.
|
||||||
|
*
|
||||||
|
* @var Resolve
|
||||||
|
* @since 5.0.4
|
||||||
|
*/
|
||||||
|
protected Resolve $resolve;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Joomla Application object
|
* Joomla Application object
|
||||||
*
|
*
|
||||||
@ -66,6 +90,7 @@
|
|||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
* @param Contents $contents The Gitea Repository Contents object.
|
* @param Contents $contents The Gitea Repository Contents object.
|
||||||
|
* @param Resolve $resolve The Resolve Class.
|
||||||
* @param array $paths The approved paths
|
* @param array $paths The approved paths
|
||||||
* @param string|null $path The local path
|
* @param string|null $path The local path
|
||||||
* @param CMSApplication|null $app The CMS Application object.
|
* @param CMSApplication|null $app The CMS Application object.
|
||||||
@ -73,9 +98,13 @@
|
|||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
*/
|
*/
|
||||||
public function __construct(Contents $contents, array $paths, ?string $path = null, ?CMSApplication $app = null)
|
public function __construct(
|
||||||
|
Contents $contents, Resolve $resolve,
|
||||||
|
array $paths, ?string $path = null,
|
||||||
|
?CMSApplication $app = null)
|
||||||
{
|
{
|
||||||
$this->contents = $contents;
|
$this->contents = $contents;
|
||||||
|
$this->resolve = $resolve;
|
||||||
$this->paths = $paths;
|
$this->paths = $paths;
|
||||||
$this->path = $path;
|
$this->path = $path;
|
||||||
$this->app = $app ?: Factory::getApplication();
|
$this->app = $app ?: Factory::getApplication();
|
||||||
@ -228,6 +257,38 @@
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads API config using the provided base URL and token.
|
||||||
|
*
|
||||||
|
* This method checks if the base URL contains 'https://git.vdm.dev/'.
|
||||||
|
* If it does, it uses the token as is (which may be null).
|
||||||
|
* If not, it ensures the token is not null by defaulting to an empty string.
|
||||||
|
*
|
||||||
|
* @param Api $api The api object with a load_ method.
|
||||||
|
* @param string|null $base The base URL path.
|
||||||
|
* @param string|null $token The token for authentication (can be null).
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 5.0.4
|
||||||
|
*/
|
||||||
|
public function loadApi(Api $api, ?string $base, ?string $token): void
|
||||||
|
{
|
||||||
|
// Determine the token to use based on the base URL
|
||||||
|
if ($base && strpos($base, $this->api_base) !== false)
|
||||||
|
{
|
||||||
|
// If base contains $this->api_base = https://git.vdm.dev/, use the token as is
|
||||||
|
$tokenToUse = $token;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Otherwise, ensure the token is not null (use empty string if null)
|
||||||
|
$tokenToUse = $token ?? '';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load the content with the determined base and token
|
||||||
|
$api->load_($base, $tokenToUse);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set repository messages and errors based on given conditions.
|
* Set repository messages and errors based on given conditions.
|
||||||
*
|
*
|
||||||
@ -548,7 +609,7 @@
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
// load the base and token if set
|
// load the base and token if set
|
||||||
$this->contents->load_($path->base ?? null, $path->token ?? null);
|
$this->loadApi($this->contents, $path->base ?? null, $path->token ?? null);
|
||||||
$path->index = $this->contents->get($path->organisation, $path->repository, $this->getIndexPath(), $this->getBranchName($path));
|
$path->index = $this->contents->get($path->organisation, $path->repository, $this->getIndexPath(), $this->getBranchName($path));
|
||||||
}
|
}
|
||||||
catch (\Exception $e)
|
catch (\Exception $e)
|
||||||
@ -604,6 +665,12 @@
|
|||||||
if (isset($path->organisation) && strlen($path->organisation) > 1 &&
|
if (isset($path->organisation) && strlen($path->organisation) > 1 &&
|
||||||
isset($path->repository) && strlen($path->repository) > 1)
|
isset($path->repository) && strlen($path->repository) > 1)
|
||||||
{
|
{
|
||||||
|
// resolve API if needed
|
||||||
|
if (!empty($path->base))
|
||||||
|
{
|
||||||
|
$this->resolve->api($this->target ?? $path->repository, $path->base, $path->organisation, $path->repository);
|
||||||
|
}
|
||||||
|
|
||||||
// build the path
|
// build the path
|
||||||
$path->path = trim($path->organisation) . '/' . trim($path->repository);
|
$path->path = trim($path->organisation) . '/' . trim($path->repository);
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"add_head": "1",
|
"add_head": 1,
|
||||||
"add_licensing_template": "2",
|
"add_licensing_template": 2,
|
||||||
"extends": "",
|
"extends": "",
|
||||||
"guid": "1401a167-0ce4-4f4a-afee-2d8b02ed339b",
|
"guid": "1401a167-0ce4-4f4a-afee-2d8b02ed339b",
|
||||||
"implements": [
|
"implements": [
|
||||||
@ -17,10 +17,18 @@
|
|||||||
"as": "default"
|
"as": "default"
|
||||||
},
|
},
|
||||||
"use_selection1": {
|
"use_selection1": {
|
||||||
|
"use": "17ed2fec-49d6-4731-92c3-f9cd78fb6273",
|
||||||
|
"as": "Api"
|
||||||
|
},
|
||||||
|
"use_selection2": {
|
||||||
|
"use": "a0c143af-3d7d-4c19-91c4-f72060b4c361",
|
||||||
|
"as": "default"
|
||||||
|
},
|
||||||
|
"use_selection3": {
|
||||||
"use": "a223b31e-ea1d-4cdf-92ae-5f9becffaff0",
|
"use": "a223b31e-ea1d-4cdf-92ae-5f9becffaff0",
|
||||||
"as": "default"
|
"as": "default"
|
||||||
},
|
},
|
||||||
"use_selection2": {
|
"use_selection4": {
|
||||||
"use": "4b225c51-d293-48e4-b3f6-5136cf5c3f18",
|
"use": "4b225c51-d293-48e4-b3f6-5136cf5c3f18",
|
||||||
"as": "default"
|
"as": "default"
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"add_head": "0",
|
"add_head": 0,
|
||||||
"add_licensing_template": "2",
|
"add_licensing_template": 2,
|
||||||
"extends": "",
|
"extends": "",
|
||||||
"guid": "152c8793-8b75-4715-996a-257b9f65451c",
|
"guid": "152c8793-8b75-4715-996a-257b9f65451c",
|
||||||
"implements": null,
|
"implements": null,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"add_head": "0",
|
"add_head": 0,
|
||||||
"add_licensing_template": "2",
|
"add_licensing_template": 2,
|
||||||
"extends": "",
|
"extends": "",
|
||||||
"guid": "17ed2fec-49d6-4731-92c3-f9cd78fb6273",
|
"guid": "17ed2fec-49d6-4731-92c3-f9cd78fb6273",
|
||||||
"implements": null,
|
"implements": null,
|
||||||
|
72
src/19a66b48-620c-439b-ab8a-3c0d43e040c3/README.md
Normal file
72
src/19a66b48-620c-439b-ab8a-3c0d43e040c3/README.md
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
```
|
||||||
|
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||||
|
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||||
|
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||||
|
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||||
|
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||||
|
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||||
|
```
|
||||||
|
# final class Assessor (Details)
|
||||||
|
> namespace: **VDM\Joomla\Componentbuilder\Import**
|
||||||
|
|
||||||
|
```uml
|
||||||
|
@startuml
|
||||||
|
class Assessor << (F,LightGreen) >> #RoyalBlue {
|
||||||
|
# Data $data
|
||||||
|
# Status $status
|
||||||
|
# Message $message
|
||||||
|
+ __construct(Data $data, Status $status, ...)
|
||||||
|
+ evaluate(int $rowCounter, int $successCounter, ...) : void
|
||||||
|
}
|
||||||
|
|
||||||
|
note right of Assessor::__construct
|
||||||
|
Constructor.
|
||||||
|
|
||||||
|
since: 4.0.3
|
||||||
|
|
||||||
|
arguments:
|
||||||
|
Data $data
|
||||||
|
Status $status
|
||||||
|
Message $message
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Assessor::evaluate
|
||||||
|
Evaluates the import process and sets the success/error message based on the success rate.
|
||||||
|
|
||||||
|
since: 4.0.3
|
||||||
|
return: void
|
||||||
|
|
||||||
|
arguments:
|
||||||
|
int $rowCounter
|
||||||
|
int $successCounter
|
||||||
|
int $errorCounter
|
||||||
|
end note
|
||||||
|
|
||||||
|
@enduml
|
||||||
|
```
|
||||||
|
|
||||||
|
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
|
||||||
|
|
||||||
|
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
|
||||||
|
|
||||||
|
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
|
||||||
|
|
||||||
|
To add this specific Power to your project in JCB:
|
||||||
|
|
||||||
|
> simply use this SPK
|
||||||
|
```
|
||||||
|
Super---19a66b48_620c_439b_ab8a_3c0d43e040c3---Power
|
||||||
|
```
|
||||||
|
> remember to replace the `---` with `___` to activate this Power in your code
|
||||||
|
|
||||||
|
---
|
||||||
|
```
|
||||||
|
██╗ ██████╗██████╗
|
||||||
|
██║██╔════╝██╔══██╗
|
||||||
|
██║██║ ██████╔╝
|
||||||
|
██ ██║██║ ██╔══██╗
|
||||||
|
╚█████╔╝╚██████╗██████╔╝
|
||||||
|
╚════╝ ╚═════╝╚═════╝
|
||||||
|
```
|
||||||
|
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||||
|
|
130
src/19a66b48-620c-439b-ab8a-3c0d43e040c3/code.php
Normal file
130
src/19a66b48-620c-439b-ab8a-3c0d43e040c3/code.php
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Component.Builder
|
||||||
|
*
|
||||||
|
* @created 4th September, 2022
|
||||||
|
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||||
|
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||||
|
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace VDM\Joomla\Componentbuilder\Import;
|
||||||
|
|
||||||
|
|
||||||
|
use Joomla\CMS\Language\Text;
|
||||||
|
use VDM\Joomla\Componentbuilder\Import\Data;
|
||||||
|
use VDM\Joomla\Componentbuilder\Interfaces\ImportStatusInterface as Status;
|
||||||
|
use VDM\Joomla\Componentbuilder\Interfaces\ImportMessageInterface as Message;
|
||||||
|
use VDM\Joomla\Componentbuilder\Interfaces\ImportAssessorInterface;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Import Assessor Class
|
||||||
|
*
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
final class Assessor implements ImportAssessorInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The Data Class.
|
||||||
|
*
|
||||||
|
* @var Data
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
protected Data $data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Import Status Class.
|
||||||
|
*
|
||||||
|
* @var Status
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
protected Status $status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Import Message Class.
|
||||||
|
*
|
||||||
|
* @var Message
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
protected Message $message;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constants for defining the success threshold
|
||||||
|
* Minimum success rate to consider the import successful
|
||||||
|
*
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
private const SUCCESS_THRESHOLD = 0.80;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param Data $data The Data Class.
|
||||||
|
* @param Status $status The Import Status Class.
|
||||||
|
* @param Message $message The Import Message Class.
|
||||||
|
*
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
public function __construct(Data $data, Status $status, Message $message)
|
||||||
|
{
|
||||||
|
$this->data = $data;
|
||||||
|
$this->status = $status;
|
||||||
|
$this->message = $message;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Evaluates the import process and sets the success/error message based on the success rate.
|
||||||
|
*
|
||||||
|
* @param int $rowCounter Total number of rows processed.
|
||||||
|
* @param int $successCounter Number of successfully processed rows.
|
||||||
|
* @param int $errorCounter Number of rows that failed to process.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
public function evaluate(int $rowCounter, int $successCounter, int $errorCounter): void
|
||||||
|
{
|
||||||
|
// No rows processed case
|
||||||
|
if ($rowCounter === 0)
|
||||||
|
{
|
||||||
|
$this->message->addError(Text::_('COM_COMPONENTBUILDER_NO_ROWS_WERE_PROCESSED'));
|
||||||
|
|
||||||
|
if (($guid = $this->data->get('import.guid')) !== null)
|
||||||
|
{
|
||||||
|
$this->status->set(4, $guid); // Status 4 => completed with errors
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$successRate = $successCounter / $rowCounter;
|
||||||
|
$errorRate = (1 - $successRate) * 100;
|
||||||
|
$successPercentage = $successRate * 100;
|
||||||
|
|
||||||
|
// Determine appropriate message based on success rate
|
||||||
|
if ($successRate >= self::SUCCESS_THRESHOLD)
|
||||||
|
{
|
||||||
|
$this->message->addSuccess(Text::sprintf('COM_COMPONENTBUILDER_D_ROWS_PROCESSED_SUCCESS_RATE_TWOF_IMPORT_SUCCESSFUL',
|
||||||
|
$rowCounter,
|
||||||
|
$successPercentage
|
||||||
|
));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->message->addError(Text::sprintf('COM_COMPONENTBUILDER_IMPORT_FAILED_D_ROWS_PROCESSED_WITH_ONLY_D_SUCCESSES_ERROR_RATE_TWOF',
|
||||||
|
$rowCounter,
|
||||||
|
$successCounter,
|
||||||
|
$errorRate
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (($guid = $this->data->get('import.guid')) !== null)
|
||||||
|
{
|
||||||
|
// Update import status based on success rate
|
||||||
|
$importStatus = ($successPercentage == 100) ? 3 : 4; // 3 => completed, 4 => completed with errors
|
||||||
|
$this->status->set($importStatus, $guid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
100
src/19a66b48-620c-439b-ab8a-3c0d43e040c3/code.power
Normal file
100
src/19a66b48-620c-439b-ab8a-3c0d43e040c3/code.power
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
/**
|
||||||
|
* The Data Class.
|
||||||
|
*
|
||||||
|
* @var Data
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
protected Data $data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Import Status Class.
|
||||||
|
*
|
||||||
|
* @var Status
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
protected Status $status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Import Message Class.
|
||||||
|
*
|
||||||
|
* @var Message
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
protected Message $message;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constants for defining the success threshold
|
||||||
|
* Minimum success rate to consider the import successful
|
||||||
|
*
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
private const SUCCESS_THRESHOLD = 0.80;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param Data $data The Data Class.
|
||||||
|
* @param Status $status The Import Status Class.
|
||||||
|
* @param Message $message The Import Message Class.
|
||||||
|
*
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
public function __construct(Data $data, Status $status, Message $message)
|
||||||
|
{
|
||||||
|
$this->data = $data;
|
||||||
|
$this->status = $status;
|
||||||
|
$this->message = $message;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Evaluates the import process and sets the success/error message based on the success rate.
|
||||||
|
*
|
||||||
|
* @param int $rowCounter Total number of rows processed.
|
||||||
|
* @param int $successCounter Number of successfully processed rows.
|
||||||
|
* @param int $errorCounter Number of rows that failed to process.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
public function evaluate(int $rowCounter, int $successCounter, int $errorCounter): void
|
||||||
|
{
|
||||||
|
// No rows processed case
|
||||||
|
if ($rowCounter === 0)
|
||||||
|
{
|
||||||
|
$this->message->addError(Text::_('No rows were processed.'));
|
||||||
|
|
||||||
|
if (($guid = $this->data->get('import.guid')) !== null)
|
||||||
|
{
|
||||||
|
$this->status->set(4, $guid); // Status 4 => completed with errors
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$successRate = $successCounter / $rowCounter;
|
||||||
|
$errorRate = (1 - $successRate) * 100;
|
||||||
|
$successPercentage = $successRate * 100;
|
||||||
|
|
||||||
|
// Determine appropriate message based on success rate
|
||||||
|
if ($successRate >= self::SUCCESS_THRESHOLD)
|
||||||
|
{
|
||||||
|
$this->message->addSuccess(Text::sprintf('%d rows processed. Success rate: %.2f%%. Import successful!',
|
||||||
|
$rowCounter,
|
||||||
|
$successPercentage
|
||||||
|
));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->message->addError(Text::sprintf('Import failed. %d rows processed with only %d successes. Error rate: %.2f%%.',
|
||||||
|
$rowCounter,
|
||||||
|
$successCounter,
|
||||||
|
$errorRate
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (($guid = $this->data->get('import.guid')) !== null)
|
||||||
|
{
|
||||||
|
// Update import status based on success rate
|
||||||
|
$importStatus = ($successPercentage == 100) ? 3 : 4; // 3 => completed, 4 => completed with errors
|
||||||
|
$this->status->set($importStatus, $guid);
|
||||||
|
}
|
||||||
|
}
|
34
src/19a66b48-620c-439b-ab8a-3c0d43e040c3/settings.json
Normal file
34
src/19a66b48-620c-439b-ab8a-3c0d43e040c3/settings.json
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
"add_head": 1,
|
||||||
|
"add_licensing_template": 2,
|
||||||
|
"extends": "",
|
||||||
|
"guid": "19a66b48-620c-439b-ab8a-3c0d43e040c3",
|
||||||
|
"implements": [
|
||||||
|
"57c00d53-5581-4fd1-b3ea-080422710243"
|
||||||
|
],
|
||||||
|
"load_selection": null,
|
||||||
|
"name": "Assessor",
|
||||||
|
"power_version": "1.0.0",
|
||||||
|
"system_name": "JCB.Import.Assessor",
|
||||||
|
"type": "final class",
|
||||||
|
"use_selection": {
|
||||||
|
"use_selection0": {
|
||||||
|
"use": "05f23281-58e3-482e-be42-2dc1355ef4ea",
|
||||||
|
"as": "default"
|
||||||
|
},
|
||||||
|
"use_selection1": {
|
||||||
|
"use": "0e44d149-4863-47ec-8f0f-6a821ab3e77f",
|
||||||
|
"as": "Status"
|
||||||
|
},
|
||||||
|
"use_selection2": {
|
||||||
|
"use": "23ad6e72-1b82-40fb-836c-50da690bb174",
|
||||||
|
"as": "Message"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"extendsinterfaces": null,
|
||||||
|
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Import.Assessor",
|
||||||
|
"description": "Import Assessor Class\r\n\r\n@since 4.0.3",
|
||||||
|
"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\\Language\\Text;",
|
||||||
|
"composer": ""
|
||||||
|
}
|
@ -15,6 +15,7 @@ class Table #Gold {
|
|||||||
+ register(Container $container) : void
|
+ register(Container $container) : void
|
||||||
+ getTable(Container $container) : DataTable
|
+ getTable(Container $container) : DataTable
|
||||||
+ getSchema(Container $container) : Schema
|
+ getSchema(Container $container) : Schema
|
||||||
|
+ getValidator(Container $container) : Validator
|
||||||
}
|
}
|
||||||
|
|
||||||
note right of Table::register
|
note right of Table::register
|
||||||
@ -38,6 +39,13 @@ note right of Table::getSchema
|
|||||||
return: Schema
|
return: Schema
|
||||||
end note
|
end note
|
||||||
|
|
||||||
|
note right of Table::getValidator
|
||||||
|
Get The Validator Class.
|
||||||
|
|
||||||
|
since: 3.2.2
|
||||||
|
return: Validator
|
||||||
|
end note
|
||||||
|
|
||||||
@enduml
|
@enduml
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ use Joomla\DI\Container;
|
|||||||
use Joomla\DI\ServiceProviderInterface;
|
use Joomla\DI\ServiceProviderInterface;
|
||||||
use VDM\Joomla\Componentbuilder\Table as DataTable;
|
use VDM\Joomla\Componentbuilder\Table as DataTable;
|
||||||
use VDM\Joomla\Componentbuilder\Table\Schema;
|
use VDM\Joomla\Componentbuilder\Table\Schema;
|
||||||
|
use VDM\Joomla\Componentbuilder\Table\Validator;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -40,6 +41,9 @@ class Table implements ServiceProviderInterface
|
|||||||
|
|
||||||
$container->alias(Schema::class, 'Table.Schema')
|
$container->alias(Schema::class, 'Table.Schema')
|
||||||
->share('Table.Schema', [$this, 'getSchema'], true);
|
->share('Table.Schema', [$this, 'getSchema'], true);
|
||||||
|
|
||||||
|
$container->alias(Validator::class, 'Table.Validator')
|
||||||
|
->share('Table.Validator', [$this, 'getValidator'], true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -69,5 +73,20 @@ class Table implements ServiceProviderInterface
|
|||||||
$container->get('Table')
|
$container->get('Table')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get The Validator Class.
|
||||||
|
*
|
||||||
|
* @param Container $container The DI container.
|
||||||
|
*
|
||||||
|
* @return Validator
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function getValidator(Container $container): Validator
|
||||||
|
{
|
||||||
|
return new Validator(
|
||||||
|
$container->get('Table')
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,9 @@
|
|||||||
|
|
||||||
$container->alias(Schema::class, 'Table.Schema')
|
$container->alias(Schema::class, 'Table.Schema')
|
||||||
->share('Table.Schema', [$this, 'getSchema'], true);
|
->share('Table.Schema', [$this, 'getSchema'], true);
|
||||||
|
|
||||||
|
$container->alias(Validator::class, 'Table.Validator')
|
||||||
|
->share('Table.Validator', [$this, 'getValidator'], true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -42,3 +45,18 @@
|
|||||||
$container->get('Table')
|
$container->get('Table')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get The Validator Class.
|
||||||
|
*
|
||||||
|
* @param Container $container The DI container.
|
||||||
|
*
|
||||||
|
* @return Validator
|
||||||
|
* @since 3.2.2
|
||||||
|
*/
|
||||||
|
public function getValidator(Container $container): Validator
|
||||||
|
{
|
||||||
|
return new Validator(
|
||||||
|
$container->get('Table')
|
||||||
|
);
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"add_head": "1",
|
"add_head": 1,
|
||||||
"add_licensing_template": "2",
|
"add_licensing_template": 2,
|
||||||
"extends": "",
|
"extends": "",
|
||||||
"guid": "19b2ba92-1655-4384-acfb-979c80de8b6d",
|
"guid": "19b2ba92-1655-4384-acfb-979c80de8b6d",
|
||||||
"implements": [
|
"implements": [
|
||||||
@ -19,6 +19,10 @@
|
|||||||
"use_selection1": {
|
"use_selection1": {
|
||||||
"use": "b3d2ec33-76d4-4c3b-bb2c-86ac14a221ce",
|
"use": "b3d2ec33-76d4-4c3b-bb2c-86ac14a221ce",
|
||||||
"as": "default"
|
"as": "default"
|
||||||
|
},
|
||||||
|
"use_selection2": {
|
||||||
|
"use": "79fd4f39-824d-4ab6-936d-959705ff24ec",
|
||||||
|
"as": "default"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"extendsinterfaces": null,
|
"extendsinterfaces": null,
|
||||||
|
45
src/1c10a5f1-204d-4f17-ad9f-0e0684f2030d/README.md
Normal file
45
src/1c10a5f1-204d-4f17-ad9f-0e0684f2030d/README.md
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
```
|
||||||
|
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||||
|
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||||
|
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||||
|
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||||
|
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||||
|
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||||
|
```
|
||||||
|
# class NoUserIdFoundException (Details)
|
||||||
|
> namespace: **VDM\Joomla\Componentbuilder\Utilities\Exception**
|
||||||
|
> extends: **\InvalidArgumentException**
|
||||||
|
|
||||||
|
```uml
|
||||||
|
@startuml
|
||||||
|
class NoUserIdFoundException #Gold {
|
||||||
|
}
|
||||||
|
|
||||||
|
@enduml
|
||||||
|
```
|
||||||
|
|
||||||
|
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
|
||||||
|
|
||||||
|
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
|
||||||
|
|
||||||
|
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
|
||||||
|
|
||||||
|
To add this specific Power to your project in JCB:
|
||||||
|
|
||||||
|
> simply use this SPK
|
||||||
|
```
|
||||||
|
Super---1c10a5f1_204d_4f17_ad9f_0e0684f2030d---Power
|
||||||
|
```
|
||||||
|
> remember to replace the `---` with `___` to activate this Power in your code
|
||||||
|
|
||||||
|
---
|
||||||
|
```
|
||||||
|
██╗ ██████╗██████╗
|
||||||
|
██║██╔════╝██╔══██╗
|
||||||
|
██║██║ ██████╔╝
|
||||||
|
██ ██║██║ ██╔══██╗
|
||||||
|
╚█████╔╝╚██████╗██████╔╝
|
||||||
|
╚════╝ ╚═════╝╚═════╝
|
||||||
|
```
|
||||||
|
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||||
|
|
23
src/1c10a5f1-204d-4f17-ad9f-0e0684f2030d/code.php
Normal file
23
src/1c10a5f1-204d-4f17-ad9f-0e0684f2030d/code.php
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Component.Builder
|
||||||
|
*
|
||||||
|
* @created 4th September, 2020
|
||||||
|
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||||
|
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||||
|
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||||
|
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace VDM\Joomla\Componentbuilder\Utilities\Exception;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* No User Id Found Exception
|
||||||
|
*
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
class NoUserIdFoundException extends \InvalidArgumentException
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
0
src/1c10a5f1-204d-4f17-ad9f-0e0684f2030d/code.power
Normal file
0
src/1c10a5f1-204d-4f17-ad9f-0e0684f2030d/code.power
Normal file
20
src/1c10a5f1-204d-4f17-ad9f-0e0684f2030d/settings.json
Normal file
20
src/1c10a5f1-204d-4f17-ad9f-0e0684f2030d/settings.json
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"add_head": 0,
|
||||||
|
"add_licensing_template": 2,
|
||||||
|
"extends": "-1",
|
||||||
|
"guid": "1c10a5f1-204d-4f17-ad9f-0e0684f2030d",
|
||||||
|
"implements": null,
|
||||||
|
"load_selection": null,
|
||||||
|
"name": "NoUserIdFoundException",
|
||||||
|
"power_version": "1.0.0",
|
||||||
|
"system_name": "Joomla.Utilities.Exception.NoUserIdFoundException",
|
||||||
|
"type": "class",
|
||||||
|
"use_selection": null,
|
||||||
|
"extendsinterfaces": null,
|
||||||
|
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Utilities.Exception.NoUserIdFoundException",
|
||||||
|
"description": "No User Id Found Exception\r\n\r\n@since 5.0.2",
|
||||||
|
"extends_custom": "\\InvalidArgumentException",
|
||||||
|
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2020\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": ""
|
||||||
|
}
|
@ -13,70 +13,100 @@
|
|||||||
@startuml
|
@startuml
|
||||||
abstract StringHelper #Orange {
|
abstract StringHelper #Orange {
|
||||||
+ static $langTag
|
+ static $langTag
|
||||||
+ {static} check($string) : bool
|
+ {static} check(mixed $input) : bool
|
||||||
+ {static} shorten($string, $length = 40, ...)
|
+ {static} shorten(mixed $string, int $length = 40, ...) : string|mixed
|
||||||
+ {static} safe($string, $type = 'L', ...)
|
+ {static} safe(string $string, string $type = 'L', ...) : string
|
||||||
+ {static} transliterate($string)
|
+ {static} transliterate($string) : string
|
||||||
+ {static} html($var, $charset = 'UTF-8', ...)
|
+ {static} html(string $var, string $charset = 'UTF-8', ...) : string
|
||||||
+ {static} numbers($string)
|
+ {static} numbers($string) : ?string
|
||||||
+ {static} number($x)
|
+ {static} number($x)
|
||||||
+ {static} random(int $size) : string
|
+ {static} random(int $size) : string
|
||||||
}
|
}
|
||||||
|
|
||||||
note right of StringHelper::check
|
note right of StringHelper::check
|
||||||
Check if we have a string with a length
|
Validate that input is a non-empty, non-whitespace-only string.
|
||||||
|
|
||||||
since: 3.0.9
|
since: 3.0.9
|
||||||
return: bool
|
return: bool
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note left of StringHelper::shorten
|
note left of StringHelper::shorten
|
||||||
Shorten a string
|
Shortens a string to a specified length, optionally adding a tooltip with the full text.
|
||||||
|
This method safely shortens the input string without cutting words abruptly. If the string
|
||||||
|
exceeds the specified length, ellipses (...) are added. Optionally, a tooltip containing the
|
||||||
|
longer original string can be included.
|
||||||
|
|
||||||
since: 3.2.0
|
since: 3.2.1
|
||||||
|
return: string|mixed
|
||||||
|
|
||||||
arguments:
|
arguments:
|
||||||
$string
|
mixed $string
|
||||||
$length = 40
|
int $length = 40
|
||||||
$addTip = true
|
bool $addTip = true
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note right of StringHelper::safe
|
note right of StringHelper::safe
|
||||||
Making strings safe (various ways)
|
Makes a string safe by sanitizing and formatting it according to the specified type.
|
||||||
|
This method can remove unwanted characters, transliterate text, replace numbers with
|
||||||
|
their English equivalents, and apply different case formatting styles.
|
||||||
|
- 'filename' : Removes special characters and extra spaces.
|
||||||
|
- 'L' : Converts to lowercase with underscores replacing spaces.
|
||||||
|
- 'strtolower': Alias for 'L'.
|
||||||
|
- 'W' : Capitalizes the first letter of each word.
|
||||||
|
- 'w' : Converts to lowercase (spaces remain).
|
||||||
|
- 'word' : Alias for 'w'.
|
||||||
|
- 'Ww' : Capitalizes only the first word.
|
||||||
|
- 'Word' : Alias for 'Ww'.
|
||||||
|
- 'WW' : Converts the entire string to uppercase.
|
||||||
|
- 'WORD' : Alias for 'WW'.
|
||||||
|
- 'U' : Converts to uppercase with underscores replacing spaces.
|
||||||
|
- 'strtoupper': Alias for 'U'.
|
||||||
|
- 'F' : Capitalizes only the first letter of the entire string.
|
||||||
|
- 'ucfirst' : Alias for 'F'.
|
||||||
|
- 'cA' : Converts to camelCase.
|
||||||
|
- 'cAmel' : Alias for 'cA'.
|
||||||
|
- 'camelcase' : Alias for 'cA'.
|
||||||
|
|
||||||
since: 3.0.9
|
since: 3.0.9
|
||||||
|
return: string
|
||||||
|
|
||||||
arguments:
|
arguments:
|
||||||
$string
|
string $string
|
||||||
$type = 'L'
|
string $type = 'L'
|
||||||
$spacer = '_'
|
string $spacer = '_'
|
||||||
$replaceNumbers = true
|
bool $replaceNumbers = true
|
||||||
$keepOnlyCharacters = true
|
bool $keepOnlyCharacters = true
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note left of StringHelper::transliterate
|
note left of StringHelper::transliterate
|
||||||
Convert none English strings to code usable string
|
Convert none English strings to code usable string
|
||||||
|
|
||||||
since: 3.0.9
|
since: 3.0.9
|
||||||
|
return: string
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note right of StringHelper::html
|
note right of StringHelper::html
|
||||||
make sure a string is HTML save
|
Ensures a string is safe for HTML output by encoding entities and applying an input filter.
|
||||||
|
This method sanitizes the input string, converting special characters to HTML entities
|
||||||
|
and applying Joomla's `InputFilter` to remove potentially unsafe HTML.
|
||||||
|
Optionally, it can also shorten the string while preserving word integrity.
|
||||||
|
|
||||||
since: 3.0.9
|
since: 3.0.9
|
||||||
|
return: string
|
||||||
|
|
||||||
arguments:
|
arguments:
|
||||||
$var
|
string $var
|
||||||
$charset = 'UTF-8'
|
string $charset = 'UTF-8'
|
||||||
$shorten = false
|
bool $shorten = false
|
||||||
$length = 40
|
int $length = 40
|
||||||
$addTip = true
|
bool $addTip = true
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note left of StringHelper::numbers
|
note left of StringHelper::numbers
|
||||||
Convert all int in a string to an English word string
|
Convert all int in a string to an English word string
|
||||||
|
|
||||||
since: 3.0.9
|
since: 3.0.9
|
||||||
|
return: ?string
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note right of StringHelper::number
|
note right of StringHelper::number
|
||||||
|
@ -12,8 +12,10 @@
|
|||||||
namespace VDM\Joomla\Utilities;
|
namespace VDM\Joomla\Utilities;
|
||||||
|
|
||||||
|
|
||||||
|
use Joomla\CMS\Factory;
|
||||||
use Joomla\Filter\InputFilter;
|
use Joomla\Filter\InputFilter;
|
||||||
use Joomla\CMS\Language\Language;
|
use Joomla\CMS\Language\LanguageFactoryInterface;
|
||||||
|
use Joomla\CMS\Language\LanguageFactory;
|
||||||
use VDM\Joomla\Utilities\Component\Helper;
|
use VDM\Joomla\Utilities\Component\Helper;
|
||||||
|
|
||||||
|
|
||||||
@ -28,87 +30,122 @@ abstract class StringHelper
|
|||||||
* The Main Active Language
|
* The Main Active Language
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*
|
|
||||||
* @since 3.0.9
|
* @since 3.0.9
|
||||||
*/
|
*/
|
||||||
public static $langTag;
|
public static $langTag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if we have a string with a length
|
* Validate that input is a non-empty, non-whitespace-only string.
|
||||||
*
|
*
|
||||||
* @input string $string The string to check
|
* @param mixed $input The input value to validate.
|
||||||
*
|
|
||||||
* @returns bool true on success
|
|
||||||
*
|
*
|
||||||
|
* @returns bool True if input is a non-empty, non-whitespace-only string, otherwise false.
|
||||||
* @since 3.0.9
|
* @since 3.0.9
|
||||||
*/
|
*/
|
||||||
public static function check($string): bool
|
public static function check($input): bool
|
||||||
{
|
{
|
||||||
return is_string($string) && strlen($string) > 0;
|
return is_string($input) && trim($input) !== '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shorten a string
|
* Shortens a string to a specified length, optionally adding a tooltip with the full text.
|
||||||
*
|
*
|
||||||
* @input string The sting that you would like to shorten
|
* This method safely shortens the input string without cutting words abruptly. If the string
|
||||||
|
* exceeds the specified length, ellipses (...) are added. Optionally, a tooltip containing the
|
||||||
|
* longer original string can be included.
|
||||||
*
|
*
|
||||||
* @returns string on success
|
* @param mixed $string The string you would like to shorten.
|
||||||
|
* @param int $length The maximum length for the shortened string. Default is 40.
|
||||||
|
* @param bool $addTip Whether to add a tooltip with the original longer string. Default true.
|
||||||
*
|
*
|
||||||
* @since 3.2.0
|
* @return string|mixed The shortened string, optionally with a tooltip. Or original value passed
|
||||||
|
* @since 3.2.1
|
||||||
*/
|
*/
|
||||||
public static function shorten($string, $length = 40, $addTip = true)
|
public static function shorten($string, int $length = 40, bool $addTip = true)
|
||||||
{
|
{
|
||||||
if (self::check($string))
|
// Validate string input and return original if invalid or short enough.
|
||||||
|
if (!self::check($string) || mb_strlen($string) <= $length)
|
||||||
{
|
{
|
||||||
$initial = strlen((string) $string);
|
|
||||||
$words = preg_split('/([\s\n\r]+)/', (string) $string, -1, PREG_SPLIT_DELIM_CAPTURE);
|
|
||||||
$words_count = count((array)$words);
|
|
||||||
|
|
||||||
$word_length = 0;
|
|
||||||
$last_word = 0;
|
|
||||||
for (; $last_word < $words_count; ++$last_word)
|
|
||||||
{
|
|
||||||
$word_length += strlen($words[$last_word]);
|
|
||||||
if ($word_length > $length)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$newString = implode(array_slice($words, 0, $last_word));
|
|
||||||
$final = strlen($newString);
|
|
||||||
if ($initial !== $final && $addTip)
|
|
||||||
{
|
|
||||||
$title = self::shorten($string, 400 , false);
|
|
||||||
return '<span class="hasTip" title="' . $title . '" style="cursor:help">' . trim($newString) . '...</span>';
|
|
||||||
}
|
|
||||||
elseif ($initial !== $final && !$addTip)
|
|
||||||
{
|
|
||||||
return trim($newString) . '...';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Truncate string to nearest word boundary
|
||||||
|
$shortened = mb_substr($string, 0, $length);
|
||||||
|
|
||||||
|
// Find the last space to avoid cutting off a word
|
||||||
|
$lastSpace = mb_strrpos($shortened, ' ');
|
||||||
|
if ($lastSpace !== false)
|
||||||
|
{
|
||||||
|
$shortened = mb_substr($shortened, 0, $lastSpace);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prepare trimmed and shortened output with ellipses
|
||||||
|
$shortened = trim($shortened) . '...';
|
||||||
|
|
||||||
|
// Add tooltip if requested
|
||||||
|
if ($addTip)
|
||||||
|
{
|
||||||
|
// Safely escape output for HTML
|
||||||
|
$title = self::shorten($string, 400 , false);
|
||||||
|
$escapedTitle = htmlspecialchars($title, ENT_QUOTES, 'UTF-8');
|
||||||
|
$escapedShort = htmlspecialchars($shortened, ENT_QUOTES, 'UTF-8');
|
||||||
|
|
||||||
|
return '<span class="hasTip" title="' . $escapedTitle . '" style="cursor:help">'
|
||||||
|
. $escapedShort
|
||||||
|
. '</span>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return shortened version without tooltip
|
||||||
|
return $shortened;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Making strings safe (various ways)
|
* Makes a string safe by sanitizing and formatting it according to the specified type.
|
||||||
*
|
*
|
||||||
* @input string The you would like to make safe
|
* This method can remove unwanted characters, transliterate text, replace numbers with
|
||||||
|
* their English equivalents, and apply different case formatting styles.
|
||||||
*
|
*
|
||||||
* @returns string on success
|
* @param string $string The string to sanitize and format.
|
||||||
|
* @param string $type The formatting type to apply. Supported values:
|
||||||
|
* - 'filename' : Removes special characters and extra spaces.
|
||||||
|
* - 'L' : Converts to lowercase with underscores replacing spaces.
|
||||||
|
* - 'strtolower': Alias for 'L'.
|
||||||
|
* - 'W' : Capitalizes the first letter of each word.
|
||||||
|
* - 'w' : Converts to lowercase (spaces remain).
|
||||||
|
* - 'word' : Alias for 'w'.
|
||||||
|
* - 'Ww' : Capitalizes only the first word.
|
||||||
|
* - 'Word' : Alias for 'Ww'.
|
||||||
|
* - 'WW' : Converts the entire string to uppercase.
|
||||||
|
* - 'WORD' : Alias for 'WW'.
|
||||||
|
* - 'U' : Converts to uppercase with underscores replacing spaces.
|
||||||
|
* - 'strtoupper': Alias for 'U'.
|
||||||
|
* - 'F' : Capitalizes only the first letter of the entire string.
|
||||||
|
* - 'ucfirst' : Alias for 'F'.
|
||||||
|
* - 'cA' : Converts to camelCase.
|
||||||
|
* - 'cAmel' : Alias for 'cA'.
|
||||||
|
* - 'camelcase' : Alias for 'cA'.
|
||||||
|
* @param string $spacer The character to replace spaces with (default: '_').
|
||||||
|
* @param bool $replaceNumbers Whether to replace numbers with their English text equivalents (default: true).
|
||||||
|
* @param bool $keepOnlyCharacters Whether to remove all non-alphabetic characters (default: true).
|
||||||
*
|
*
|
||||||
|
* @return string The sanitized and formatted string.
|
||||||
* @since 3.0.9
|
* @since 3.0.9
|
||||||
*/
|
*/
|
||||||
public static function safe($string, $type = 'L', $spacer = '_', $replaceNumbers = true, $keepOnlyCharacters = true)
|
public static function safe($string, string $type = 'L', string $spacer = '_', bool $replaceNumbers = true, bool $keepOnlyCharacters = true): string
|
||||||
{
|
{
|
||||||
if ($replaceNumbers === true)
|
if ($replaceNumbers)
|
||||||
{
|
{
|
||||||
// remove all numbers and replace with English text version (works well only up to millions)
|
// remove all numbers and replace with English text version (works well only up to millions)
|
||||||
$string = self::numbers($string);
|
$string = self::numbers($string);
|
||||||
}
|
}
|
||||||
// 0nly continue if we have a string
|
|
||||||
if (self::check($string))
|
// Only continue if we have a string
|
||||||
|
if (!self::check($string))
|
||||||
{
|
{
|
||||||
|
// not a string
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
// create file name without the extension that is safe
|
// create file name without the extension that is safe
|
||||||
if ($type === 'filename')
|
if ($type === 'filename')
|
||||||
{
|
{
|
||||||
@ -195,20 +232,16 @@ abstract class StringHelper
|
|||||||
// return string
|
// return string
|
||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
// not a string
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert none English strings to code usable string
|
* Convert none English strings to code usable string
|
||||||
*
|
*
|
||||||
* @input an string
|
* @input $string an string
|
||||||
*
|
|
||||||
* @returns a string
|
|
||||||
*
|
*
|
||||||
|
* @returns string
|
||||||
* @since 3.0.9
|
* @since 3.0.9
|
||||||
*/
|
*/
|
||||||
public static function transliterate($string)
|
public static function transliterate($string): string
|
||||||
{
|
{
|
||||||
// set tag only once
|
// set tag only once
|
||||||
if (!self::check(self::$langTag))
|
if (!self::check(self::$langTag))
|
||||||
@ -217,22 +250,31 @@ abstract class StringHelper
|
|||||||
self::$langTag = Helper::getParams()->get('language', 'en-GB');
|
self::$langTag = Helper::getParams()->get('language', 'en-GB');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transliterate on the language requested
|
/** @var $langFactory LanguageFactory **/
|
||||||
$lang = Language::getInstance(self::$langTag);
|
$langFactory = Factory::getContainer()->get(LanguageFactoryInterface::class);
|
||||||
|
$lang = $langFactory->createLanguage(self::$langTag);
|
||||||
|
|
||||||
|
// Transliterate on the language requested
|
||||||
return $lang->transliterate($string);
|
return $lang->transliterate($string);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* make sure a string is HTML save
|
* Ensures a string is safe for HTML output by encoding entities and applying an input filter.
|
||||||
*
|
*
|
||||||
* @input an html string
|
* This method sanitizes the input string, converting special characters to HTML entities
|
||||||
|
* and applying Joomla's `InputFilter` to remove potentially unsafe HTML.
|
||||||
|
* Optionally, it can also shorten the string while preserving word integrity.
|
||||||
*
|
*
|
||||||
* @returns a string
|
* @param string $var The input string containing HTML content.
|
||||||
|
* @param string $charset The character set to use for encoding (default: 'UTF-8').
|
||||||
|
* @param bool $shorten Whether to shorten the string to a specified length (default: false).
|
||||||
|
* @param int $length The maximum length for shortening, if enabled (default: 40).
|
||||||
|
* @param bool $addTip Whether to append a tooltip (ellipsis) when shortening (default: true).
|
||||||
*
|
*
|
||||||
|
* @return string The sanitized and optionally shortened HTML-safe string.
|
||||||
* @since 3.0.9
|
* @since 3.0.9
|
||||||
*/
|
*/
|
||||||
public static function html($var, $charset = 'UTF-8', $shorten = false, $length = 40, $addTip = true)
|
public static function html($var, $charset = 'UTF-8', $shorten = false, $length = 40, $addTip = true): string
|
||||||
{
|
{
|
||||||
if (self::check($var))
|
if (self::check($var))
|
||||||
{
|
{
|
||||||
@ -262,13 +304,12 @@ abstract class StringHelper
|
|||||||
/**
|
/**
|
||||||
* Convert all int in a string to an English word string
|
* Convert all int in a string to an English word string
|
||||||
*
|
*
|
||||||
* @input an string with numbers
|
* @input $string an string with numbers
|
||||||
*
|
|
||||||
* @returns a string
|
|
||||||
*
|
*
|
||||||
|
* @returns string|null
|
||||||
* @since 3.0.9
|
* @since 3.0.9
|
||||||
*/
|
*/
|
||||||
public static function numbers($string)
|
public static function numbers($string): ?string
|
||||||
{
|
{
|
||||||
// set numbers array
|
// set numbers array
|
||||||
$numbers = [];
|
$numbers = [];
|
||||||
@ -300,19 +341,19 @@ abstract class StringHelper
|
|||||||
* Convert an integer into an English word string
|
* Convert an integer into an English word string
|
||||||
* Thanks to Tom Nicholson <http://php.net/manual/en/function.strval.php#41988>
|
* Thanks to Tom Nicholson <http://php.net/manual/en/function.strval.php#41988>
|
||||||
*
|
*
|
||||||
* @input an int
|
* @input $x an int
|
||||||
* @returns a string
|
|
||||||
*
|
*
|
||||||
|
* @returns string
|
||||||
* @since 3.0.9
|
* @since 3.0.9
|
||||||
*/
|
*/
|
||||||
public static function number($x)
|
public static function number($x)
|
||||||
{
|
{
|
||||||
$nwords = array( "zero", "one", "two", "three", "four", "five", "six", "seven",
|
$nwords = ["zero", "one", "two", "three", "four", "five", "six", "seven",
|
||||||
"eight", "nine", "ten", "eleven", "twelve", "thirteen",
|
"eight", "nine", "ten", "eleven", "twelve", "thirteen",
|
||||||
"fourteen", "fifteen", "sixteen", "seventeen", "eighteen",
|
"fourteen", "fifteen", "sixteen", "seventeen", "eighteen",
|
||||||
"nineteen", "twenty", 30 => "thirty", 40 => "forty",
|
"nineteen", "twenty", 30 => "thirty", 40 => "forty",
|
||||||
50 => "fifty", 60 => "sixty", 70 => "seventy", 80 => "eighty",
|
50 => "fifty", 60 => "sixty", 70 => "seventy", 80 => "eighty",
|
||||||
90 => "ninety" );
|
90 => "ninety"];
|
||||||
|
|
||||||
if(!is_numeric($x))
|
if(!is_numeric($x))
|
||||||
{
|
{
|
||||||
@ -394,7 +435,7 @@ abstract class StringHelper
|
|||||||
*
|
*
|
||||||
* @input int $size The size of the random string
|
* @input int $size The size of the random string
|
||||||
*
|
*
|
||||||
* @returns a string
|
* @returns string
|
||||||
* @since 3.0.9
|
* @since 3.0.9
|
||||||
*/
|
*/
|
||||||
public static function random(int $size): string
|
public static function random(int $size): string
|
||||||
|
@ -2,87 +2,122 @@
|
|||||||
* The Main Active Language
|
* The Main Active Language
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*
|
|
||||||
* @since 3.0.9
|
* @since 3.0.9
|
||||||
*/
|
*/
|
||||||
public static $langTag;
|
public static $langTag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if we have a string with a length
|
* Validate that input is a non-empty, non-whitespace-only string.
|
||||||
*
|
*
|
||||||
* @input string $string The string to check
|
* @param mixed $input The input value to validate.
|
||||||
*
|
|
||||||
* @returns bool true on success
|
|
||||||
*
|
*
|
||||||
|
* @returns bool True if input is a non-empty, non-whitespace-only string, otherwise false.
|
||||||
* @since 3.0.9
|
* @since 3.0.9
|
||||||
*/
|
*/
|
||||||
public static function check($string): bool
|
public static function check($input): bool
|
||||||
{
|
{
|
||||||
return is_string($string) && strlen($string) > 0;
|
return is_string($input) && trim($input) !== '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shorten a string
|
* Shortens a string to a specified length, optionally adding a tooltip with the full text.
|
||||||
*
|
*
|
||||||
* @input string The sting that you would like to shorten
|
* This method safely shortens the input string without cutting words abruptly. If the string
|
||||||
|
* exceeds the specified length, ellipses (...) are added. Optionally, a tooltip containing the
|
||||||
|
* longer original string can be included.
|
||||||
*
|
*
|
||||||
* @returns string on success
|
* @param mixed $string The string you would like to shorten.
|
||||||
|
* @param int $length The maximum length for the shortened string. Default is 40.
|
||||||
|
* @param bool $addTip Whether to add a tooltip with the original longer string. Default true.
|
||||||
*
|
*
|
||||||
* @since 3.2.0
|
* @return string|mixed The shortened string, optionally with a tooltip. Or original value passed
|
||||||
|
* @since 3.2.1
|
||||||
*/
|
*/
|
||||||
public static function shorten($string, $length = 40, $addTip = true)
|
public static function shorten($string, int $length = 40, bool $addTip = true)
|
||||||
{
|
{
|
||||||
if (self::check($string))
|
// Validate string input and return original if invalid or short enough.
|
||||||
|
if (!self::check($string) || mb_strlen($string) <= $length)
|
||||||
{
|
{
|
||||||
$initial = strlen((string) $string);
|
|
||||||
$words = preg_split('/([\s\n\r]+)/', (string) $string, -1, PREG_SPLIT_DELIM_CAPTURE);
|
|
||||||
$words_count = count((array)$words);
|
|
||||||
|
|
||||||
$word_length = 0;
|
|
||||||
$last_word = 0;
|
|
||||||
for (; $last_word < $words_count; ++$last_word)
|
|
||||||
{
|
|
||||||
$word_length += strlen($words[$last_word]);
|
|
||||||
if ($word_length > $length)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$newString = implode(array_slice($words, 0, $last_word));
|
|
||||||
$final = strlen($newString);
|
|
||||||
if ($initial !== $final && $addTip)
|
|
||||||
{
|
|
||||||
$title = self::shorten($string, 400 , false);
|
|
||||||
return '<span class="hasTip" title="' . $title . '" style="cursor:help">' . trim($newString) . '...</span>';
|
|
||||||
}
|
|
||||||
elseif ($initial !== $final && !$addTip)
|
|
||||||
{
|
|
||||||
return trim($newString) . '...';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Truncate string to nearest word boundary
|
||||||
|
$shortened = mb_substr($string, 0, $length);
|
||||||
|
|
||||||
|
// Find the last space to avoid cutting off a word
|
||||||
|
$lastSpace = mb_strrpos($shortened, ' ');
|
||||||
|
if ($lastSpace !== false)
|
||||||
|
{
|
||||||
|
$shortened = mb_substr($shortened, 0, $lastSpace);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Prepare trimmed and shortened output with ellipses
|
||||||
|
$shortened = trim($shortened) . '...';
|
||||||
|
|
||||||
|
// Add tooltip if requested
|
||||||
|
if ($addTip)
|
||||||
|
{
|
||||||
|
// Safely escape output for HTML
|
||||||
|
$title = self::shorten($string, 400 , false);
|
||||||
|
$escapedTitle = htmlspecialchars($title, ENT_QUOTES, 'UTF-8');
|
||||||
|
$escapedShort = htmlspecialchars($shortened, ENT_QUOTES, 'UTF-8');
|
||||||
|
|
||||||
|
return '<span class="hasTip" title="' . $escapedTitle . '" style="cursor:help">'
|
||||||
|
. $escapedShort
|
||||||
|
. '</span>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return shortened version without tooltip
|
||||||
|
return $shortened;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Making strings safe (various ways)
|
* Makes a string safe by sanitizing and formatting it according to the specified type.
|
||||||
*
|
*
|
||||||
* @input string The you would like to make safe
|
* This method can remove unwanted characters, transliterate text, replace numbers with
|
||||||
|
* their English equivalents, and apply different case formatting styles.
|
||||||
*
|
*
|
||||||
* @returns string on success
|
* @param string $string The string to sanitize and format.
|
||||||
|
* @param string $type The formatting type to apply. Supported values:
|
||||||
|
* - 'filename' : Removes special characters and extra spaces.
|
||||||
|
* - 'L' : Converts to lowercase with underscores replacing spaces.
|
||||||
|
* - 'strtolower': Alias for 'L'.
|
||||||
|
* - 'W' : Capitalizes the first letter of each word.
|
||||||
|
* - 'w' : Converts to lowercase (spaces remain).
|
||||||
|
* - 'word' : Alias for 'w'.
|
||||||
|
* - 'Ww' : Capitalizes only the first word.
|
||||||
|
* - 'Word' : Alias for 'Ww'.
|
||||||
|
* - 'WW' : Converts the entire string to uppercase.
|
||||||
|
* - 'WORD' : Alias for 'WW'.
|
||||||
|
* - 'U' : Converts to uppercase with underscores replacing spaces.
|
||||||
|
* - 'strtoupper': Alias for 'U'.
|
||||||
|
* - 'F' : Capitalizes only the first letter of the entire string.
|
||||||
|
* - 'ucfirst' : Alias for 'F'.
|
||||||
|
* - 'cA' : Converts to camelCase.
|
||||||
|
* - 'cAmel' : Alias for 'cA'.
|
||||||
|
* - 'camelcase' : Alias for 'cA'.
|
||||||
|
* @param string $spacer The character to replace spaces with (default: '_').
|
||||||
|
* @param bool $replaceNumbers Whether to replace numbers with their English text equivalents (default: true).
|
||||||
|
* @param bool $keepOnlyCharacters Whether to remove all non-alphabetic characters (default: true).
|
||||||
*
|
*
|
||||||
|
* @return string The sanitized and formatted string.
|
||||||
* @since 3.0.9
|
* @since 3.0.9
|
||||||
*/
|
*/
|
||||||
public static function safe($string, $type = 'L', $spacer = '_', $replaceNumbers = true, $keepOnlyCharacters = true)
|
public static function safe($string, string $type = 'L', string $spacer = '_', bool $replaceNumbers = true, bool $keepOnlyCharacters = true): string
|
||||||
{
|
{
|
||||||
if ($replaceNumbers === true)
|
if ($replaceNumbers)
|
||||||
{
|
{
|
||||||
// remove all numbers and replace with English text version (works well only up to millions)
|
// remove all numbers and replace with English text version (works well only up to millions)
|
||||||
$string = self::numbers($string);
|
$string = self::numbers($string);
|
||||||
}
|
}
|
||||||
// 0nly continue if we have a string
|
|
||||||
if (self::check($string))
|
// Only continue if we have a string
|
||||||
|
if (!self::check($string))
|
||||||
{
|
{
|
||||||
|
// not a string
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
// create file name without the extension that is safe
|
// create file name without the extension that is safe
|
||||||
if ($type === 'filename')
|
if ($type === 'filename')
|
||||||
{
|
{
|
||||||
@ -169,20 +204,16 @@
|
|||||||
// return string
|
// return string
|
||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
// not a string
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert none English strings to code usable string
|
* Convert none English strings to code usable string
|
||||||
*
|
*
|
||||||
* @input an string
|
* @input $string an string
|
||||||
*
|
|
||||||
* @returns a string
|
|
||||||
*
|
*
|
||||||
|
* @returns string
|
||||||
* @since 3.0.9
|
* @since 3.0.9
|
||||||
*/
|
*/
|
||||||
public static function transliterate($string)
|
public static function transliterate($string): string
|
||||||
{
|
{
|
||||||
// set tag only once
|
// set tag only once
|
||||||
if (!self::check(self::$langTag))
|
if (!self::check(self::$langTag))
|
||||||
@ -191,22 +222,31 @@
|
|||||||
self::$langTag = Helper::getParams()->get('language', 'en-GB');
|
self::$langTag = Helper::getParams()->get('language', 'en-GB');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transliterate on the language requested
|
/** @var $langFactory LanguageFactory **/
|
||||||
$lang = Language::getInstance(self::$langTag);
|
$langFactory = Factory::getContainer()->get(LanguageFactoryInterface::class);
|
||||||
|
$lang = $langFactory->createLanguage(self::$langTag);
|
||||||
|
|
||||||
|
// Transliterate on the language requested
|
||||||
return $lang->transliterate($string);
|
return $lang->transliterate($string);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* make sure a string is HTML save
|
* Ensures a string is safe for HTML output by encoding entities and applying an input filter.
|
||||||
*
|
*
|
||||||
* @input an html string
|
* This method sanitizes the input string, converting special characters to HTML entities
|
||||||
|
* and applying Joomla's `InputFilter` to remove potentially unsafe HTML.
|
||||||
|
* Optionally, it can also shorten the string while preserving word integrity.
|
||||||
*
|
*
|
||||||
* @returns a string
|
* @param string $var The input string containing HTML content.
|
||||||
|
* @param string $charset The character set to use for encoding (default: 'UTF-8').
|
||||||
|
* @param bool $shorten Whether to shorten the string to a specified length (default: false).
|
||||||
|
* @param int $length The maximum length for shortening, if enabled (default: 40).
|
||||||
|
* @param bool $addTip Whether to append a tooltip (ellipsis) when shortening (default: true).
|
||||||
*
|
*
|
||||||
|
* @return string The sanitized and optionally shortened HTML-safe string.
|
||||||
* @since 3.0.9
|
* @since 3.0.9
|
||||||
*/
|
*/
|
||||||
public static function html($var, $charset = 'UTF-8', $shorten = false, $length = 40, $addTip = true)
|
public static function html($var, $charset = 'UTF-8', $shorten = false, $length = 40, $addTip = true): string
|
||||||
{
|
{
|
||||||
if (self::check($var))
|
if (self::check($var))
|
||||||
{
|
{
|
||||||
@ -236,13 +276,12 @@
|
|||||||
/**
|
/**
|
||||||
* Convert all int in a string to an English word string
|
* Convert all int in a string to an English word string
|
||||||
*
|
*
|
||||||
* @input an string with numbers
|
* @input $string an string with numbers
|
||||||
*
|
|
||||||
* @returns a string
|
|
||||||
*
|
*
|
||||||
|
* @returns string|null
|
||||||
* @since 3.0.9
|
* @since 3.0.9
|
||||||
*/
|
*/
|
||||||
public static function numbers($string)
|
public static function numbers($string): ?string
|
||||||
{
|
{
|
||||||
// set numbers array
|
// set numbers array
|
||||||
$numbers = [];
|
$numbers = [];
|
||||||
@ -274,19 +313,19 @@
|
|||||||
* Convert an integer into an English word string
|
* Convert an integer into an English word string
|
||||||
* Thanks to Tom Nicholson <http://php.net/manual/en/function.strval.php#41988>
|
* Thanks to Tom Nicholson <http://php.net/manual/en/function.strval.php#41988>
|
||||||
*
|
*
|
||||||
* @input an int
|
* @input $x an int
|
||||||
* @returns a string
|
|
||||||
*
|
*
|
||||||
|
* @returns string
|
||||||
* @since 3.0.9
|
* @since 3.0.9
|
||||||
*/
|
*/
|
||||||
public static function number($x)
|
public static function number($x)
|
||||||
{
|
{
|
||||||
$nwords = array( "zero", "one", "two", "three", "four", "five", "six", "seven",
|
$nwords = ["zero", "one", "two", "three", "four", "five", "six", "seven",
|
||||||
"eight", "nine", "ten", "eleven", "twelve", "thirteen",
|
"eight", "nine", "ten", "eleven", "twelve", "thirteen",
|
||||||
"fourteen", "fifteen", "sixteen", "seventeen", "eighteen",
|
"fourteen", "fifteen", "sixteen", "seventeen", "eighteen",
|
||||||
"nineteen", "twenty", 30 => "thirty", 40 => "forty",
|
"nineteen", "twenty", 30 => "thirty", 40 => "forty",
|
||||||
50 => "fifty", 60 => "sixty", 70 => "seventy", 80 => "eighty",
|
50 => "fifty", 60 => "sixty", 70 => "seventy", 80 => "eighty",
|
||||||
90 => "ninety" );
|
90 => "ninety"];
|
||||||
|
|
||||||
if(!is_numeric($x))
|
if(!is_numeric($x))
|
||||||
{
|
{
|
||||||
@ -368,7 +407,7 @@
|
|||||||
*
|
*
|
||||||
* @input int $size The size of the random string
|
* @input int $size The size of the random string
|
||||||
*
|
*
|
||||||
* @returns a string
|
* @returns string
|
||||||
* @since 3.0.9
|
* @since 3.0.9
|
||||||
*/
|
*/
|
||||||
public static function random(int $size): string
|
public static function random(int $size): string
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"add_head": "1",
|
"add_head": 1,
|
||||||
"add_licensing_template": "2",
|
"add_licensing_template": 2,
|
||||||
"extends": "",
|
"extends": "",
|
||||||
"guid": "1f28cb53-60d9-4db1-b517-3c7dc6b429ef",
|
"guid": "1f28cb53-60d9-4db1-b517-3c7dc6b429ef",
|
||||||
"implements": null,
|
"implements": null,
|
||||||
@ -23,6 +23,6 @@
|
|||||||
"namespace": "[[[NamespacePrefix]]]\\Joomla\\Utilities.StringHelper",
|
"namespace": "[[[NamespacePrefix]]]\\Joomla\\Utilities.StringHelper",
|
||||||
"description": "Some string tricks\r\n\r\n@since 3.0.9",
|
"description": "Some string tricks\r\n\r\n@since 3.0.9",
|
||||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 3rd September, 2020\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",
|
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 3rd September, 2020\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\\Filter\\InputFilter;\r\nuse Joomla\\CMS\\Language\\Language;",
|
"head": "use Joomla\\CMS\\Factory;\r\nuse Joomla\\Filter\\InputFilter;\r\nuse Joomla\\CMS\\Language\\LanguageFactoryInterface;\r\nuse Joomla\\CMS\\Language\\LanguageFactory;",
|
||||||
"composer": ""
|
"composer": ""
|
||||||
}
|
}
|
84
src/202ccd9e-dfcf-4cde-a0ce-bde1fd27f088/README.md
Normal file
84
src/202ccd9e-dfcf-4cde-a0ce-bde1fd27f088/README.md
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
```
|
||||||
|
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||||
|
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||||
|
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||||
|
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||||
|
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||||
|
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||||
|
```
|
||||||
|
# class File (Details)
|
||||||
|
> namespace: **VDM\Joomla\Componentbuilder\File\Service**
|
||||||
|
|
||||||
|
```uml
|
||||||
|
@startuml
|
||||||
|
class File #Gold {
|
||||||
|
+ register(Container $container) : void
|
||||||
|
+ getType(Container $container) : Type
|
||||||
|
+ getHandler(Container $container) : Handler
|
||||||
|
+ getManager(Container $container) : Manager
|
||||||
|
+ getDisplay(Container $container) : Display
|
||||||
|
}
|
||||||
|
|
||||||
|
note right of File::register
|
||||||
|
Registers the service provider with a DI container.
|
||||||
|
|
||||||
|
since: 5.0.3
|
||||||
|
return: void
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of File::getType
|
||||||
|
Get The Type Class.
|
||||||
|
|
||||||
|
since: 5.0.3
|
||||||
|
return: Type
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of File::getHandler
|
||||||
|
Get The Handler Class.
|
||||||
|
|
||||||
|
since: 5.0.3
|
||||||
|
return: Handler
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of File::getManager
|
||||||
|
Get The Manager Class.
|
||||||
|
|
||||||
|
since: 5.0.3
|
||||||
|
return: Manager
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of File::getDisplay
|
||||||
|
Get The Display Class.
|
||||||
|
|
||||||
|
since: 5.0.3
|
||||||
|
return: Display
|
||||||
|
end note
|
||||||
|
|
||||||
|
@enduml
|
||||||
|
```
|
||||||
|
|
||||||
|
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
|
||||||
|
|
||||||
|
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
|
||||||
|
|
||||||
|
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
|
||||||
|
|
||||||
|
To add this specific Power to your project in JCB:
|
||||||
|
|
||||||
|
> simply use this SPK
|
||||||
|
```
|
||||||
|
Super---202ccd9e_dfcf_4cde_a0ce_bde1fd27f088---Power
|
||||||
|
```
|
||||||
|
> remember to replace the `---` with `___` to activate this Power in your code
|
||||||
|
|
||||||
|
---
|
||||||
|
```
|
||||||
|
██╗ ██████╗██████╗
|
||||||
|
██║██╔════╝██╔══██╗
|
||||||
|
██║██║ ██████╔╝
|
||||||
|
██ ██║██║ ██╔══██╗
|
||||||
|
╚█████╔╝╚██████╗██████╔╝
|
||||||
|
╚════╝ ╚═════╝╚═════╝
|
||||||
|
```
|
||||||
|
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||||
|
|
115
src/202ccd9e-dfcf-4cde-a0ce-bde1fd27f088/code.php
Normal file
115
src/202ccd9e-dfcf-4cde-a0ce-bde1fd27f088/code.php
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
<?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\File\Service;
|
||||||
|
|
||||||
|
|
||||||
|
use Joomla\DI\Container;
|
||||||
|
use Joomla\DI\ServiceProviderInterface;
|
||||||
|
use VDM\Joomla\Componentbuilder\File\Type;
|
||||||
|
use VDM\Joomla\Componentbuilder\File\Handler;
|
||||||
|
use VDM\Joomla\Componentbuilder\File\Manager;
|
||||||
|
use VDM\Joomla\Componentbuilder\File\Display;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* File Service Provider
|
||||||
|
*
|
||||||
|
* @since 5.0.3
|
||||||
|
*/
|
||||||
|
class File implements ServiceProviderInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Registers the service provider with a DI container.
|
||||||
|
*
|
||||||
|
* @param Container $container The DI container.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 5.0.3
|
||||||
|
*/
|
||||||
|
public function register(Container $container)
|
||||||
|
{
|
||||||
|
$container->alias(Type::class, 'File.Type')
|
||||||
|
->share('File.Type', [$this, 'getType'], true);
|
||||||
|
|
||||||
|
$container->alias(Handler::class, 'File.Handler')
|
||||||
|
->share('File.Handler', [$this, 'getHandler'], true);
|
||||||
|
|
||||||
|
$container->alias(Manager::class, 'File.Manager')
|
||||||
|
->share('File.Manager', [$this, 'getManager'], true);
|
||||||
|
|
||||||
|
$container->alias(Display::class, 'File.Display')
|
||||||
|
->share('File.Display', [$this, 'getDisplay'], true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get The Type Class.
|
||||||
|
*
|
||||||
|
* @param Container $container The DI container.
|
||||||
|
*
|
||||||
|
* @return Type
|
||||||
|
* @since 5.0.3
|
||||||
|
*/
|
||||||
|
public function getType(Container $container): Type
|
||||||
|
{
|
||||||
|
return new Type(
|
||||||
|
$container->get('Data.Item')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get The Handler Class.
|
||||||
|
*
|
||||||
|
* @param Container $container The DI container.
|
||||||
|
*
|
||||||
|
* @return Handler
|
||||||
|
* @since 5.0.3
|
||||||
|
*/
|
||||||
|
public function getHandler(Container $container): Handler
|
||||||
|
{
|
||||||
|
return new Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get The Manager Class.
|
||||||
|
*
|
||||||
|
* @param Container $container The DI container.
|
||||||
|
*
|
||||||
|
* @return Manager
|
||||||
|
* @since 5.0.3
|
||||||
|
*/
|
||||||
|
public function getManager(Container $container): Manager
|
||||||
|
{
|
||||||
|
return new Manager(
|
||||||
|
$container->get('Data.Item'),
|
||||||
|
$container->get('Data.Items'),
|
||||||
|
$container->get('File.Type'),
|
||||||
|
$container->get('File.Handler')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get The Display Class.
|
||||||
|
*
|
||||||
|
* @param Container $container The DI container.
|
||||||
|
*
|
||||||
|
* @return Display
|
||||||
|
* @since 5.0.3
|
||||||
|
*/
|
||||||
|
public function getDisplay(Container $container): Display
|
||||||
|
{
|
||||||
|
return new Display(
|
||||||
|
$container->get('Data.Item'),
|
||||||
|
$container->get('Data.Items')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
84
src/202ccd9e-dfcf-4cde-a0ce-bde1fd27f088/code.power
Normal file
84
src/202ccd9e-dfcf-4cde-a0ce-bde1fd27f088/code.power
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
/**
|
||||||
|
* Registers the service provider with a DI container.
|
||||||
|
*
|
||||||
|
* @param Container $container The DI container.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 5.0.3
|
||||||
|
*/
|
||||||
|
public function register(Container $container)
|
||||||
|
{
|
||||||
|
$container->alias(Type::class, 'File.Type')
|
||||||
|
->share('File.Type', [$this, 'getType'], true);
|
||||||
|
|
||||||
|
$container->alias(Handler::class, 'File.Handler')
|
||||||
|
->share('File.Handler', [$this, 'getHandler'], true);
|
||||||
|
|
||||||
|
$container->alias(Manager::class, 'File.Manager')
|
||||||
|
->share('File.Manager', [$this, 'getManager'], true);
|
||||||
|
|
||||||
|
$container->alias(Display::class, 'File.Display')
|
||||||
|
->share('File.Display', [$this, 'getDisplay'], true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get The Type Class.
|
||||||
|
*
|
||||||
|
* @param Container $container The DI container.
|
||||||
|
*
|
||||||
|
* @return Type
|
||||||
|
* @since 5.0.3
|
||||||
|
*/
|
||||||
|
public function getType(Container $container): Type
|
||||||
|
{
|
||||||
|
return new Type(
|
||||||
|
$container->get('Data.Item')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get The Handler Class.
|
||||||
|
*
|
||||||
|
* @param Container $container The DI container.
|
||||||
|
*
|
||||||
|
* @return Handler
|
||||||
|
* @since 5.0.3
|
||||||
|
*/
|
||||||
|
public function getHandler(Container $container): Handler
|
||||||
|
{
|
||||||
|
return new Handler();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get The Manager Class.
|
||||||
|
*
|
||||||
|
* @param Container $container The DI container.
|
||||||
|
*
|
||||||
|
* @return Manager
|
||||||
|
* @since 5.0.3
|
||||||
|
*/
|
||||||
|
public function getManager(Container $container): Manager
|
||||||
|
{
|
||||||
|
return new Manager(
|
||||||
|
$container->get('Data.Item'),
|
||||||
|
$container->get('Data.Items'),
|
||||||
|
$container->get('File.Type'),
|
||||||
|
$container->get('File.Handler')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get The Display Class.
|
||||||
|
*
|
||||||
|
* @param Container $container The DI container.
|
||||||
|
*
|
||||||
|
* @return Display
|
||||||
|
* @since 5.0.3
|
||||||
|
*/
|
||||||
|
public function getDisplay(Container $container): Display
|
||||||
|
{
|
||||||
|
return new Display(
|
||||||
|
$container->get('Data.Item'),
|
||||||
|
$container->get('Data.Items')
|
||||||
|
);
|
||||||
|
}
|
39
src/202ccd9e-dfcf-4cde-a0ce-bde1fd27f088/settings.json
Normal file
39
src/202ccd9e-dfcf-4cde-a0ce-bde1fd27f088/settings.json
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
{
|
||||||
|
"add_head": 1,
|
||||||
|
"add_licensing_template": 2,
|
||||||
|
"extends": "",
|
||||||
|
"guid": "202ccd9e-dfcf-4cde-a0ce-bde1fd27f088",
|
||||||
|
"implements": [
|
||||||
|
"-1"
|
||||||
|
],
|
||||||
|
"load_selection": null,
|
||||||
|
"name": "File",
|
||||||
|
"power_version": "1.0.0",
|
||||||
|
"system_name": "JCB.File.Service.File",
|
||||||
|
"type": "class",
|
||||||
|
"use_selection": {
|
||||||
|
"use_selection0": {
|
||||||
|
"use": "12a2a8de-a893-4dbb-a53d-b52de4f6cb0e",
|
||||||
|
"as": "default"
|
||||||
|
},
|
||||||
|
"use_selection1": {
|
||||||
|
"use": "4144ad3b-2ad5-401f-af0c-a3d856c1e688",
|
||||||
|
"as": "default"
|
||||||
|
},
|
||||||
|
"use_selection2": {
|
||||||
|
"use": "67a5e0ca-0ff0-4979-9b41-da0b09988016",
|
||||||
|
"as": "default"
|
||||||
|
},
|
||||||
|
"use_selection3": {
|
||||||
|
"use": "d46c4667-378b-49e8-9782-ffb28d92415a",
|
||||||
|
"as": "default"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"extendsinterfaces": null,
|
||||||
|
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].File.Service.File",
|
||||||
|
"description": "File Service Provider\r\n\r\n@since 5.0.3",
|
||||||
|
"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": ""
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"add_head": "0",
|
"add_head": 0,
|
||||||
"add_licensing_template": "2",
|
"add_licensing_template": 2,
|
||||||
"extends": "",
|
"extends": "",
|
||||||
"guid": "215b35ac-1b26-4838-bbcf-d1fdbbd9353f",
|
"guid": "215b35ac-1b26-4838-bbcf-d1fdbbd9353f",
|
||||||
"implements": null,
|
"implements": null,
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"add_head": "0",
|
"add_head": 0,
|
||||||
"add_licensing_template": "2",
|
"add_licensing_template": 2,
|
||||||
"extends": "",
|
"extends": "",
|
||||||
"guid": "217416f6-24cf-41c0-b18e-11086111d447",
|
"guid": "217416f6-24cf-41c0-b18e-11086111d447",
|
||||||
"implements": null,
|
"implements": null,
|
||||||
|
108
src/21754a8b-2323-4a77-8459-378a74c1ec97/README.md
Normal file
108
src/21754a8b-2323-4a77-8459-378a74c1ec97/README.md
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
```
|
||||||
|
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||||
|
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||||
|
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||||
|
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||||
|
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||||
|
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||||
|
```
|
||||||
|
# class Import (Details)
|
||||||
|
> namespace: **VDM\Joomla\Componentbuilder\Import\Service**
|
||||||
|
|
||||||
|
```uml
|
||||||
|
@startuml
|
||||||
|
class Import #Gold {
|
||||||
|
+ register(Container $container) : void
|
||||||
|
+ getData(Container $container) : Data
|
||||||
|
+ getMapper(Container $container) : Mapper
|
||||||
|
+ getRow(Container $container) : Row
|
||||||
|
+ getItem(Container $container) : Item
|
||||||
|
+ getMessage(Container $container) : Message
|
||||||
|
+ getStatus(Container $container) : Status
|
||||||
|
+ getAssessor(Container $container) : Assessor
|
||||||
|
}
|
||||||
|
|
||||||
|
note right of Import::register
|
||||||
|
Registers the service provider with a DI container.
|
||||||
|
|
||||||
|
since: 5.0.3
|
||||||
|
return: void
|
||||||
|
end note
|
||||||
|
|
||||||
|
note left of Import::getData
|
||||||
|
Get The Data Class.
|
||||||
|
|
||||||
|
since: 5.0.3
|
||||||
|
return: Data
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Import::getMapper
|
||||||
|
Get The Mapper Class.
|
||||||
|
|
||||||
|
since: 5.0.3
|
||||||
|
return: Mapper
|
||||||
|
end note
|
||||||
|
|
||||||
|
note left of Import::getRow
|
||||||
|
Get The Row Class.
|
||||||
|
|
||||||
|
since: 5.0.3
|
||||||
|
return: Row
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Import::getItem
|
||||||
|
Get The Item Class.
|
||||||
|
|
||||||
|
since: 5.0.3
|
||||||
|
return: Item
|
||||||
|
end note
|
||||||
|
|
||||||
|
note left of Import::getMessage
|
||||||
|
Get The Message Class.
|
||||||
|
|
||||||
|
since: 5.0.3
|
||||||
|
return: Message
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Import::getStatus
|
||||||
|
Get The Status Class.
|
||||||
|
|
||||||
|
since: 5.0.3
|
||||||
|
return: Status
|
||||||
|
end note
|
||||||
|
|
||||||
|
note left of Import::getAssessor
|
||||||
|
Get The Assessor Class.
|
||||||
|
|
||||||
|
since: 5.0.3
|
||||||
|
return: Assessor
|
||||||
|
end note
|
||||||
|
|
||||||
|
@enduml
|
||||||
|
```
|
||||||
|
|
||||||
|
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
|
||||||
|
|
||||||
|
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
|
||||||
|
|
||||||
|
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
|
||||||
|
|
||||||
|
To add this specific Power to your project in JCB:
|
||||||
|
|
||||||
|
> simply use this SPK
|
||||||
|
```
|
||||||
|
Super---21754a8b_2323_4a77_8459_378a74c1ec97---Power
|
||||||
|
```
|
||||||
|
> remember to replace the `---` with `___` to activate this Power in your code
|
||||||
|
|
||||||
|
---
|
||||||
|
```
|
||||||
|
██╗ ██████╗██████╗
|
||||||
|
██║██╔════╝██╔══██╗
|
||||||
|
██║██║ ██████╔╝
|
||||||
|
██ ██║██║ ██╔══██╗
|
||||||
|
╚█████╔╝╚██████╗██████╔╝
|
||||||
|
╚════╝ ╚═════╝╚═════╝
|
||||||
|
```
|
||||||
|
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||||
|
|
171
src/21754a8b-2323-4a77-8459-378a74c1ec97/code.php
Normal file
171
src/21754a8b-2323-4a77-8459-378a74c1ec97/code.php
Normal file
@ -0,0 +1,171 @@
|
|||||||
|
<?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\Import\Service;
|
||||||
|
|
||||||
|
|
||||||
|
use Joomla\DI\Container;
|
||||||
|
use Joomla\DI\ServiceProviderInterface;
|
||||||
|
use VDM\Joomla\Componentbuilder\Import\Data;
|
||||||
|
use VDM\Joomla\Componentbuilder\Import\Mapper;
|
||||||
|
use VDM\Joomla\Componentbuilder\Import\Row;
|
||||||
|
use VDM\Joomla\Componentbuilder\Import\Item;
|
||||||
|
use VDM\Joomla\Componentbuilder\Import\Message;
|
||||||
|
use VDM\Joomla\Componentbuilder\Import\Status;
|
||||||
|
use VDM\Joomla\Componentbuilder\Import\Assessor;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Import Service Provider
|
||||||
|
*
|
||||||
|
* @since 5.0.3
|
||||||
|
*/
|
||||||
|
class Import implements ServiceProviderInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Registers the service provider with a DI container.
|
||||||
|
*
|
||||||
|
* @param Container $container The DI container.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 5.0.3
|
||||||
|
*/
|
||||||
|
public function register(Container $container)
|
||||||
|
{
|
||||||
|
$container->alias(Data::class, 'Import.Data')
|
||||||
|
->share('Import.Data', [$this, 'getData'], true);
|
||||||
|
|
||||||
|
$container->alias(Mapper::class, 'Import.Mapper')
|
||||||
|
->share('Import.Mapper', [$this, 'getMapper'], true);
|
||||||
|
|
||||||
|
$container->alias(Row::class, 'Import.Row')
|
||||||
|
->share('Import.Row', [$this, 'getRow'], true);
|
||||||
|
|
||||||
|
$container->alias(Item::class, 'Import.Item')
|
||||||
|
->share('Import.Item', [$this, 'getItem'], true);
|
||||||
|
|
||||||
|
$container->alias(Message::class, 'Import.Message')
|
||||||
|
->share('Import.Message', [$this, 'getMessage'], true);
|
||||||
|
|
||||||
|
$container->alias(Status::class, 'Import.Status')
|
||||||
|
->share('Import.Status', [$this, 'getStatus'], true);
|
||||||
|
|
||||||
|
$container->alias(Assessor::class, 'Import.Assessor')
|
||||||
|
->share('Import.Assessor', [$this, 'getAssessor'], true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get The Data Class.
|
||||||
|
*
|
||||||
|
* @param Container $container The DI container.
|
||||||
|
*
|
||||||
|
* @return Data
|
||||||
|
* @since 5.0.3
|
||||||
|
*/
|
||||||
|
public function getData(Container $container): Data
|
||||||
|
{
|
||||||
|
return new Data();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get The Mapper Class.
|
||||||
|
*
|
||||||
|
* @param Container $container The DI container.
|
||||||
|
*
|
||||||
|
* @return Mapper
|
||||||
|
* @since 5.0.3
|
||||||
|
*/
|
||||||
|
public function getMapper(Container $container): Mapper
|
||||||
|
{
|
||||||
|
return new Mapper(
|
||||||
|
$container->get('Table')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get The Row Class.
|
||||||
|
*
|
||||||
|
* @param Container $container The DI container.
|
||||||
|
*
|
||||||
|
* @return Row
|
||||||
|
* @since 5.0.3
|
||||||
|
*/
|
||||||
|
public function getRow(Container $container): Row
|
||||||
|
{
|
||||||
|
return new Row();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get The Item Class.
|
||||||
|
*
|
||||||
|
* @param Container $container The DI container.
|
||||||
|
*
|
||||||
|
* @return Item
|
||||||
|
* @since 5.0.3
|
||||||
|
*/
|
||||||
|
public function getItem(Container $container): Item
|
||||||
|
{
|
||||||
|
return new Item(
|
||||||
|
$container->get('Table.Validator'),
|
||||||
|
$container->get('Data.Item'),
|
||||||
|
$container->get('Import.Row')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get The Message Class.
|
||||||
|
*
|
||||||
|
* @param Container $container The DI container.
|
||||||
|
*
|
||||||
|
* @return Message
|
||||||
|
* @since 5.0.3
|
||||||
|
*/
|
||||||
|
public function getMessage(Container $container): Message
|
||||||
|
{
|
||||||
|
return new Message(
|
||||||
|
$container->get('Data.Update'),
|
||||||
|
$container->get('Data.Insert')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get The Status Class.
|
||||||
|
*
|
||||||
|
* @param Container $container The DI container.
|
||||||
|
*
|
||||||
|
* @return Status
|
||||||
|
* @since 5.0.3
|
||||||
|
*/
|
||||||
|
public function getStatus(Container $container): Status
|
||||||
|
{
|
||||||
|
return new Status(
|
||||||
|
$container->get('Data.Item')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get The Assessor Class.
|
||||||
|
*
|
||||||
|
* @param Container $container The DI container.
|
||||||
|
*
|
||||||
|
* @return Assessor
|
||||||
|
* @since 5.0.3
|
||||||
|
*/
|
||||||
|
public function getAssessor(Container $container): Assessor
|
||||||
|
{
|
||||||
|
return new Assessor(
|
||||||
|
$container->get('Import.Data'),
|
||||||
|
$container->get('Import.Status'),
|
||||||
|
$container->get('Import.Message')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
137
src/21754a8b-2323-4a77-8459-378a74c1ec97/code.power
Normal file
137
src/21754a8b-2323-4a77-8459-378a74c1ec97/code.power
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
/**
|
||||||
|
* Registers the service provider with a DI container.
|
||||||
|
*
|
||||||
|
* @param Container $container The DI container.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 5.0.3
|
||||||
|
*/
|
||||||
|
public function register(Container $container)
|
||||||
|
{
|
||||||
|
$container->alias(Data::class, 'Import.Data')
|
||||||
|
->share('Import.Data', [$this, 'getData'], true);
|
||||||
|
|
||||||
|
$container->alias(Mapper::class, 'Import.Mapper')
|
||||||
|
->share('Import.Mapper', [$this, 'getMapper'], true);
|
||||||
|
|
||||||
|
$container->alias(Row::class, 'Import.Row')
|
||||||
|
->share('Import.Row', [$this, 'getRow'], true);
|
||||||
|
|
||||||
|
$container->alias(Item::class, 'Import.Item')
|
||||||
|
->share('Import.Item', [$this, 'getItem'], true);
|
||||||
|
|
||||||
|
$container->alias(Message::class, 'Import.Message')
|
||||||
|
->share('Import.Message', [$this, 'getMessage'], true);
|
||||||
|
|
||||||
|
$container->alias(Status::class, 'Import.Status')
|
||||||
|
->share('Import.Status', [$this, 'getStatus'], true);
|
||||||
|
|
||||||
|
$container->alias(Assessor::class, 'Import.Assessor')
|
||||||
|
->share('Import.Assessor', [$this, 'getAssessor'], true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get The Data Class.
|
||||||
|
*
|
||||||
|
* @param Container $container The DI container.
|
||||||
|
*
|
||||||
|
* @return Data
|
||||||
|
* @since 5.0.3
|
||||||
|
*/
|
||||||
|
public function getData(Container $container): Data
|
||||||
|
{
|
||||||
|
return new Data();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get The Mapper Class.
|
||||||
|
*
|
||||||
|
* @param Container $container The DI container.
|
||||||
|
*
|
||||||
|
* @return Mapper
|
||||||
|
* @since 5.0.3
|
||||||
|
*/
|
||||||
|
public function getMapper(Container $container): Mapper
|
||||||
|
{
|
||||||
|
return new Mapper(
|
||||||
|
$container->get('Table')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get The Row Class.
|
||||||
|
*
|
||||||
|
* @param Container $container The DI container.
|
||||||
|
*
|
||||||
|
* @return Row
|
||||||
|
* @since 5.0.3
|
||||||
|
*/
|
||||||
|
public function getRow(Container $container): Row
|
||||||
|
{
|
||||||
|
return new Row();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get The Item Class.
|
||||||
|
*
|
||||||
|
* @param Container $container The DI container.
|
||||||
|
*
|
||||||
|
* @return Item
|
||||||
|
* @since 5.0.3
|
||||||
|
*/
|
||||||
|
public function getItem(Container $container): Item
|
||||||
|
{
|
||||||
|
return new Item(
|
||||||
|
$container->get('Table.Validator'),
|
||||||
|
$container->get('Data.Item'),
|
||||||
|
$container->get('Import.Row')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get The Message Class.
|
||||||
|
*
|
||||||
|
* @param Container $container The DI container.
|
||||||
|
*
|
||||||
|
* @return Message
|
||||||
|
* @since 5.0.3
|
||||||
|
*/
|
||||||
|
public function getMessage(Container $container): Message
|
||||||
|
{
|
||||||
|
return new Message(
|
||||||
|
$container->get('Data.Update'),
|
||||||
|
$container->get('Data.Insert')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get The Status Class.
|
||||||
|
*
|
||||||
|
* @param Container $container The DI container.
|
||||||
|
*
|
||||||
|
* @return Status
|
||||||
|
* @since 5.0.3
|
||||||
|
*/
|
||||||
|
public function getStatus(Container $container): Status
|
||||||
|
{
|
||||||
|
return new Status(
|
||||||
|
$container->get('Data.Item')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get The Assessor Class.
|
||||||
|
*
|
||||||
|
* @param Container $container The DI container.
|
||||||
|
*
|
||||||
|
* @return Assessor
|
||||||
|
* @since 5.0.3
|
||||||
|
*/
|
||||||
|
public function getAssessor(Container $container): Assessor
|
||||||
|
{
|
||||||
|
return new Assessor(
|
||||||
|
$container->get('Import.Data'),
|
||||||
|
$container->get('Import.Status'),
|
||||||
|
$container->get('Import.Message')
|
||||||
|
);
|
||||||
|
}
|
51
src/21754a8b-2323-4a77-8459-378a74c1ec97/settings.json
Normal file
51
src/21754a8b-2323-4a77-8459-378a74c1ec97/settings.json
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
{
|
||||||
|
"add_head": 1,
|
||||||
|
"add_licensing_template": 2,
|
||||||
|
"extends": "",
|
||||||
|
"guid": "21754a8b-2323-4a77-8459-378a74c1ec97",
|
||||||
|
"implements": [
|
||||||
|
"-1"
|
||||||
|
],
|
||||||
|
"load_selection": null,
|
||||||
|
"name": "Import",
|
||||||
|
"power_version": "1.0.0",
|
||||||
|
"system_name": "JCB.Import.Service.Import",
|
||||||
|
"type": "class",
|
||||||
|
"use_selection": {
|
||||||
|
"use_selection0": {
|
||||||
|
"use": "05f23281-58e3-482e-be42-2dc1355ef4ea",
|
||||||
|
"as": "default"
|
||||||
|
},
|
||||||
|
"use_selection1": {
|
||||||
|
"use": "90b48ea8-0930-48d1-869a-bce9c901589c",
|
||||||
|
"as": "default"
|
||||||
|
},
|
||||||
|
"use_selection2": {
|
||||||
|
"use": "afb5b891-7130-422a-b389-1934b0e4fc48",
|
||||||
|
"as": "default"
|
||||||
|
},
|
||||||
|
"use_selection3": {
|
||||||
|
"use": "68a0f9af-265a-4db1-bae9-a4e4531f94d7",
|
||||||
|
"as": "default"
|
||||||
|
},
|
||||||
|
"use_selection4": {
|
||||||
|
"use": "eef6ffc2-2af0-4336-958f-e0b9cf7c4ad0",
|
||||||
|
"as": "default"
|
||||||
|
},
|
||||||
|
"use_selection5": {
|
||||||
|
"use": "d2a859ac-3f2a-4f69-a77f-f118b2e0a459",
|
||||||
|
"as": "default"
|
||||||
|
},
|
||||||
|
"use_selection6": {
|
||||||
|
"use": "19a66b48-620c-439b-ab8a-3c0d43e040c3",
|
||||||
|
"as": "default"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"extendsinterfaces": null,
|
||||||
|
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Import.Service.Import",
|
||||||
|
"description": "Import Service Provider\r\n\r\n@since 5.0.3",
|
||||||
|
"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": ""
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"add_head": "0",
|
"add_head": 0,
|
||||||
"add_licensing_template": "2",
|
"add_licensing_template": 2,
|
||||||
"extends": "",
|
"extends": "",
|
||||||
"guid": "21bca8a4-5b28-41c4-843e-8097f0ba7cca",
|
"guid": "21bca8a4-5b28-41c4-843e-8097f0ba7cca",
|
||||||
"implements": [
|
"implements": [
|
||||||
|
120
src/23ad6e72-1b82-40fb-836c-50da690bb174/README.md
Normal file
120
src/23ad6e72-1b82-40fb-836c-50da690bb174/README.md
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
```
|
||||||
|
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||||
|
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||||
|
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||||
|
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||||
|
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||||
|
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||||
|
```
|
||||||
|
# interface ImportMessageInterface (Details)
|
||||||
|
> namespace: **VDM\Joomla\Componentbuilder\Interfaces**
|
||||||
|
|
||||||
|
```uml
|
||||||
|
@startuml
|
||||||
|
interface ImportMessageInterface #Lavender {
|
||||||
|
+ load(string $guid, string $entity, ...) : self
|
||||||
|
+ get() : object
|
||||||
|
+ reset() : void
|
||||||
|
+ archive() : self
|
||||||
|
+ set() : self
|
||||||
|
+ addSuccess(string $message) : self
|
||||||
|
+ addInfo(string $message) : self
|
||||||
|
+ addError(string $message) : self
|
||||||
|
}
|
||||||
|
|
||||||
|
note right of ImportMessageInterface::load
|
||||||
|
Load an entity that these message belong to
|
||||||
|
|
||||||
|
since: 3.0.2
|
||||||
|
return: self
|
||||||
|
|
||||||
|
arguments:
|
||||||
|
string $guid
|
||||||
|
string $entity
|
||||||
|
string $table
|
||||||
|
end note
|
||||||
|
|
||||||
|
note left of ImportMessageInterface::get
|
||||||
|
Get the messages of the last import event
|
||||||
|
|
||||||
|
since: 3.0.2
|
||||||
|
return: object
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of ImportMessageInterface::reset
|
||||||
|
Reset the messages of the last import event
|
||||||
|
|
||||||
|
since: 3.0.2
|
||||||
|
return: void
|
||||||
|
end note
|
||||||
|
|
||||||
|
note left of ImportMessageInterface::archive
|
||||||
|
Archive the messages in the DB of the last import event
|
||||||
|
|
||||||
|
since: 3.0.2
|
||||||
|
return: self
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of ImportMessageInterface::set
|
||||||
|
Set the messages in the DB of the last import event
|
||||||
|
|
||||||
|
since: 3.0.2
|
||||||
|
return: self
|
||||||
|
end note
|
||||||
|
|
||||||
|
note left of ImportMessageInterface::addSuccess
|
||||||
|
Adds a success message to the log.
|
||||||
|
This method records a success message for the import process. The message provides
|
||||||
|
relevant information, such as the number of rows processed and the success rate.
|
||||||
|
|
||||||
|
since: 3.0.2
|
||||||
|
return: self
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of ImportMessageInterface::addInfo
|
||||||
|
Adds a info message to the log.
|
||||||
|
This method records a info message for the import process. The message provides
|
||||||
|
relevant information, such as the number of rows processed and the info rate.
|
||||||
|
|
||||||
|
since: 3.0.2
|
||||||
|
return: self
|
||||||
|
end note
|
||||||
|
|
||||||
|
note left of ImportMessageInterface::addError
|
||||||
|
Adds an error message to the log.
|
||||||
|
This method records an error message when the import process encounters issues.
|
||||||
|
The message includes details about the failures, such as the number of failed rows
|
||||||
|
and the corresponding error rate.
|
||||||
|
|
||||||
|
since: 3.0.2
|
||||||
|
return: self
|
||||||
|
end note
|
||||||
|
|
||||||
|
@enduml
|
||||||
|
```
|
||||||
|
|
||||||
|
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
|
||||||
|
|
||||||
|
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
|
||||||
|
|
||||||
|
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
|
||||||
|
|
||||||
|
To add this specific Power to your project in JCB:
|
||||||
|
|
||||||
|
> simply use this SPK
|
||||||
|
```
|
||||||
|
Super---23ad6e72_1b82_40fb_836c_50da690bb174---Power
|
||||||
|
```
|
||||||
|
> remember to replace the `---` with `___` to activate this Power in your code
|
||||||
|
|
||||||
|
---
|
||||||
|
```
|
||||||
|
██╗ ██████╗██████╗
|
||||||
|
██║██╔════╝██╔══██╗
|
||||||
|
██║██║ ██████╔╝
|
||||||
|
██ ██║██║ ██╔══██╗
|
||||||
|
╚█████╔╝╚██████╗██████╔╝
|
||||||
|
╚════╝ ╚═════╝╚═════╝
|
||||||
|
```
|
||||||
|
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||||
|
|
109
src/23ad6e72-1b82-40fb-836c-50da690bb174/code.php
Normal file
109
src/23ad6e72-1b82-40fb-836c-50da690bb174/code.php
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
<?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;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Import Message Interface
|
||||||
|
*
|
||||||
|
* @since 3.0.2
|
||||||
|
*/
|
||||||
|
interface ImportMessageInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Load an entity that these message belong to
|
||||||
|
*
|
||||||
|
* @param string $guid The entity guid these messages must be linked to.
|
||||||
|
* @param string $entity The entity type these messages must be linked to.
|
||||||
|
* @param string $table The messages table where these message must be stored.
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @throws \InvalidArgumentException if any of the parameters are null or empty.
|
||||||
|
* @since 3.0.2
|
||||||
|
*/
|
||||||
|
public function load(string $guid, string $entity, string $table): self;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the messages of the last import event
|
||||||
|
*
|
||||||
|
* @return object
|
||||||
|
* @since 3.0.2
|
||||||
|
*/
|
||||||
|
public function get(): object;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset the messages of the last import event
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 3.0.2
|
||||||
|
*/
|
||||||
|
public function reset(): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Archive the messages in the DB of the last import event
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @throws \InvalidArgumentException if GUID, entity, or table is null.
|
||||||
|
* @since 3.0.2
|
||||||
|
*/
|
||||||
|
public function archive(): self;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the messages in the DB of the last import event
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @throws \InvalidArgumentException if GUID, entity, or table is null.
|
||||||
|
* @since 3.0.2
|
||||||
|
*/
|
||||||
|
public function set(): self;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a success message to the log.
|
||||||
|
*
|
||||||
|
* This method records a success message for the import process. The message provides
|
||||||
|
* relevant information, such as the number of rows processed and the success rate.
|
||||||
|
*
|
||||||
|
* @param string $message The success message to log.
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @since 3.0.2
|
||||||
|
*/
|
||||||
|
public function addSuccess(string $message): self;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a info message to the log.
|
||||||
|
*
|
||||||
|
* This method records a info message for the import process. The message provides
|
||||||
|
* relevant information, such as the number of rows processed and the info rate.
|
||||||
|
*
|
||||||
|
* @param string $message The info message to log.
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @since 3.0.2
|
||||||
|
*/
|
||||||
|
public function addInfo(string $message): self;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds an error message to the log.
|
||||||
|
*
|
||||||
|
* This method records an error message when the import process encounters issues.
|
||||||
|
* The message includes details about the failures, such as the number of failed rows
|
||||||
|
* and the corresponding error rate.
|
||||||
|
*
|
||||||
|
* @param string $message The error message to log.
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @since 3.0.2
|
||||||
|
*/
|
||||||
|
public function addError(string $message): self;
|
||||||
|
}
|
||||||
|
|
86
src/23ad6e72-1b82-40fb-836c-50da690bb174/code.power
Normal file
86
src/23ad6e72-1b82-40fb-836c-50da690bb174/code.power
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
/**
|
||||||
|
* Load an entity that these message belong to
|
||||||
|
*
|
||||||
|
* @param string $guid The entity guid these messages must be linked to.
|
||||||
|
* @param string $entity The entity type these messages must be linked to.
|
||||||
|
* @param string $table The messages table where these message must be stored.
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @throws \InvalidArgumentException if any of the parameters are null or empty.
|
||||||
|
* @since 3.0.2
|
||||||
|
*/
|
||||||
|
public function load(string $guid, string $entity, string $table): self;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the messages of the last import event
|
||||||
|
*
|
||||||
|
* @return object
|
||||||
|
* @since 3.0.2
|
||||||
|
*/
|
||||||
|
public function get(): object;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset the messages of the last import event
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 3.0.2
|
||||||
|
*/
|
||||||
|
public function reset(): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Archive the messages in the DB of the last import event
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @throws \InvalidArgumentException if GUID, entity, or table is null.
|
||||||
|
* @since 3.0.2
|
||||||
|
*/
|
||||||
|
public function archive(): self;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the messages in the DB of the last import event
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @throws \InvalidArgumentException if GUID, entity, or table is null.
|
||||||
|
* @since 3.0.2
|
||||||
|
*/
|
||||||
|
public function set(): self;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a success message to the log.
|
||||||
|
*
|
||||||
|
* This method records a success message for the import process. The message provides
|
||||||
|
* relevant information, such as the number of rows processed and the success rate.
|
||||||
|
*
|
||||||
|
* @param string $message The success message to log.
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @since 3.0.2
|
||||||
|
*/
|
||||||
|
public function addSuccess(string $message): self;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a info message to the log.
|
||||||
|
*
|
||||||
|
* This method records a info message for the import process. The message provides
|
||||||
|
* relevant information, such as the number of rows processed and the info rate.
|
||||||
|
*
|
||||||
|
* @param string $message The info message to log.
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @since 3.0.2
|
||||||
|
*/
|
||||||
|
public function addInfo(string $message): self;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds an error message to the log.
|
||||||
|
*
|
||||||
|
* This method records an error message when the import process encounters issues.
|
||||||
|
* The message includes details about the failures, such as the number of failed rows
|
||||||
|
* and the corresponding error rate.
|
||||||
|
*
|
||||||
|
* @param string $message The error message to log.
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @since 3.0.2
|
||||||
|
*/
|
||||||
|
public function addError(string $message): self;
|
19
src/23ad6e72-1b82-40fb-836c-50da690bb174/settings.json
Normal file
19
src/23ad6e72-1b82-40fb-836c-50da690bb174/settings.json
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"add_head": 0,
|
||||||
|
"add_licensing_template": 2,
|
||||||
|
"extends": "",
|
||||||
|
"guid": "23ad6e72-1b82-40fb-836c-50da690bb174",
|
||||||
|
"implements": null,
|
||||||
|
"load_selection": null,
|
||||||
|
"name": "ImportMessageInterface",
|
||||||
|
"power_version": "1.0.0",
|
||||||
|
"system_name": "VDM.ImportMessageInterface",
|
||||||
|
"type": "interface",
|
||||||
|
"use_selection": null,
|
||||||
|
"extendsinterfaces": null,
|
||||||
|
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Interfaces.ImportMessageInterface",
|
||||||
|
"description": "Import Message Interface\r\n\r\n@since 3.0.2",
|
||||||
|
"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": ""
|
||||||
|
}
|
68
src/250a7272-9ae1-4c63-a058-26bad9ad6f70/README.md
Normal file
68
src/250a7272-9ae1-4c63-a058-26bad9ad6f70/README.md
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
```
|
||||||
|
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||||
|
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||||
|
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||||
|
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||||
|
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||||
|
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||||
|
```
|
||||||
|
# interface ImportMapperInterface (Details)
|
||||||
|
> namespace: **VDM\Joomla\Componentbuilder\Interfaces**
|
||||||
|
|
||||||
|
```uml
|
||||||
|
@startuml
|
||||||
|
interface ImportMapperInterface #Lavender {
|
||||||
|
+ set(object $map, string $parentTable) : void
|
||||||
|
+ getParent() : array
|
||||||
|
+ getJoin() : array
|
||||||
|
}
|
||||||
|
|
||||||
|
note right of ImportMapperInterface::set
|
||||||
|
Set the tables mapper
|
||||||
|
|
||||||
|
since: 4.0.3
|
||||||
|
return: void
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of ImportMapperInterface::getParent
|
||||||
|
Get the parent table keys
|
||||||
|
|
||||||
|
since: 4.0.3
|
||||||
|
return: array
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of ImportMapperInterface::getJoin
|
||||||
|
Get the join tables keys
|
||||||
|
|
||||||
|
since: 4.0.3
|
||||||
|
return: array
|
||||||
|
end note
|
||||||
|
|
||||||
|
@enduml
|
||||||
|
```
|
||||||
|
|
||||||
|
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
|
||||||
|
|
||||||
|
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
|
||||||
|
|
||||||
|
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
|
||||||
|
|
||||||
|
To add this specific Power to your project in JCB:
|
||||||
|
|
||||||
|
> simply use this SPK
|
||||||
|
```
|
||||||
|
Super---250a7272_9ae1_4c63_a058_26bad9ad6f70---Power
|
||||||
|
```
|
||||||
|
> remember to replace the `---` with `___` to activate this Power in your code
|
||||||
|
|
||||||
|
---
|
||||||
|
```
|
||||||
|
██╗ ██████╗██████╗
|
||||||
|
██║██╔════╝██╔══██╗
|
||||||
|
██║██║ ██████╔╝
|
||||||
|
██ ██║██║ ██╔══██╗
|
||||||
|
╚█████╔╝╚██████╗██████╔╝
|
||||||
|
╚════╝ ╚═════╝╚═════╝
|
||||||
|
```
|
||||||
|
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||||
|
|
49
src/250a7272-9ae1-4c63-a058-26bad9ad6f70/code.php
Normal file
49
src/250a7272-9ae1-4c63-a058-26bad9ad6f70/code.php
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<?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;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Import Mapper Interface
|
||||||
|
*
|
||||||
|
* @since 3.0.3
|
||||||
|
*/
|
||||||
|
interface ImportMapperInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Set the tables mapper
|
||||||
|
*
|
||||||
|
* @param object $map The import file map.
|
||||||
|
* @param string $parentTable The parent table name.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
public function set(object $map, string $parentTable): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the parent table keys
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
public function getParent(): array;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the join tables keys
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
public function getJoin(): array;
|
||||||
|
}
|
||||||
|
|
26
src/250a7272-9ae1-4c63-a058-26bad9ad6f70/code.power
Normal file
26
src/250a7272-9ae1-4c63-a058-26bad9ad6f70/code.power
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
/**
|
||||||
|
* Set the tables mapper
|
||||||
|
*
|
||||||
|
* @param object $map The import file map.
|
||||||
|
* @param string $parentTable The parent table name.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
public function set(object $map, string $parentTable): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the parent table keys
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
public function getParent(): array;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the join tables keys
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
* @since 4.0.3
|
||||||
|
*/
|
||||||
|
public function getJoin(): array;
|
19
src/250a7272-9ae1-4c63-a058-26bad9ad6f70/settings.json
Normal file
19
src/250a7272-9ae1-4c63-a058-26bad9ad6f70/settings.json
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"add_head": 0,
|
||||||
|
"add_licensing_template": 2,
|
||||||
|
"extends": "",
|
||||||
|
"guid": "250a7272-9ae1-4c63-a058-26bad9ad6f70",
|
||||||
|
"implements": null,
|
||||||
|
"load_selection": null,
|
||||||
|
"name": "ImportMapperInterface",
|
||||||
|
"power_version": "1.0.0",
|
||||||
|
"system_name": "VDM.ImportMapperInterface",
|
||||||
|
"type": "interface",
|
||||||
|
"use_selection": null,
|
||||||
|
"extendsinterfaces": null,
|
||||||
|
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Interfaces.ImportMapperInterface",
|
||||||
|
"description": "Import Mapper Interface\r\n\r\n@since 3.0.3",
|
||||||
|
"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": ""
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"add_head": "0",
|
"add_head": 0,
|
||||||
"add_licensing_template": "2",
|
"add_licensing_template": 2,
|
||||||
"extends": "",
|
"extends": "",
|
||||||
"guid": "2ad31f74-f579-499d-b98b-c4f54fd615dd",
|
"guid": "2ad31f74-f579-499d-b98b-c4f54fd615dd",
|
||||||
"implements": null,
|
"implements": null,
|
||||||
|
@ -6,12 +6,12 @@
|
|||||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||||
```
|
```
|
||||||
# interface Tableinterface (Details)
|
# interface TableInterface (Details)
|
||||||
> namespace: **VDM\Joomla\Interfaces**
|
> namespace: **VDM\Joomla\Interfaces**
|
||||||
|
|
||||||
```uml
|
```uml
|
||||||
@startuml
|
@startuml
|
||||||
interface Tableinterface #Lavender {
|
interface TableInterface #Lavender {
|
||||||
+ get(?string $table = null, ?string $field = null, ...) : mixed
|
+ get(?string $table = null, ?string $field = null, ...) : mixed
|
||||||
+ title(string $table) : ?array
|
+ title(string $table) : ?array
|
||||||
+ titleName(string $table) : string
|
+ titleName(string $table) : string
|
||||||
@ -20,7 +20,7 @@ interface Tableinterface #Lavender {
|
|||||||
+ fields(string $table, bool $default = false, ...) : ?array
|
+ fields(string $table, bool $default = false, ...) : ?array
|
||||||
}
|
}
|
||||||
|
|
||||||
note right of Tableinterface::get
|
note right of TableInterface::get
|
||||||
Get any value from a item/field/column of an area/view/table
|
Get any value from a item/field/column of an area/view/table
|
||||||
Example: $this->get('table_name', 'field_name', 'value_key');
|
Example: $this->get('table_name', 'field_name', 'value_key');
|
||||||
Get an item/field/column of an area/view/table
|
Get an item/field/column of an area/view/table
|
||||||
@ -40,35 +40,35 @@ Example: $this->get();
|
|||||||
?string $key = null
|
?string $key = null
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note right of Tableinterface::title
|
note right of TableInterface::title
|
||||||
Get title field from an area/view/table
|
Get title field from an area/view/table
|
||||||
|
|
||||||
since: 3.2.0
|
since: 3.2.0
|
||||||
return: ?array
|
return: ?array
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note right of Tableinterface::titleName
|
note right of TableInterface::titleName
|
||||||
Get title field name
|
Get title field name
|
||||||
|
|
||||||
since: 3.2.0
|
since: 3.2.0
|
||||||
return: string
|
return: string
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note right of Tableinterface::tables
|
note right of TableInterface::tables
|
||||||
Get all tables
|
Get all tables
|
||||||
|
|
||||||
since: 3.2.0
|
since: 3.2.0
|
||||||
return: array
|
return: array
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note right of Tableinterface::exist
|
note right of TableInterface::exist
|
||||||
Check if a table (and field) exist
|
Check if a table (and field) exist
|
||||||
|
|
||||||
since: 3.2.0
|
since: 3.2.0
|
||||||
return: bool
|
return: bool
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note right of Tableinterface::fields
|
note right of TableInterface::fields
|
||||||
Get all fields of an area/view/table
|
Get all fields of an area/view/table
|
||||||
|
|
||||||
since: 3.2.0
|
since: 3.2.0
|
||||||
|
@ -15,7 +15,7 @@ namespace VDM\Joomla\Interfaces;
|
|||||||
/**
|
/**
|
||||||
* The VDM Core Table Interface
|
* The VDM Core Table Interface
|
||||||
*/
|
*/
|
||||||
interface Tableinterface
|
interface TableInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get any value from a item/field/column of an area/view/table
|
* Get any value from a item/field/column of an area/view/table
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
{
|
{
|
||||||
"add_head": "0",
|
"add_head": 0,
|
||||||
"add_licensing_template": "2",
|
"add_licensing_template": 2,
|
||||||
"extends": "",
|
"extends": "",
|
||||||
"guid": "2da6d6c4-eb29-4d69-8bc2-36d96e916adf",
|
"guid": "2da6d6c4-eb29-4d69-8bc2-36d96e916adf",
|
||||||
"implements": null,
|
"implements": null,
|
||||||
"load_selection": null,
|
"load_selection": null,
|
||||||
"name": "Tableinterface",
|
"name": "TableInterface",
|
||||||
"power_version": "1.0.0",
|
"power_version": "1.0.0",
|
||||||
"system_name": "VDM.Interfaces.Tableinterface",
|
"system_name": "VDM.Interfaces.TableInterface",
|
||||||
"type": "interface",
|
"type": "interface",
|
||||||
"use_selection": null,
|
"use_selection": null,
|
||||||
"extendsinterfaces": null,
|
"extendsinterfaces": null,
|
||||||
"namespace": "[[[NamespacePrefix]]]\\Joomla\\Interfaces.Tableinterface",
|
"namespace": "[[[NamespacePrefix]]]\\Joomla\\Interfaces.TableInterface",
|
||||||
"description": "The VDM Core Table Interface",
|
"description": "The VDM Core Table Interface",
|
||||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
"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": "",
|
"head": "",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"add_head": "1",
|
"add_head": 1,
|
||||||
"add_licensing_template": "2",
|
"add_licensing_template": 2,
|
||||||
"extends": "",
|
"extends": "",
|
||||||
"guid": "2dcedd6c-c95b-4a37-9cac-95d28faedca3",
|
"guid": "2dcedd6c-c95b-4a37-9cac-95d28faedca3",
|
||||||
"implements": [
|
"implements": [
|
||||||
|
@ -35,14 +35,6 @@ use VDM\Joomla\Interfaces\FactoryInterface;
|
|||||||
**/
|
**/
|
||||||
abstract class Factory implements FactoryInterface
|
abstract class Factory implements FactoryInterface
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Global Package Container
|
|
||||||
*
|
|
||||||
* @var Container|null
|
|
||||||
* @since 0.0.0
|
|
||||||
**/
|
|
||||||
protected static ?Container $container = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get any class from the package container
|
* Get any class from the package container
|
||||||
*
|
*
|
||||||
|
@ -1,11 +1,3 @@
|
|||||||
/**
|
|
||||||
* Global Package Container
|
|
||||||
*
|
|
||||||
* @var Container|null
|
|
||||||
* @since 0.0.0
|
|
||||||
**/
|
|
||||||
protected static ?Container $container = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get any class from the package container
|
* Get any class from the package container
|
||||||
*
|
*
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"add_head": "1",
|
"add_head": 1,
|
||||||
"add_licensing_template": "2",
|
"add_licensing_template": 2,
|
||||||
"extends": "",
|
"extends": "",
|
||||||
"guid": "2e5bf608-de5c-4b00-a20d-47c26aa350d9",
|
"guid": "2e5bf608-de5c-4b00-a20d-47c26aa350d9",
|
||||||
"implements": [
|
"implements": [
|
||||||
|
121
src/2f14ec19-1b67-44be-8306-2a9e74588464/README.md
Normal file
121
src/2f14ec19-1b67-44be-8306-2a9e74588464/README.md
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
```
|
||||||
|
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||||
|
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||||
|
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||||
|
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||||
|
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||||
|
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||||
|
```
|
||||||
|
# final class Import (Details)
|
||||||
|
> namespace: **VDM\Joomla\Componentbuilder\Item**
|
||||||
|
|
||||||
|
```uml
|
||||||
|
@startuml
|
||||||
|
class Import << (F,LightGreen) >> #RoyalBlue {
|
||||||
|
# int $startingRow
|
||||||
|
# string $parentTable
|
||||||
|
# string $parentKey
|
||||||
|
# string $parentJoinKey
|
||||||
|
# string $linkField
|
||||||
|
# string $importTable
|
||||||
|
# Status $status
|
||||||
|
# Message $message
|
||||||
|
# Mapper $mapper
|
||||||
|
# Data $data
|
||||||
|
# Importer $importer
|
||||||
|
# RowData $rowdata
|
||||||
|
# Row $row
|
||||||
|
# ParentTable $parentTableClass
|
||||||
|
# JoinTables $joinTables
|
||||||
|
# Assessor $assessor
|
||||||
|
# Item $item
|
||||||
|
+ __construct(Status $status, Message $message, ...)
|
||||||
|
+ data(object $import) : void
|
||||||
|
+ message() : object
|
||||||
|
- prematureError(string $guid, string $message) : void
|
||||||
|
- import() : ?string
|
||||||
|
- getFile(string $file) : ?object
|
||||||
|
}
|
||||||
|
|
||||||
|
note right of Import::__construct
|
||||||
|
Constructor.
|
||||||
|
|
||||||
|
since: 5.0.2
|
||||||
|
|
||||||
|
arguments:
|
||||||
|
Status $status
|
||||||
|
Message $message
|
||||||
|
Mapper $mapper
|
||||||
|
Data $data
|
||||||
|
Importer $importer
|
||||||
|
RowData $rowdata
|
||||||
|
Row $row
|
||||||
|
ParentTable $parentTableClass
|
||||||
|
JoinTables $joinTables
|
||||||
|
Assessor $assessor
|
||||||
|
Item $item
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Import::data
|
||||||
|
The trigger function called from the CLI to start the item import on a spreadsheet
|
||||||
|
|
||||||
|
since: 5.0.2
|
||||||
|
return: void
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Import::message
|
||||||
|
The message of the last import event
|
||||||
|
|
||||||
|
since: 5.0.2
|
||||||
|
return: object
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Import::prematureError
|
||||||
|
This is trigger on premature error
|
||||||
|
|
||||||
|
since: 5.0.2
|
||||||
|
return: void
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Import::import
|
||||||
|
Save the item calculated values
|
||||||
|
|
||||||
|
since: 5.0.2
|
||||||
|
return: ?string
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of Import::getFile
|
||||||
|
Get the file details
|
||||||
|
|
||||||
|
since: 5.0.2
|
||||||
|
return: ?object
|
||||||
|
end note
|
||||||
|
|
||||||
|
@enduml
|
||||||
|
```
|
||||||
|
|
||||||
|
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
|
||||||
|
|
||||||
|
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
|
||||||
|
|
||||||
|
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
|
||||||
|
|
||||||
|
To add this specific Power to your project in JCB:
|
||||||
|
|
||||||
|
> simply use this SPK
|
||||||
|
```
|
||||||
|
Super---2f14ec19_1b67_44be_8306_2a9e74588464---Power
|
||||||
|
```
|
||||||
|
> remember to replace the `---` with `___` to activate this Power in your code
|
||||||
|
|
||||||
|
---
|
||||||
|
```
|
||||||
|
██╗ ██████╗██████╗
|
||||||
|
██║██╔════╝██╔══██╗
|
||||||
|
██║██║ ██████╔╝
|
||||||
|
██ ██║██║ ██╔══██╗
|
||||||
|
╚█████╔╝╚██████╗██████╔╝
|
||||||
|
╚════╝ ╚═════╝╚═════╝
|
||||||
|
```
|
||||||
|
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||||
|
|
371
src/2f14ec19-1b67-44be-8306-2a9e74588464/code.php
Normal file
371
src/2f14ec19-1b67-44be-8306-2a9e74588464/code.php
Normal file
@ -0,0 +1,371 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Component.Builder
|
||||||
|
*
|
||||||
|
* @created 4th September, 2020
|
||||||
|
* @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\Item;
|
||||||
|
|
||||||
|
|
||||||
|
use Joomla\CMS\Language\Text;
|
||||||
|
use VDM\Joomla\Componentbuilder\Interfaces\ImportStatusInterface as Status;
|
||||||
|
use VDM\Joomla\Componentbuilder\Interfaces\ImportMessageInterface as Message;
|
||||||
|
use VDM\Joomla\Componentbuilder\Interfaces\ImportMapperInterface as Mapper;
|
||||||
|
use VDM\Joomla\Componentbuilder\Import\Data;
|
||||||
|
use VDM\Joomla\Componentbuilder\Spreadsheet\Importer;
|
||||||
|
use VDM\Joomla\Componentbuilder\Spreadsheet\RowDataArray as RowData;
|
||||||
|
use VDM\Joomla\Componentbuilder\Interfaces\ImportRowInterface as Row;
|
||||||
|
use VDM\Joomla\Componentbuilder\Item\Import\ParentTable;
|
||||||
|
use VDM\Joomla\Componentbuilder\Item\Import\JoinTables;
|
||||||
|
use VDM\Joomla\Componentbuilder\Interfaces\ImportAssessorInterface as Assessor;
|
||||||
|
use VDM\Joomla\Interfaces\Data\ItemInterface as Item;
|
||||||
|
use VDM\Joomla\Componentbuilder\Interfaces\Spreadsheet\ImportCliInterface;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Item Import Class
|
||||||
|
*
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
final class Import implements ImportCliInterface
|
||||||
|
{
|
||||||
|
/**************************************************************************
|
||||||
|
* THESE VALUES BELOW SHOULD BE UPDATE FOR YOUR USE-CASE
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The starting row.
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected int $startingRow = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The the parent table of each row
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected string $parentTable = 'look';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The the parent table key field
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected string $parentKey = 'guid';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The the parent join key field to other tables
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected string $parentJoinKey = 'entity';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The the parent table key field to link a row to existing data
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected string $linkField = 'guid';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The the import queue table
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected string $importTable = 'item_import';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* THESE VALUES ABOVE SHOULD BE UPDATE FOR YOUR USE-CASE
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Import Status Class.
|
||||||
|
*
|
||||||
|
* @var Status
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected Status $status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Import Message Class.
|
||||||
|
*
|
||||||
|
* @var Message
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected Message $message;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Import Mapper Class.
|
||||||
|
*
|
||||||
|
* @var Mapper
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected Mapper $mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Data Class.
|
||||||
|
*
|
||||||
|
* @var Data
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected Data $data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Importer Class.
|
||||||
|
*
|
||||||
|
* @var Importer
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected Importer $importer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Row Data Array Class.
|
||||||
|
*
|
||||||
|
* @var RowData
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected RowData $rowdata;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Import Row Class.
|
||||||
|
*
|
||||||
|
* @var Row
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected Row $row;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Parent Table Class.
|
||||||
|
*
|
||||||
|
* @var ParentTable
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected ParentTable $parentTableClass;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Join Tables Class.
|
||||||
|
*
|
||||||
|
* @var JoinTables
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected JoinTables $joinTables;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Import Assessor Class.
|
||||||
|
*
|
||||||
|
* @var Assessor
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected Assessor $assessor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Item Class.
|
||||||
|
*
|
||||||
|
* @var Item
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected Item $item;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param Status $status The Import Status Class.
|
||||||
|
* @param Message $message The Import Message Class.
|
||||||
|
* @param Mapper $mapper The Import Mapper Class.
|
||||||
|
* @param Data $data The Data Class.
|
||||||
|
* @param Importer $importer The Importer Class.
|
||||||
|
* @param RowData $rowdata The Row Data Array Class.
|
||||||
|
* @param Row $row The Import Row Class.
|
||||||
|
* @param ParentTable $parentTableClass The Parent Class.
|
||||||
|
* @param JoinTables $join The Join Class.
|
||||||
|
* @param Assessor $assessor The Import Assessor Class.
|
||||||
|
* @param Item $item The Item Class.
|
||||||
|
*
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function __construct(Status $status, Message $message, Mapper $mapper,
|
||||||
|
Data $data, Importer $importer, RowData $rowdata,
|
||||||
|
Row $row, ParentTable $parentTableClass, JoinTables $joinTables,
|
||||||
|
Assessor $assessor, Item $item)
|
||||||
|
{
|
||||||
|
$this->status = $status;
|
||||||
|
$this->message = $message;
|
||||||
|
$this->mapper = $mapper;
|
||||||
|
$this->data = $data;
|
||||||
|
$this->importer = $importer;
|
||||||
|
$this->rowdata = $rowdata;
|
||||||
|
$this->row = $row;
|
||||||
|
$this->parentTableClass = $parentTableClass;
|
||||||
|
$this->joinTables = $joinTables;
|
||||||
|
$this->assessor = $assessor;
|
||||||
|
$this->item = $item;
|
||||||
|
|
||||||
|
// load the status target table and field
|
||||||
|
$this->status->table($this->importTable)->field('import_status');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The trigger function called from the CLI to start the item import on a spreadsheet
|
||||||
|
*
|
||||||
|
* @param object $import The spreadsheet data to import.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function data(object $import): void
|
||||||
|
{
|
||||||
|
// move spreadsheet into 2=processing
|
||||||
|
$this->status->set(2, $import->guid);
|
||||||
|
|
||||||
|
// load message
|
||||||
|
$this->message->load($import->guid, $this->importTable, 'message_log');
|
||||||
|
|
||||||
|
if (empty($import->file) || ($file = $this->getFile($import->file)) === null)
|
||||||
|
{
|
||||||
|
$this->prematureError($import->guid, Text::_('COM_COMPONENTBUILDER_FILE_DATA_COULD_NOT_BE_FOUND'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// check file path
|
||||||
|
if (!is_file($file->file_path))
|
||||||
|
{
|
||||||
|
$this->prematureError($import->guid, Text::sprintf('COM_COMPONENTBUILDER_FILE_NOT_FOUND_S', $file->file_path));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->mapper->set($import->maps, $this->parentTable);
|
||||||
|
unset($import->maps);
|
||||||
|
|
||||||
|
$this->data->set('import', (array) $import);
|
||||||
|
|
||||||
|
$rowCounter = 0;
|
||||||
|
$successCounter = 0;
|
||||||
|
$errorCounter = 0;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
foreach ($this->importer->read($file->file_path, $this->startingRow, 100, $this->rowdata) as $row)
|
||||||
|
{
|
||||||
|
// ignore empty rows
|
||||||
|
if ($row === null || empty($row['values']) || count((array) $row['values']) <= 3 || empty($row['index']))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->row->set($row['index'], $row['values']);
|
||||||
|
|
||||||
|
$rowCounter++;
|
||||||
|
if (($guid = $this->import()) !== null)
|
||||||
|
{
|
||||||
|
// TODO: we can add extra code here for more adaptation/calculation of import data
|
||||||
|
$successCounter++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$errorCounter++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->row->clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check the success rate after processing all rows
|
||||||
|
$this->assessor->evaluate($rowCounter, $successCounter, $errorCounter);
|
||||||
|
}
|
||||||
|
catch (\InvalidArgumentException $e)
|
||||||
|
{
|
||||||
|
// Handle invalid argument exception (e.g., file not found)
|
||||||
|
$this->message->addError(Text::sprintf('COM_COMPONENTBUILDER_ERROR_INVALID_ARGUMENT_S', $e->getMessage()));
|
||||||
|
}
|
||||||
|
catch (\OutOfRangeException $e)
|
||||||
|
{
|
||||||
|
// Handle out of range exception (e.g., start row beyond highest row)
|
||||||
|
$this->message->addError(Text::sprintf('COM_COMPONENTBUILDER_ERROR_OUT_OF_RANGE_S', $e->getMessage()));
|
||||||
|
}
|
||||||
|
catch (\Exception $e)
|
||||||
|
{
|
||||||
|
// Catch any other general exceptions
|
||||||
|
$this->message->addError($e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The message of the last import event
|
||||||
|
*
|
||||||
|
* @return object
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function message(): object
|
||||||
|
{
|
||||||
|
$messages = $this->message->archive()->set()->get();
|
||||||
|
$this->message->reset();
|
||||||
|
return $messages;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is trigger on premature error
|
||||||
|
*
|
||||||
|
* @param string $guid The import guid.
|
||||||
|
* @param string $message The error message.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
private function prematureError(string $guid, string $message): void
|
||||||
|
{
|
||||||
|
$this->status->set(4, $guid);
|
||||||
|
$this->message->addError($message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save the item calculated values
|
||||||
|
*
|
||||||
|
* @return string|null
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
private function import(): ?string
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$parent_guid = $this->parentTableClass->set($this->linkField, $this->parentKey, $this->parentTable);
|
||||||
|
|
||||||
|
if ($parent_guid === null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->joinTables->set($this->parentJoinKey, $parent_guid);
|
||||||
|
|
||||||
|
return $parent_guid;
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (\Exception $e)
|
||||||
|
{
|
||||||
|
$this->message->addError($e->getMessage());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the file details
|
||||||
|
*
|
||||||
|
* @param string $file The file guid.
|
||||||
|
*
|
||||||
|
* @return object|null
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
private function getFile(string $file): ?object
|
||||||
|
{
|
||||||
|
return $this->item->table('file')->get($file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
334
src/2f14ec19-1b67-44be-8306-2a9e74588464/code.power
Normal file
334
src/2f14ec19-1b67-44be-8306-2a9e74588464/code.power
Normal file
@ -0,0 +1,334 @@
|
|||||||
|
/**************************************************************************
|
||||||
|
* THESE VALUES BELOW SHOULD BE UPDATE FOR YOUR USE-CASE
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The starting row.
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected int $startingRow = 2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The the parent table of each row
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected string $parentTable = 'look';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The the parent table key field
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected string $parentKey = 'guid';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The the parent join key field to other tables
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected string $parentJoinKey = 'entity';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The the parent table key field to link a row to existing data
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected string $linkField = 'guid';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The the import queue table
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected string $importTable = 'item_import';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* THESE VALUES ABOVE SHOULD BE UPDATE FOR YOUR USE-CASE
|
||||||
|
**************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Import Status Class.
|
||||||
|
*
|
||||||
|
* @var Status
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected Status $status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Import Message Class.
|
||||||
|
*
|
||||||
|
* @var Message
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected Message $message;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Import Mapper Class.
|
||||||
|
*
|
||||||
|
* @var Mapper
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected Mapper $mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Data Class.
|
||||||
|
*
|
||||||
|
* @var Data
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected Data $data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Importer Class.
|
||||||
|
*
|
||||||
|
* @var Importer
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected Importer $importer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Row Data Array Class.
|
||||||
|
*
|
||||||
|
* @var RowData
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected RowData $rowdata;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Import Row Class.
|
||||||
|
*
|
||||||
|
* @var Row
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected Row $row;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Parent Table Class.
|
||||||
|
*
|
||||||
|
* @var ParentTable
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected ParentTable $parentTableClass;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Join Tables Class.
|
||||||
|
*
|
||||||
|
* @var JoinTables
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected JoinTables $joinTables;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Import Assessor Class.
|
||||||
|
*
|
||||||
|
* @var Assessor
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected Assessor $assessor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Item Class.
|
||||||
|
*
|
||||||
|
* @var Item
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
protected Item $item;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param Status $status The Import Status Class.
|
||||||
|
* @param Message $message The Import Message Class.
|
||||||
|
* @param Mapper $mapper The Import Mapper Class.
|
||||||
|
* @param Data $data The Data Class.
|
||||||
|
* @param Importer $importer The Importer Class.
|
||||||
|
* @param RowData $rowdata The Row Data Array Class.
|
||||||
|
* @param Row $row The Import Row Class.
|
||||||
|
* @param ParentTable $parentTableClass The Parent Class.
|
||||||
|
* @param JoinTables $join The Join Class.
|
||||||
|
* @param Assessor $assessor The Import Assessor Class.
|
||||||
|
* @param Item $item The Item Class.
|
||||||
|
*
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function __construct(Status $status, Message $message, Mapper $mapper,
|
||||||
|
Data $data, Importer $importer, RowData $rowdata,
|
||||||
|
Row $row, ParentTable $parentTableClass, JoinTables $joinTables,
|
||||||
|
Assessor $assessor, Item $item)
|
||||||
|
{
|
||||||
|
$this->status = $status;
|
||||||
|
$this->message = $message;
|
||||||
|
$this->mapper = $mapper;
|
||||||
|
$this->data = $data;
|
||||||
|
$this->importer = $importer;
|
||||||
|
$this->rowdata = $rowdata;
|
||||||
|
$this->row = $row;
|
||||||
|
$this->parentTableClass = $parentTableClass;
|
||||||
|
$this->joinTables = $joinTables;
|
||||||
|
$this->assessor = $assessor;
|
||||||
|
$this->item = $item;
|
||||||
|
|
||||||
|
// load the status target table and field
|
||||||
|
$this->status->table($this->importTable)->field('import_status');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The trigger function called from the CLI to start the item import on a spreadsheet
|
||||||
|
*
|
||||||
|
* @param object $import The spreadsheet data to import.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function data(object $import): void
|
||||||
|
{
|
||||||
|
// move spreadsheet into 2=processing
|
||||||
|
$this->status->set(2, $import->guid);
|
||||||
|
|
||||||
|
// load message
|
||||||
|
$this->message->load($import->guid, $this->importTable, 'message_log');
|
||||||
|
|
||||||
|
if (empty($import->file) || ($file = $this->getFile($import->file)) === null)
|
||||||
|
{
|
||||||
|
$this->prematureError($import->guid, Text::_('File data could not be found.'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// check file path
|
||||||
|
if (!is_file($file->file_path))
|
||||||
|
{
|
||||||
|
$this->prematureError($import->guid, Text::sprintf('File not found: %s', $file->file_path));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->mapper->set($import->maps, $this->parentTable);
|
||||||
|
unset($import->maps);
|
||||||
|
|
||||||
|
$this->data->set('import', (array) $import);
|
||||||
|
|
||||||
|
$rowCounter = 0;
|
||||||
|
$successCounter = 0;
|
||||||
|
$errorCounter = 0;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
foreach ($this->importer->read($file->file_path, $this->startingRow, 100, $this->rowdata) as $row)
|
||||||
|
{
|
||||||
|
// ignore empty rows
|
||||||
|
if ($row === null || empty($row['values']) || count((array) $row['values']) <= 3 || empty($row['index']))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->row->set($row['index'], $row['values']);
|
||||||
|
|
||||||
|
$rowCounter++;
|
||||||
|
if (($guid = $this->import()) !== null)
|
||||||
|
{
|
||||||
|
// TODO: we can add extra code here for more adaptation/calculation of import data
|
||||||
|
$successCounter++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$errorCounter++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->row->clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check the success rate after processing all rows
|
||||||
|
$this->assessor->evaluate($rowCounter, $successCounter, $errorCounter);
|
||||||
|
}
|
||||||
|
catch (\InvalidArgumentException $e)
|
||||||
|
{
|
||||||
|
// Handle invalid argument exception (e.g., file not found)
|
||||||
|
$this->message->addError(Text::sprintf('Error: Invalid argument - %s', $e->getMessage()));
|
||||||
|
}
|
||||||
|
catch (\OutOfRangeException $e)
|
||||||
|
{
|
||||||
|
// Handle out of range exception (e.g., start row beyond highest row)
|
||||||
|
$this->message->addError(Text::sprintf('Error: Out of range - %s', $e->getMessage()));
|
||||||
|
}
|
||||||
|
catch (\Exception $e)
|
||||||
|
{
|
||||||
|
// Catch any other general exceptions
|
||||||
|
$this->message->addError($e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The message of the last import event
|
||||||
|
*
|
||||||
|
* @return object
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function message(): object
|
||||||
|
{
|
||||||
|
$messages = $this->message->archive()->set()->get();
|
||||||
|
$this->message->reset();
|
||||||
|
return $messages;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is trigger on premature error
|
||||||
|
*
|
||||||
|
* @param string $guid The import guid.
|
||||||
|
* @param string $message The error message.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
private function prematureError(string $guid, string $message): void
|
||||||
|
{
|
||||||
|
$this->status->set(4, $guid);
|
||||||
|
$this->message->addError($message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save the item calculated values
|
||||||
|
*
|
||||||
|
* @return string|null
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
private function import(): ?string
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$parent_guid = $this->parentTableClass->set($this->linkField, $this->parentKey, $this->parentTable);
|
||||||
|
|
||||||
|
if ($parent_guid === null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->joinTables->set($this->parentJoinKey, $parent_guid);
|
||||||
|
|
||||||
|
return $parent_guid;
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (\Exception $e)
|
||||||
|
{
|
||||||
|
$this->message->addError($e->getMessage());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the file details
|
||||||
|
*
|
||||||
|
* @param string $file The file guid.
|
||||||
|
*
|
||||||
|
* @return object|null
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
private function getFile(string $file): ?object
|
||||||
|
{
|
||||||
|
return $this->item->table('file')->get($file);
|
||||||
|
}
|
66
src/2f14ec19-1b67-44be-8306-2a9e74588464/settings.json
Normal file
66
src/2f14ec19-1b67-44be-8306-2a9e74588464/settings.json
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
{
|
||||||
|
"add_head": 1,
|
||||||
|
"add_licensing_template": 2,
|
||||||
|
"extends": "",
|
||||||
|
"guid": "2f14ec19-1b67-44be-8306-2a9e74588464",
|
||||||
|
"implements": [
|
||||||
|
"0f3f7188-3e0d-4d1a-8dee-7f8026cb65a9"
|
||||||
|
],
|
||||||
|
"load_selection": null,
|
||||||
|
"name": "Import",
|
||||||
|
"power_version": "1.0.0",
|
||||||
|
"system_name": "JCB.Item.Import",
|
||||||
|
"type": "final class",
|
||||||
|
"use_selection": {
|
||||||
|
"use_selection0": {
|
||||||
|
"use": "0e44d149-4863-47ec-8f0f-6a821ab3e77f",
|
||||||
|
"as": "Status"
|
||||||
|
},
|
||||||
|
"use_selection1": {
|
||||||
|
"use": "23ad6e72-1b82-40fb-836c-50da690bb174",
|
||||||
|
"as": "Message"
|
||||||
|
},
|
||||||
|
"use_selection2": {
|
||||||
|
"use": "250a7272-9ae1-4c63-a058-26bad9ad6f70",
|
||||||
|
"as": "Mapper"
|
||||||
|
},
|
||||||
|
"use_selection3": {
|
||||||
|
"use": "05f23281-58e3-482e-be42-2dc1355ef4ea",
|
||||||
|
"as": "default"
|
||||||
|
},
|
||||||
|
"use_selection4": {
|
||||||
|
"use": "c4169332-3914-400e-b861-972b2d465963",
|
||||||
|
"as": "default"
|
||||||
|
},
|
||||||
|
"use_selection5": {
|
||||||
|
"use": "36063502-2115-4c8d-b16a-0c76cc8c1ada",
|
||||||
|
"as": "RowData"
|
||||||
|
},
|
||||||
|
"use_selection6": {
|
||||||
|
"use": "3d3ec064-9867-41e6-a48a-964c15d753aa",
|
||||||
|
"as": "Row"
|
||||||
|
},
|
||||||
|
"use_selection7": {
|
||||||
|
"use": "cc923dc9-8f5c-46ea-810c-d93df2e5752b",
|
||||||
|
"as": "default"
|
||||||
|
},
|
||||||
|
"use_selection8": {
|
||||||
|
"use": "db00768d-c7a6-421d-8f39-577550ddf792",
|
||||||
|
"as": "default"
|
||||||
|
},
|
||||||
|
"use_selection9": {
|
||||||
|
"use": "57c00d53-5581-4fd1-b3ea-080422710243",
|
||||||
|
"as": "Assessor"
|
||||||
|
},
|
||||||
|
"use_selection10": {
|
||||||
|
"use": "05744dd3-4030-4cf8-8dda-a93ab809b473",
|
||||||
|
"as": "Item"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"extendsinterfaces": null,
|
||||||
|
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Item.Import",
|
||||||
|
"description": "Item Import Class\r\n\r\n@since 5.0.2",
|
||||||
|
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2020\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 *\/",
|
||||||
|
"head": "use Joomla\\CMS\\Language\\Text;",
|
||||||
|
"composer": ""
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"add_head": "0",
|
"add_head": 0,
|
||||||
"add_licensing_template": "2",
|
"add_licensing_template": 2,
|
||||||
"extends": "",
|
"extends": "",
|
||||||
"guid": "30c5b4c2-f75f-4d15-869a-f8bfedd87358",
|
"guid": "30c5b4c2-f75f-4d15-869a-f8bfedd87358",
|
||||||
"implements": null,
|
"implements": null,
|
||||||
|
@ -36,6 +36,7 @@ note right of SubformInterface::get
|
|||||||
string $linkKey
|
string $linkKey
|
||||||
string $field
|
string $field
|
||||||
array $get
|
array $get
|
||||||
|
bool $multi = true
|
||||||
end note
|
end note
|
||||||
|
|
||||||
note right of SubformInterface::set
|
note right of SubformInterface::set
|
||||||
|
@ -36,11 +36,12 @@ interface SubformInterface
|
|||||||
* @param string $linkKey The link key on which the items where linked in the child table.
|
* @param string $linkKey The link key on which the items where linked in the child table.
|
||||||
* @param string $field The parent field name of the subform in the parent view.
|
* @param string $field The parent field name of the subform in the parent view.
|
||||||
* @param array $get The array SET of the keys of each row in the subform.
|
* @param array $get The array SET of the keys of each row in the subform.
|
||||||
|
* @param bool $multi The switch to return a multiple set.
|
||||||
*
|
*
|
||||||
* @return array|null The subform
|
* @return array|null The subform
|
||||||
* @since 3.2.2
|
* @since 3.2.2
|
||||||
*/
|
*/
|
||||||
public function get(string $linkValue, string $linkKey, string $field, array $get): ?array;
|
public function get(string $linkValue, string $linkKey, string $field, array $get, bool $multi = true): ?array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a subform items
|
* Set a subform items
|
||||||
|
@ -15,11 +15,12 @@
|
|||||||
* @param string $linkKey The link key on which the items where linked in the child table.
|
* @param string $linkKey The link key on which the items where linked in the child table.
|
||||||
* @param string $field The parent field name of the subform in the parent view.
|
* @param string $field The parent field name of the subform in the parent view.
|
||||||
* @param array $get The array SET of the keys of each row in the subform.
|
* @param array $get The array SET of the keys of each row in the subform.
|
||||||
|
* @param bool $multi The switch to return a multiple set.
|
||||||
*
|
*
|
||||||
* @return array|null The subform
|
* @return array|null The subform
|
||||||
* @since 3.2.2
|
* @since 3.2.2
|
||||||
*/
|
*/
|
||||||
public function get(string $linkValue, string $linkKey, string $field, array $get): ?array;
|
public function get(string $linkValue, string $linkKey, string $field, array $get, bool $multi = true): ?array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a subform items
|
* Set a subform items
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"add_head": "0",
|
"add_head": 0,
|
||||||
"add_licensing_template": "2",
|
"add_licensing_template": 2,
|
||||||
"extends": "",
|
"extends": "",
|
||||||
"guid": "34959721-415b-4b5e-8002-3d1fc84b3b2b",
|
"guid": "34959721-415b-4b5e-8002-3d1fc84b3b2b",
|
||||||
"implements": null,
|
"implements": null,
|
||||||
|
58
src/36063502-2115-4c8d-b16a-0c76cc8c1ada/README.md
Normal file
58
src/36063502-2115-4c8d-b16a-0c76cc8c1ada/README.md
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
```
|
||||||
|
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||||
|
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||||
|
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||||
|
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||||
|
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||||
|
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||||
|
```
|
||||||
|
# final class RowDataArray (Details)
|
||||||
|
> namespace: **VDM\Joomla\Componentbuilder\Spreadsheet**
|
||||||
|
|
||||||
|
```uml
|
||||||
|
@startuml
|
||||||
|
class RowDataArray << (F,LightGreen) >> #RoyalBlue {
|
||||||
|
+ process(Row $row) : ?array
|
||||||
|
}
|
||||||
|
|
||||||
|
note right of RowDataArray::process
|
||||||
|
Processes a given spreadsheet row and returns an associative array containing the row index and cell values indexed by column letters.
|
||||||
|
This method iterates over each cell in the provided row, retrieves the cell values, and creates
|
||||||
|
an associative array where 'index' holds the row index and 'value' contains an associative array
|
||||||
|
of column letters as keys and cell values as the corresponding values.
|
||||||
|
- 'index' (int): The row index.
|
||||||
|
- 'values' (array<string, string>): An associative array where keys are the column letters
|
||||||
|
(string), and values are the corresponding cell values (string).
|
||||||
|
|
||||||
|
since: 5.0.2
|
||||||
|
return: ?array
|
||||||
|
end note
|
||||||
|
|
||||||
|
@enduml
|
||||||
|
```
|
||||||
|
|
||||||
|
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
|
||||||
|
|
||||||
|
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
|
||||||
|
|
||||||
|
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
|
||||||
|
|
||||||
|
To add this specific Power to your project in JCB:
|
||||||
|
|
||||||
|
> simply use this SPK
|
||||||
|
```
|
||||||
|
Super---36063502_2115_4c8d_b16a_0c76cc8c1ada---Power
|
||||||
|
```
|
||||||
|
> remember to replace the `---` with `___` to activate this Power in your code
|
||||||
|
|
||||||
|
---
|
||||||
|
```
|
||||||
|
██╗ ██████╗██████╗
|
||||||
|
██║██╔════╝██╔══██╗
|
||||||
|
██║██║ ██████╔╝
|
||||||
|
██ ██║██║ ██╔══██╗
|
||||||
|
╚█████╔╝╚██████╗██████╔╝
|
||||||
|
╚════╝ ╚═════╝╚═════╝
|
||||||
|
```
|
||||||
|
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||||
|
|
59
src/36063502-2115-4c8d-b16a-0c76cc8c1ada/code.php
Normal file
59
src/36063502-2115-4c8d-b16a-0c76cc8c1ada/code.php
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package Joomla.Component.Builder
|
||||||
|
*
|
||||||
|
* @created 4th September, 2020
|
||||||
|
* @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\Spreadsheet;
|
||||||
|
|
||||||
|
|
||||||
|
use PhpOffice\PhpSpreadsheet\Worksheet\Row;
|
||||||
|
use VDM\Joomla\Componentbuilder\Interfaces\Spreadsheet\RowDataProcessorInterface;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Spreadsheet Row Data Array
|
||||||
|
*
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
final class RowDataArray implements RowDataProcessorInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Processes a given spreadsheet row and returns an associative array containing the row index and cell values indexed by column letters.
|
||||||
|
*
|
||||||
|
* This method iterates over each cell in the provided row, retrieves the cell values, and creates
|
||||||
|
* an associative array where 'index' holds the row index and 'value' contains an associative array
|
||||||
|
* of column letters as keys and cell values as the corresponding values.
|
||||||
|
*
|
||||||
|
* @param Row $row The row object from the spreadsheet to be processed.
|
||||||
|
*
|
||||||
|
* @return null|array<string, string> An associative array with the following structure:
|
||||||
|
* - 'index' (int): The row index.
|
||||||
|
* - 'values' (array<string, string>): An associative array where keys are the column letters
|
||||||
|
* (string), and values are the corresponding cell values (string).
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function process(Row $row): ?array
|
||||||
|
{
|
||||||
|
if ($row->isEmpty())
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$rowData = ['index' => $row->getRowIndex(), 'values' => []];
|
||||||
|
$cellIterator = $row->getCellIterator();
|
||||||
|
$cellIterator->setIterateOnlyExistingCells(true);
|
||||||
|
|
||||||
|
foreach ($cellIterator as $cell)
|
||||||
|
{
|
||||||
|
$rowData['values'][$cell->getColumn()] = (string) $cell->getValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $rowData;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
33
src/36063502-2115-4c8d-b16a-0c76cc8c1ada/code.power
Normal file
33
src/36063502-2115-4c8d-b16a-0c76cc8c1ada/code.power
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
/**
|
||||||
|
* Processes a given spreadsheet row and returns an associative array containing the row index and cell values indexed by column letters.
|
||||||
|
*
|
||||||
|
* This method iterates over each cell in the provided row, retrieves the cell values, and creates
|
||||||
|
* an associative array where 'index' holds the row index and 'value' contains an associative array
|
||||||
|
* of column letters as keys and cell values as the corresponding values.
|
||||||
|
*
|
||||||
|
* @param Row $row The row object from the spreadsheet to be processed.
|
||||||
|
*
|
||||||
|
* @return null|array<string, string> An associative array with the following structure:
|
||||||
|
* - 'index' (int): The row index.
|
||||||
|
* - 'values' (array<string, string>): An associative array where keys are the column letters
|
||||||
|
* (string), and values are the corresponding cell values (string).
|
||||||
|
* @since 5.0.2
|
||||||
|
*/
|
||||||
|
public function process(Row $row): ?array
|
||||||
|
{
|
||||||
|
if ($row->isEmpty())
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$rowData = ['index' => $row->getRowIndex(), 'values' => []];
|
||||||
|
$cellIterator = $row->getCellIterator();
|
||||||
|
$cellIterator->setIterateOnlyExistingCells(true);
|
||||||
|
|
||||||
|
foreach ($cellIterator as $cell)
|
||||||
|
{
|
||||||
|
$rowData['values'][$cell->getColumn()] = (string) $cell->getValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $rowData;
|
||||||
|
}
|
30
src/36063502-2115-4c8d-b16a-0c76cc8c1ada/settings.json
Normal file
30
src/36063502-2115-4c8d-b16a-0c76cc8c1ada/settings.json
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"add_head": 0,
|
||||||
|
"add_licensing_template": 2,
|
||||||
|
"extends": "",
|
||||||
|
"guid": "36063502-2115-4c8d-b16a-0c76cc8c1ada",
|
||||||
|
"implements": [
|
||||||
|
"9ffc54fa-a71e-412f-bc8b-064fc3b69167"
|
||||||
|
],
|
||||||
|
"load_selection": null,
|
||||||
|
"name": "RowDataArray",
|
||||||
|
"power_version": "1.0.0",
|
||||||
|
"system_name": "JCB.Spreadsheet.RowDataArray",
|
||||||
|
"type": "final class",
|
||||||
|
"use_selection": null,
|
||||||
|
"extendsinterfaces": null,
|
||||||
|
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Spreadsheet.RowDataArray",
|
||||||
|
"description": "Spreadsheet Row Data Array\r\n\r\n@since 5.0.2",
|
||||||
|
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2020\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 *\/",
|
||||||
|
"head": "",
|
||||||
|
"composer": {
|
||||||
|
"composer0": {
|
||||||
|
"access_point": "phpspreadsheet\/vendor\/autoload.php",
|
||||||
|
"namespace": {
|
||||||
|
"namespace0": {
|
||||||
|
"use": "PhpOffice\\PhpSpreadsheet\\Worksheet\\Row"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"add_head": "0",
|
"add_head": 0,
|
||||||
"add_licensing_template": "2",
|
"add_licensing_template": 2,
|
||||||
"extends": "",
|
"extends": "",
|
||||||
"guid": "3cf76fbf-fd95-4a33-878e-7aff6d36b7f6",
|
"guid": "3cf76fbf-fd95-4a33-878e-7aff6d36b7f6",
|
||||||
"implements": null,
|
"implements": null,
|
||||||
|
84
src/3d3ec064-9867-41e6-a48a-964c15d753aa/README.md
Normal file
84
src/3d3ec064-9867-41e6-a48a-964c15d753aa/README.md
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
```
|
||||||
|
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||||
|
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||||
|
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||||
|
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||||
|
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||||
|
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||||
|
```
|
||||||
|
# interface ImportRowInterface (Details)
|
||||||
|
> namespace: **VDM\Joomla\Componentbuilder\Interfaces**
|
||||||
|
|
||||||
|
```uml
|
||||||
|
@startuml
|
||||||
|
interface ImportRowInterface #Lavender {
|
||||||
|
+ set(int $index, array $values) : void
|
||||||
|
+ clear() : self
|
||||||
|
+ getIndex() : int
|
||||||
|
+ getValue(string $key) : mixed
|
||||||
|
+ unsetValue(string $key) : void
|
||||||
|
}
|
||||||
|
|
||||||
|
note right of ImportRowInterface::set
|
||||||
|
Set the row details
|
||||||
|
|
||||||
|
since: 3.0.3
|
||||||
|
return: void
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of ImportRowInterface::clear
|
||||||
|
Clear the row details
|
||||||
|
|
||||||
|
since: 3.0.3
|
||||||
|
return: self
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of ImportRowInterface::getIndex
|
||||||
|
Get Index
|
||||||
|
|
||||||
|
since: 3.0.3
|
||||||
|
return: int
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of ImportRowInterface::getValue
|
||||||
|
Get Value
|
||||||
|
|
||||||
|
since: 3.0.3
|
||||||
|
return: mixed
|
||||||
|
end note
|
||||||
|
|
||||||
|
note right of ImportRowInterface::unsetValue
|
||||||
|
Unset Value
|
||||||
|
|
||||||
|
since: 3.0.3
|
||||||
|
return: void
|
||||||
|
end note
|
||||||
|
|
||||||
|
@enduml
|
||||||
|
```
|
||||||
|
|
||||||
|
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
|
||||||
|
|
||||||
|
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
|
||||||
|
|
||||||
|
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
|
||||||
|
|
||||||
|
To add this specific Power to your project in JCB:
|
||||||
|
|
||||||
|
> simply use this SPK
|
||||||
|
```
|
||||||
|
Super---3d3ec064_9867_41e6_a48a_964c15d753aa---Power
|
||||||
|
```
|
||||||
|
> remember to replace the `---` with `___` to activate this Power in your code
|
||||||
|
|
||||||
|
---
|
||||||
|
```
|
||||||
|
██╗ ██████╗██████╗
|
||||||
|
██║██╔════╝██╔══██╗
|
||||||
|
██║██║ ██████╔╝
|
||||||
|
██ ██║██║ ██╔══██╗
|
||||||
|
╚█████╔╝╚██████╗██████╔╝
|
||||||
|
╚════╝ ╚═════╝╚═════╝
|
||||||
|
```
|
||||||
|
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||||
|
|
68
src/3d3ec064-9867-41e6-a48a-964c15d753aa/code.php
Normal file
68
src/3d3ec064-9867-41e6-a48a-964c15d753aa/code.php
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
<?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;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Import Row Interface
|
||||||
|
*
|
||||||
|
* @since 3.0.3
|
||||||
|
*/
|
||||||
|
interface ImportRowInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Set the row details
|
||||||
|
*
|
||||||
|
* @param int $index The row index
|
||||||
|
* @param array $values The values
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 3.0.3
|
||||||
|
*/
|
||||||
|
public function set(int $index, array $values): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear the row details
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @since 3.0.3
|
||||||
|
*/
|
||||||
|
public function clear(): self;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Index
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
* @throws \InvalidArgumentException if any of the parameters are null or empty.
|
||||||
|
* @since 3.0.3
|
||||||
|
*/
|
||||||
|
public function getIndex(): int;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Value
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
* @throws \InvalidArgumentException if any of the parameters are null or empty.
|
||||||
|
* @since 3.0.3
|
||||||
|
*/
|
||||||
|
public function getValue(string $key);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unset Value
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @throws \InvalidArgumentException if any of the parameters are null or empty.
|
||||||
|
* @since 3.0.3
|
||||||
|
*/
|
||||||
|
public function unsetValue(string $key): void;
|
||||||
|
}
|
||||||
|
|
45
src/3d3ec064-9867-41e6-a48a-964c15d753aa/code.power
Normal file
45
src/3d3ec064-9867-41e6-a48a-964c15d753aa/code.power
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/**
|
||||||
|
* Set the row details
|
||||||
|
*
|
||||||
|
* @param int $index The row index
|
||||||
|
* @param array $values The values
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @since 3.0.3
|
||||||
|
*/
|
||||||
|
public function set(int $index, array $values): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear the row details
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
* @since 3.0.3
|
||||||
|
*/
|
||||||
|
public function clear(): self;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Index
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
* @throws \InvalidArgumentException if any of the parameters are null or empty.
|
||||||
|
* @since 3.0.3
|
||||||
|
*/
|
||||||
|
public function getIndex(): int;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Value
|
||||||
|
*
|
||||||
|
* @return mixed
|
||||||
|
* @throws \InvalidArgumentException if any of the parameters are null or empty.
|
||||||
|
* @since 3.0.3
|
||||||
|
*/
|
||||||
|
public function getValue(string $key);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unset Value
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @throws \InvalidArgumentException if any of the parameters are null or empty.
|
||||||
|
* @since 3.0.3
|
||||||
|
*/
|
||||||
|
public function unsetValue(string $key): void;
|
19
src/3d3ec064-9867-41e6-a48a-964c15d753aa/settings.json
Normal file
19
src/3d3ec064-9867-41e6-a48a-964c15d753aa/settings.json
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"add_head": 0,
|
||||||
|
"add_licensing_template": 2,
|
||||||
|
"extends": "",
|
||||||
|
"guid": "3d3ec064-9867-41e6-a48a-964c15d753aa",
|
||||||
|
"implements": null,
|
||||||
|
"load_selection": null,
|
||||||
|
"name": "ImportRowInterface",
|
||||||
|
"power_version": "1.0.0",
|
||||||
|
"system_name": "VDM.ImportRowInterface",
|
||||||
|
"type": "interface",
|
||||||
|
"use_selection": null,
|
||||||
|
"extendsinterfaces": null,
|
||||||
|
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Interfaces.ImportRowInterface",
|
||||||
|
"description": "Import Row Interface\r\n\r\n@since 3.0.3",
|
||||||
|
"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": ""
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user