Compare commits

...

18 Commits

Author SHA1 Message Date
77f23fb8c2
Update 2024-12-16 18:30:48 2024-12-16 18:31:01 +02:00
44d1649eb0
Update 2024-10-18 03:09:11 2024-10-18 03:09:21 +02:00
e3096c796e
Update 2024-10-18 02:15:11 2024-10-18 02:15:16 +02:00
98710c7fbd
Update 2024-10-17 01:15:11 2024-10-17 01:15:12 +02:00
9eba4b338f
Update 2024-10-16 10:35:01 2024-10-16 22:35:05 +02:00
ab9fb353ba
Update 2024-10-15 04:21:01 2024-10-15 04:21:36 +02:00
1a74439a89
Update 2024-10-15 03:29:01 2024-10-15 03:29:16 +02:00
7effb3035a
Update 2024-10-15 03:13:31 2024-10-15 03:13:39 +02:00
972f531ed3
Update 2024-10-13 11:00:31 2024-10-13 23:00:50 +02:00
7096370b60
Update 2024-10-11 12:23:31 2024-10-11 00:24:04 +02:00
7ce368db75
Update 2024-10-09 01:20:31 2024-10-09 01:20:27 +02:00
43edf4dee7
Update 2024-10-08 05:05:31 2024-10-08 05:04:50 +02:00
492bab1f36
Update 2024-10-08 03:57:31 2024-10-08 03:57:55 +02:00
8c8f4a0b58
Update 2024-10-06 04:36:31 2024-10-06 04:36:17 +02:00
25b4ae4215
Update 2024-10-02 04:42:31 2024-10-02 04:42:50 +02:00
a980aa9f81
Update 2024-09-28 01:27:31 2024-09-28 01:27:34 +02:00
d2d0222c5a
Update 2024-09-26 05:27:01 2024-09-26 05:27:17 +02:00
bfba10e61e
Update 2024-09-25 12:04:01 2024-09-25 00:04:36 +02:00
182 changed files with 15336 additions and 633 deletions

View File

@ -26,10 +26,10 @@ This repository contains an index (see below) of all the approved powers within
- **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 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 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 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 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`
@ -68,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 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 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`
- **Namespace**: [VDM\Joomla\Model](#vdm-joomla-model)
@ -85,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 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 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 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`
@ -94,8 +96,12 @@ This repository contains an index (see below) of all the approved powers within
- **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 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 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)
- **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`
@ -103,6 +109,7 @@ This repository contains an index (see below) of all the approved powers within
- **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 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\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`
@ -110,10 +117,39 @@ This repository contains an index (see below) of all the approved powers within
- **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\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`
- **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 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`
@ -158,16 +194,24 @@ 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`
- **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 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 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`
- **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\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`

View 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)

View 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
{
}

View File

@ -0,0 +1 @@
###CODEPOWER###

View 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": ""
}

View 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)

View File

@ -0,0 +1,75 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\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;
}

View 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;

View 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": ""
}

View 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)

View 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;
}

View 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;

View 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": ""
}

View File

@ -6,16 +6,16 @@
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# trait Count (Details)
# trait PathCount (Details)
> namespace: **VDM\Joomla\Abstraction\Registry\Traits**
```uml
@startuml
class Count << (T,Orange) >> #Turquoise {
+ count(string $path) : int
class PathCount << (T,Orange) >> #Turquoise {
+ 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.
since: 3.2.0

View File

@ -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.
@ -28,7 +29,7 @@ trait Count
* @return int The number of values
* @since 3.2.0
*/
public function count(string $path): int
public function pathCount(string $path): int
{
if (($values = $this->get($path)) === null)
{

View File

@ -7,7 +7,7 @@
* @return int The number of values
* @since 3.2.0
*/
public function count(string $path): int
public function pathCount(string $path): int
{
if (($values = $this->get($path)) === null)
{

View File

@ -5,14 +5,14 @@
"guid": "11572d9b-e3d5-4b29-904c-9618d8f2bfd8",
"implements": null,
"load_selection": null,
"name": "Count",
"name": "PathCount",
"power_version": "1.0.0",
"system_name": "VDM.Abstraction.Registry.Traits.Count",
"system_name": "VDM.Abstraction.Registry.Traits.PathCount",
"type": "trait",
"use_selection": null,
"extendsinterfaces": null,
"namespace": "[[[NamespacePrefix]]]\\Joomla\\Abstraction.Registry.Traits.Count",
"description": "Count Values\r\n\r\n@since 3.2.0",
"namespace": "[[[NamespacePrefix]]]\\Joomla\\Abstraction.Registry.Traits.PathCount",
"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",
"head": "",
"composer": ""

View File

@ -14,10 +14,12 @@
abstract Grep #Orange {
+ ?string $path
+ ?array $paths
# ?string $target
# array $order
# Contents $contents
# Resolve $resolve
# CMSApplication $app
+ __construct(Contents $contents, array $paths, ...)
+ __construct(Contents $contents, Resolve $resolve, ...)
+ get(string $guid, ?array $order = null, ...) : ?object
+ exists(string $guid, ?object $repo = null, ...) : bool
+ getRemoteGuid() : ?array
@ -25,6 +27,7 @@ abstract Grep #Orange {
+ setBranchDefaultName(?string $name) : void
+ setIndexPath(string $indexPath) : void
+ getRemoteIndex(string $guid) : ?object
+ loadApi(Api $api, ?string $base, ...) : void
# {abstract} setRemoteIndexMessage(string $message, string $path, ...) : void
# getFunctionName(string $name, string $type = 'search') : ?string
# searchSingleRepo(string $guid, array $order, ...) : ?object
@ -53,6 +56,7 @@ note right of Grep::__construct
arguments:
Contents $contents
Resolve $resolve
array $paths
?string $path = null
?CMSApplication $app = null
@ -117,7 +121,22 @@ note left of Grep::getRemoteIndex
return: ?object
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.
since: 3.2.0
@ -131,14 +150,14 @@ note right of Grep::setRemoteIndexMessage
?string $base
end note
note left of Grep::getFunctionName
note right of Grep::getFunctionName
Get function name
since: 3.2.0
return: ?string
end note
note right of Grep::searchSingleRepo
note left of Grep::searchSingleRepo
Search a single repository for an item
since: 3.2.2
@ -150,14 +169,14 @@ note right of Grep::searchSingleRepo
object $repo
end note
note left of Grep::searchAllRepos
note right of Grep::searchAllRepos
Search all repositories for an item
since: 3.2.2
return: ?object
end note
note right of Grep::itemExistsInRepo
note left of Grep::itemExistsInRepo
Check if an item exists in a specific repository.
since: 3.2.2
@ -169,42 +188,42 @@ note right of Grep::itemExistsInRepo
array $order
end note
note left of Grep::itemExistsInAllRepos
note right of Grep::itemExistsInAllRepos
Check if an item exists in any of the repositories.
since: 3.2.2
return: bool
end note
note right of Grep::getBranchField
note left of Grep::getBranchField
Get the branch field
since: 3.2.2
return: string
end note
note left of Grep::getBranchDefaultName
note right of Grep::getBranchDefaultName
Get the branch default name
since: 3.2.2
return: ?string
end note
note right of Grep::getBranchName
note left of Grep::getBranchName
Get the branch name
since: 3.2.2
return: ?string
end note
note left of Grep::getIndexPath
note right of Grep::getIndexPath
Get the index path
since: 3.2.2
return: string
end note
note right of Grep::itemExists
note left of Grep::itemExists
Check if an item exists in a specific repo and target.
since: 3.2.2
@ -216,56 +235,56 @@ note right of Grep::itemExists
string $target
end note
note left of Grep::existsLocally
note right of Grep::existsLocally
Check if item exists locally
since: 3.2.2
return: ?object
end note
note right of Grep::existsRemotely
note left of Grep::existsRemotely
Check if item exists remotely
since: 3.2.2
return: ?object
end note
note left of Grep::existsLocal
note right of Grep::existsLocal
Check if item exists locally
since: 3.2.2
return: bool
end note
note right of Grep::existsRemote
note left of Grep::existsRemote
Check if item exists remotely
since: 3.2.2
return: bool
end note
note left of Grep::indexRemote
note right of Grep::indexRemote
Load the remote repository index of powers
since: 3.2.0
return: void
end note
note right of Grep::indexLocal
note left of Grep::indexLocal
Load the local repository index of powers
since: 3.2.0
return: void
end note
note left of Grep::initializeInstances
note right of Grep::initializeInstances
Set path details
since: 3.2.0
return: void
end note
note right of Grep::loadRemoteFile
note left of Grep::loadRemoteFile
Load the remote file
since: 3.2.0

View File

@ -17,6 +17,8 @@ use Joomla\CMS\Language\Text;
use Joomla\CMS\Filesystem\Folder;
use Joomla\CMS\Application\CMSApplication;
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\JsonHelper;
use VDM\Joomla\Interfaces\GrepInterface;
@ -50,6 +52,14 @@ abstract class Grep implements GrepInterface
**/
public ?array $paths;
/**
* The Grep target [network]
*
* @var string
* @since 5.0.4
**/
protected ?string $target = null;
/**
* Order of global search
*
@ -82,6 +92,14 @@ abstract class Grep implements GrepInterface
*/
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
*
@ -90,6 +108,14 @@ abstract class Grep implements GrepInterface
**/
protected Contents $contents;
/**
* The Resolve Class.
*
* @var Resolve
* @since 5.0.4
*/
protected Resolve $resolve;
/**
* Joomla Application object
*
@ -101,17 +127,22 @@ abstract class Grep implements GrepInterface
/**
* Constructor.
*
* @param Contents $contents The Gitea Repository Contents object.
* @param array $paths The approved paths
* @param string|null $path The local path
* @param CMSApplication|null $app The CMS Application object.
* @param Contents $contents The Gitea Repository Contents object.
* @param Resolve $resolve The Resolve Class.
* @param array $paths The approved paths
* @param string|null $path The local path
* @param CMSApplication|null $app The CMS Application object.
*
* @throws \Exception
* @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->resolve = $resolve;
$this->paths = $paths;
$this->path = $path;
$this->app = $app ?: Factory::getApplication();
@ -264,6 +295,38 @@ abstract class Grep implements GrepInterface
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.
*
@ -584,7 +647,7 @@ abstract class Grep implements GrepInterface
try
{
// 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));
}
catch (\Exception $e)
@ -640,6 +703,12 @@ abstract class Grep implements GrepInterface
if (isset($path->organisation) && strlen($path->organisation) > 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
$path->path = trim($path->organisation) . '/' . trim($path->repository);

View File

@ -14,6 +14,14 @@
**/
public ?array $paths;
/**
* The Grep target [network]
*
* @var string
* @since 5.0.4
**/
protected ?string $target = null;
/**
* Order of global search
*
@ -46,6 +54,14 @@
*/
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
*
@ -54,6 +70,14 @@
**/
protected Contents $contents;
/**
* The Resolve Class.
*
* @var Resolve
* @since 5.0.4
*/
protected Resolve $resolve;
/**
* Joomla Application object
*
@ -65,17 +89,22 @@
/**
* Constructor.
*
* @param Contents $contents The Gitea Repository Contents object.
* @param array $paths The approved paths
* @param string|null $path The local path
* @param CMSApplication|null $app The CMS Application object.
* @param Contents $contents The Gitea Repository Contents object.
* @param Resolve $resolve The Resolve Class.
* @param array $paths The approved paths
* @param string|null $path The local path
* @param CMSApplication|null $app The CMS Application object.
*
* @throws \Exception
* @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->resolve = $resolve;
$this->paths = $paths;
$this->path = $path;
$this->app = $app ?: Factory::getApplication();
@ -228,6 +257,38 @@
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.
*
@ -548,7 +609,7 @@
try
{
// 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));
}
catch (\Exception $e)
@ -604,6 +665,12 @@
if (isset($path->organisation) && strlen($path->organisation) > 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
$path->path = trim($path->organisation) . '/' . trim($path->repository);

View File

@ -17,10 +17,18 @@
"as": "default"
},
"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",
"as": "default"
},
"use_selection2": {
"use_selection4": {
"use": "4b225c51-d293-48e4-b3f6-5136cf5c3f18",
"as": "default"
}

View 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)

View File

@ -0,0 +1,130 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\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);
}
}
}

View 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);
}
}

View 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": ""
}

View File

@ -15,6 +15,7 @@ class Table #Gold {
+ register(Container $container) : void
+ getTable(Container $container) : DataTable
+ getSchema(Container $container) : Schema
+ getValidator(Container $container) : Validator
}
note right of Table::register
@ -37,6 +38,13 @@ note right of Table::getSchema
since: 3.2.2
return: Schema
end note
note right of Table::getValidator
Get The Validator Class.
since: 3.2.2
return: Validator
end note
@enduml
```

View File

@ -16,6 +16,7 @@ use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use VDM\Joomla\Componentbuilder\Table as DataTable;
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')
->share('Table.Schema', [$this, 'getSchema'], true);
$container->alias(Validator::class, 'Table.Validator')
->share('Table.Validator', [$this, 'getValidator'], true);
}
/**
@ -68,6 +72,21 @@ class Table implements ServiceProviderInterface
return new Schema(
$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')
);
}
}

View File

@ -13,6 +13,9 @@
$container->alias(Schema::class, 'Table.Schema')
->share('Table.Schema', [$this, 'getSchema'], true);
$container->alias(Validator::class, 'Table.Validator')
->share('Table.Validator', [$this, 'getValidator'], true);
}
/**
@ -41,4 +44,19 @@
return new Schema(
$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')
);
}

View File

@ -19,6 +19,10 @@
"use_selection1": {
"use": "b3d2ec33-76d4-4c3b-bb2c-86ac14a221ce",
"as": "default"
},
"use_selection2": {
"use": "79fd4f39-824d-4ab6-936d-959705ff24ec",
"as": "default"
}
},
"extendsinterfaces": null,

View 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)

View 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')
);
}
}

View 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')
);
}

View 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": ""
}

View 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)

View 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;
}

View 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;

View 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": ""
}

View 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)

View 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;
}

View 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;

View 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": ""
}

View File

@ -6,12 +6,12 @@
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# interface Tableinterface (Details)
# interface TableInterface (Details)
> namespace: **VDM\Joomla\Interfaces**
```uml
@startuml
interface Tableinterface #Lavender {
interface TableInterface #Lavender {
+ get(?string $table = null, ?string $field = null, ...) : mixed
+ title(string $table) : ?array
+ titleName(string $table) : string
@ -20,7 +20,7 @@ interface Tableinterface #Lavender {
+ 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
Example: $this->get('table_name', 'field_name', 'value_key');
Get an item/field/column of an area/view/table
@ -40,35 +40,35 @@ Example: $this->get();
?string $key = null
end note
note right of Tableinterface::title
note right of TableInterface::title
Get title field from an area/view/table
since: 3.2.0
return: ?array
end note
note right of Tableinterface::titleName
note right of TableInterface::titleName
Get title field name
since: 3.2.0
return: string
end note
note right of Tableinterface::tables
note right of TableInterface::tables
Get all tables
since: 3.2.0
return: array
end note
note right of Tableinterface::exist
note right of TableInterface::exist
Check if a table (and field) exist
since: 3.2.0
return: bool
end note
note right of Tableinterface::fields
note right of TableInterface::fields
Get all fields of an area/view/table
since: 3.2.0

View File

@ -15,7 +15,7 @@ namespace VDM\Joomla\Interfaces;
/**
* The VDM Core Table Interface
*/
interface Tableinterface
interface TableInterface
{
/**
* Get any value from a item/field/column of an area/view/table

View File

@ -5,13 +5,13 @@
"guid": "2da6d6c4-eb29-4d69-8bc2-36d96e916adf",
"implements": null,
"load_selection": null,
"name": "Tableinterface",
"name": "TableInterface",
"power_version": "1.0.0",
"system_name": "VDM.Interfaces.Tableinterface",
"system_name": "VDM.Interfaces.TableInterface",
"type": "interface",
"use_selection": null,
"extendsinterfaces": null,
"namespace": "[[[NamespacePrefix]]]\\Joomla\\Interfaces.Tableinterface",
"namespace": "[[[NamespacePrefix]]]\\Joomla\\Interfaces.TableInterface",
"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",
"head": "",

View File

@ -35,14 +35,6 @@ use VDM\Joomla\Interfaces\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
*

View File

@ -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
*

View 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)

View 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;
}

View 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;

View 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": ""
}

View File

@ -0,0 +1,68 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# abstract class SessionHelper (Details)
> namespace: **VDM\Joomla\Utilities**
```uml
@startuml
abstract SessionHelper #Orange {
+ {static} session() : Session
+ {static} get(string $name, mixed $default = null) : mixed
+ {static} set(string $name, mixed $value = null) : mixed
}
note right of SessionHelper::session
Get the active session
since: 5.0.2
return: Session
end note
note right of SessionHelper::get
Get data from the session store
since: 5.0.2
return: mixed
end note
note right of SessionHelper::set
Set data into the session store
since: 5.0.2
return: mixed
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---47a63728_cd5d_4d53_99cf_2409bd1c744c---Power
```
> remember to replace the `---` with `___` to activate this Power in your code
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,89 @@
<?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\Utilities;
use Joomla\CMS\Factory;
use Joomla\CMS\Session\Session;
/**
* Simple Session
*
* @since 5.0.2
*/
abstract class SessionHelper
{
/**
* The active session
*
* @var Session|null
* @since 5.0.2
*/
private static ?Session $session = null;
/**
* Get the active session
*
* @return Session
* @throws \RuntimeException if the session cannot be loaded
* @since 5.0.2
*/
public static function session(): Session
{
if (static::$session === null)
{
try {
static::$session = Factory::getApplication()->getSession();
} catch (\Exception $e) {
// Rethrow the exception as a RuntimeException to propagate it downstream
throw new \RuntimeException('Unable to load the session.', 0, $e);
}
}
return static::$session;
}
/**
* Get data from the session store
*
* @param string $name Name of a variable
* @param mixed $default Default value of a variable if not set
*
* @return mixed Value of the variable from the session
* @since 5.0.2
*/
public static function get(string $name, $default = null)
{
$value = static::session()->get($name, $default);
// Ensure the value is set in the session even if it was default
static::set($name, $value);
return $value;
}
/**
* Set data into the session store
*
* @param string $name Name of a variable
* @param mixed $value Value of a variable
*
* @return mixed Old value of the variable
* @since 5.0.2
*/
public static function set(string $name, $value = null)
{
return static::session()->set($name, $value);
}
}

View File

@ -0,0 +1,62 @@
/**
* The active session
*
* @var Session|null
* @since 5.0.2
*/
private static ?Session $session = null;
/**
* Get the active session
*
* @return Session
* @throws \RuntimeException if the session cannot be loaded
* @since 5.0.2
*/
public static function session(): Session
{
if (static::$session === null)
{
try {
static::$session = Factory::getApplication()->getSession();
} catch (\Exception $e) {
// Rethrow the exception as a RuntimeException to propagate it downstream
throw new \RuntimeException('Unable to load the session.', 0, $e);
}
}
return static::$session;
}
/**
* Get data from the session store
*
* @param string $name Name of a variable
* @param mixed $default Default value of a variable if not set
*
* @return mixed Value of the variable from the session
* @since 5.0.2
*/
public static function get(string $name, $default = null)
{
$value = static::session()->get($name, $default);
// Ensure the value is set in the session even if it was default
static::set($name, $value);
return $value;
}
/**
* Set data into the session store
*
* @param string $name Name of a variable
* @param mixed $value Value of a variable
*
* @return mixed Old value of the variable
* @since 5.0.2
*/
public static function set(string $name, $value = null)
{
return static::session()->set($name, $value);
}

View File

@ -0,0 +1,19 @@
{
"add_head": "1",
"add_licensing_template": "2",
"extends": "",
"guid": "47a63728-cd5d-4d53-99cf-2409bd1c744c",
"implements": null,
"load_selection": null,
"name": "SessionHelper",
"power_version": "1.0.0",
"system_name": "Joomla.Utilities.SessionHelper",
"type": "abstract class",
"use_selection": null,
"extendsinterfaces": null,
"namespace": "[[[NamespacePrefix]]]\\Joomla\\Utilities.SessionHelper",
"description": "Simple Session\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\\CMS\\Factory;\r\nuse Joomla\\CMS\\Session\\Session;",
"composer": ""
}

View File

@ -0,0 +1,52 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# interface ImportItemInterface (Details)
> namespace: **VDM\Joomla\Componentbuilder\Interfaces**
```uml
@startuml
interface ImportItemInterface #Lavender {
+ get(string $table, array $columns) : ?array
}
note right of ImportItemInterface::get
Get the item from the import row values and ensure it is valid
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---53f55e5b_63cb_49e7_b1e6_33e7a9f97856---Power
```
> remember to replace the `---` with `___` to activate this Power in your code
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,33 @@
<?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 Item Interface
*
* @since 3.0.3
*/
interface ImportItemInterface
{
/**
* Get the item from the import row values and ensure it is valid
*
* @param string $table The table these columns belongs to.
* @param array $columns The columns to extract.
*
* @return array|null
* @since 4.0.3
*/
public function get(string $table, array $columns): ?array;
}

View File

@ -0,0 +1,10 @@
/**
* Get the item from the import row values and ensure it is valid
*
* @param string $table The table these columns belongs to.
* @param array $columns The columns to extract.
*
* @return array|null
* @since 4.0.3
*/
public function get(string $table, array $columns): ?array;

View File

@ -0,0 +1,19 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "",
"guid": "53f55e5b-63cb-49e7-b1e6-33e7a9f97856",
"implements": null,
"load_selection": null,
"name": "ImportItemInterface",
"power_version": "1.0.0",
"system_name": "VDM.ImportItemInterface",
"type": "interface",
"use_selection": null,
"extendsinterfaces": null,
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Interfaces.ImportItemInterface",
"description": "Import Item 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": ""
}

View File

@ -0,0 +1,57 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# interface ImportAssessorInterface (Details)
> namespace: **VDM\Joomla\Componentbuilder\Interfaces**
```uml
@startuml
interface ImportAssessorInterface #Lavender {
+ evaluate(int $rowCounter, int $successCounter, ...) : void
}
note right of ImportAssessorInterface::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---57c00d53_5581_4fd1_b3ea_080422710243---Power
```
> remember to replace the `---` with `___` to activate this Power in your code
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,34 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\Interfaces;
/**
* Import Assessor Interface
*
* @since 3.0.3
*/
interface ImportAssessorInterface
{
/**
* 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;
}

View File

@ -0,0 +1,11 @@
/**
* 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;

View File

@ -0,0 +1,19 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "",
"guid": "57c00d53-5581-4fd1-b3ea-080422710243",
"implements": null,
"load_selection": null,
"name": "ImportAssessorInterface",
"power_version": "1.0.0",
"system_name": "VDM.ImportAssessorInterface",
"type": "interface",
"use_selection": null,
"extendsinterfaces": null,
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Interfaces.ImportAssessorInterface",
"description": "Import Assessor 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": ""
}

View File

@ -67,7 +67,7 @@ end note
note left of Model::values
Model a value of multiple items
Example: $this->items(Array, 'value_key', 'table_name');
Example: $this->values(Array, 'value_key', 'table_name');
since: 3.2.2
return: ?array

View File

@ -14,7 +14,7 @@ namespace VDM\Joomla\Abstraction;
use VDM\Joomla\Utilities\StringHelper;
use VDM\Joomla\Utilities\ArrayHelper;
use VDM\Joomla\Interfaces\Tableinterface as Table;
use VDM\Joomla\Interfaces\TableInterface as Table;
use VDM\Joomla\Interfaces\ModelInterface;
@ -109,7 +109,7 @@ abstract class Model implements ModelInterface
/**
* Model a value of multiple items
* Example: $this->items(Array, 'value_key', 'table_name');
* Example: $this->values(Array, 'value_key', 'table_name');
*
* @param array|null $items The array of values
* @param string $field The field key

View File

@ -82,7 +82,7 @@
/**
* Model a value of multiple items
* Example: $this->items(Array, 'value_key', 'table_name');
* Example: $this->values(Array, 'value_key', 'table_name');
*
* @param array|null $items The array of values
* @param string $field The field key

View File

@ -14,7 +14,7 @@ namespace VDM\Joomla\Abstraction;
use Joomla\CMS\Factory;
use VDM\Joomla\Interfaces\SchemaInterface as Schema;
use VDM\Joomla\Interfaces\Tableinterface as Table;
use VDM\Joomla\Interfaces\TableInterface as Table;
use VDM\Joomla\Utilities\ClassHelper;
use VDM\Joomla\Interfaces\SchemaCheckerInterface;

View File

@ -0,0 +1,57 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# interface FileReaderInterface (Details)
> namespace: **VDM\Joomla\Componentbuilder\Interfaces\Spreadsheet**
```uml
@startuml
interface FileReaderInterface #Lavender {
+ read(string $filePath, int $startRow, ...) : \Generator
}
note right of FileReaderInterface::read
Stream rows from a CSV or Excel file one by one using yield.
since: 3.2.0
return: \Generator
arguments:
string $filePath
int $startRow
int $chunkSize
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---61d1146f_2c2e_4e42_8492_d076f945cf35---Power
```
> remember to replace the `---` with `___` to activate this Power in your code
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,34 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\Interfaces\Spreadsheet;
/**
* Spreadsheet File Reader Interface
*
* @since 3.2.2
*/
interface FileReaderInterface
{
/**
* Stream rows from a CSV or Excel file one by one using yield.
*
* @param string $filePath The path to the file.
* @param int $startRow The starting row index.
* @param int $chunkSize The number of rows to read per chunk.
*
* @return \Generator A generator that yields each row as an array.
* @since 3.2.0
*/
public function read(string $filePath, int $startRow, int $chunkSize): \Generator;
}

View File

@ -0,0 +1,11 @@
/**
* Stream rows from a CSV or Excel file one by one using yield.
*
* @param string $filePath The path to the file.
* @param int $startRow The starting row index.
* @param int $chunkSize The number of rows to read per chunk.
*
* @return \Generator A generator that yields each row as an array.
* @since 3.2.0
*/
public function read(string $filePath, int $startRow, int $chunkSize): \Generator;

View File

@ -0,0 +1,19 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "",
"guid": "61d1146f-2c2e-4e42-8492-d076f945cf35",
"implements": null,
"load_selection": null,
"name": "FileReaderInterface",
"power_version": "1.0.0",
"system_name": "JCB.Interfaces.Spreadsheet.FileReaderInterface",
"type": "interface",
"use_selection": null,
"extendsinterfaces": null,
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Interfaces.Spreadsheet.FileReaderInterface",
"description": "Spreadsheet File Reader 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": ""
}

View File

@ -13,14 +13,125 @@
```uml
@startuml
interface Registryinterface #Lavender {
+ __get(string $name) : mixed
+ __set(string $name, mixed $value) : void
+ __isset(string $name) : bool
+ __unset(string $name) : void
+ __clone() : void
+ __toString() : string
+ loadString(string $data, string $format = 'JSON', ...) : self
+ loadObject(object $object) : self
+ loadArray(array $array) : self
+ loadFile(string $path, string $format = 'json') : self
+ set(string $path, mixed $value) : self
+ add(string $path, mixed $value, ...) : self
+ get(string $path, mixed $default = null) : mixed
+ remove(string $path) : self
+ exists(string $path) : bool
+ jsonSerialize() : mixed
+ count() : int
+ offsetExists(mixed $offset) : bool
+ offsetGet(mixed $offset) : mixed
+ offsetSet(mixed $offset, mixed $value) : void
+ offsetUnset(mixed $offset) : void
+ getIterator() : \Traversable
+ toArray() : array
+ toObject() : object
+ toString(string $format = 'JSON', array $options = []) : string
+ flatten(?string $separator = null, bool $full = false) : array
+ def(string $path, mixed $default) : mixed
+ merge(Registryinterface $source) : self
+ clear() : self
+ extract(string $path, mixed $default = null, ...) : self
+ append(string $path, mixed $value) : self
+ getName() : ?string
+ setName(?string $name) : self
+ setSeparator(?string $value) : self
+ getSeparator() : ?string
}
note right of Registryinterface::__get
Magic method to get a value from the registry.
Allows for accessing registry data using object property syntax.
since: 5.0.4
return: mixed
end note
note left of Registryinterface::__set
Magic method to set a value in the registry.
Allows for setting registry data using object property syntax.
since: 5.0.4
return: void
end note
note right of Registryinterface::__isset
Magic method to check if a property is set in the registry.
Allows for using isset() on registry properties.
since: 5.0.4
return: bool
end note
note left of Registryinterface::__unset
Magic method to unset a property in the registry.
Allows for using unset() on registry properties.
since: 5.0.4
return: void
end note
note right of Registryinterface::__clone
Magic method to clone the registry.
Performs a deep copy of the registry data.
since: 5.0.4
return: void
end note
note left of Registryinterface::__toString
Magic method to convert the registry to a string.
Returns the registry data in JSON format.
since: 5.0.4
return: string
end note
note right of Registryinterface::loadString
Loads data into the registry from a string using Joomla's format classes.
since: 5.0.4
return: self
arguments:
string $data
string $format = 'JSON'
array $options = []
end note
note left of Registryinterface::loadObject
Loads data into the registry from an object.
since: 5.0.4
return: self
end note
note right of Registryinterface::loadArray
Loads data into the registry from an array.
The loaded data will be merged into the registry's existing data.
since: 5.0.4
return: self
end note
note left of Registryinterface::loadFile
Loads data into the registry from a file.
since: 5.0.4
return: self
end note
note right of Registryinterface::set
Sets a value into the registry using multiple keys.
@ -28,7 +139,7 @@ note right of Registryinterface::set
return: self
end note
note right of Registryinterface::add
note left of Registryinterface::add
Adds content into the registry. If a key exists,
it either appends or concatenates based on $asArray switch.
Default is $addAsArray = false (if null) in base class.
@ -50,7 +161,7 @@ note right of Registryinterface::get
return: mixed
end note
note right of Registryinterface::remove
note left of Registryinterface::remove
Removes a value (or sub-array) from the registry using multiple keys.
since: 3.2.0
@ -64,12 +175,154 @@ note right of Registryinterface::exists
return: bool
end note
note right of Registryinterface::setSeparator
note left of Registryinterface::jsonSerialize
Specify data which should be serialized to JSON.
which is a value of any type other than a resource.
since: 5.0.4
return: mixed
end note
note right of Registryinterface::count
Count elements of the registry.
since: 5.0.4
return: int
end note
note left of Registryinterface::offsetExists
Whether a given offset exists in the registry.
since: 5.0.4
return: bool
end note
note right of Registryinterface::offsetGet
Retrieve the value at a given offset.
since: 5.0.4
return: mixed
end note
note left of Registryinterface::offsetSet
Set the value at a given offset.
since: 5.0.4
return: void
end note
note right of Registryinterface::offsetUnset
Unset the value at a given offset.
since: 5.0.4
return: void
end note
note left of Registryinterface::getIterator
Retrieve an external iterator for the registry.
since: 5.0.4
return: \Traversable
end note
note right of Registryinterface::toArray
Get the registry data as an associative array.
since: 5.0.4
return: array
end note
note left of Registryinterface::toObject
Get the registry data as an object.
since: 5.0.4
return: object
end note
note right of Registryinterface::toString
Converts the registry data to a string in the specified format.
since: 5.0.4
return: string
end note
note left of Registryinterface::flatten
Flattens the registry data into a one-dimensional array.
since: 5.0.4
return: array
end note
note right of Registryinterface::def
Sets a default value if not already set.
since: 5.0.4
return: mixed
end note
note left of Registryinterface::merge
Merges another registry into this one.
The data from the source registry will be merged into this registry,
overwriting any existing values with the same keys.
since: 5.0.4
return: self
end note
note right of Registryinterface::clear
Clears all data from the registry.
since: 5.0.4
return: self
end note
note left of Registryinterface::extract
Extracts a subset of the registry data based on a given path.
since: 5.0.4
return: self
arguments:
string $path
mixed $default = null
?string $separator = null
end note
note right of Registryinterface::append
Appends content into the registry.
If a key exists, the value will be appended to the existing value.
since: 5.0.4
return: self
end note
note left of Registryinterface::getName
Gets the name of the registry.
since: 5.0.4
return: ?string
end note
note right of Registryinterface::setName
Sets the name of the registry.
since: 5.0.4
return: self
end note
note left of Registryinterface::setSeparator
Sets a separator value
since: 3.2.0
return: self
end note
note right of Registryinterface::getSeparator
Gets the current path separator used in registry paths.
since: 5.0.4
return: ?string
end note
@enduml
```

View File

@ -18,10 +18,128 @@ use VDM\Joomla\Interfaces\Activeregistryinterface;
/**
* The Registry Interface
*
* @since 3.2.0
* @since 3.2.0
* @since 5.0.4 Joomla Registry Compatible
*/
interface Registryinterface extends Activeregistryinterface
{
/**
* Magic method to get a value from the registry.
*
* Allows for accessing registry data using object property syntax.
*
* @param string $name The name of the property to get.
*
* @return mixed The value of the property, or null if not found.
* @since 5.0.4
*/
public function __get($name);
/**
* Magic method to set a value in the registry.
*
* Allows for setting registry data using object property syntax.
*
* @param string $name The name of the property to set.
* @param mixed $value The value to set.
*
* @return void
* @since 5.0.4
*/
public function __set($name, $value);
/**
* Magic method to check if a property is set in the registry.
*
* Allows for using isset() on registry properties.
*
* @param string $name The name of the property to check.
*
* @return bool True if the property is set, false otherwise.
* @since 5.0.4
*/
public function __isset($name);
/**
* Magic method to unset a property in the registry.
*
* Allows for using unset() on registry properties.
*
* @param string $name The name of the property to unset.
*
* @return void
* @since 5.0.4
*/
public function __unset($name);
/**
* Magic method to clone the registry.
*
* Performs a deep copy of the registry data.
*
* @return void
* @since 5.0.4
*/
public function __clone();
/**
* Magic method to convert the registry to a string.
*
* Returns the registry data in JSON format.
*
* @return string The registry data in JSON format.
* @since 5.0.4
*/
public function __toString();
/**
* Loads data into the registry from a string using Joomla's format classes.
*
* @param string $data The data string to load.
* @param string $format The format of the data string. Supported formats: 'json', 'ini', 'xml', 'php'.
* @param array $options Options used by the formatter
*
* @return self
* @throws \InvalidArgumentException If the format is not supported.
* @since 5.0.4
*/
public function loadString(string $data, string $format = 'JSON', array $options = []): self;
/**
* Loads data into the registry from an object.
*
* @param object $object The data object to load.
*
* @return self
* @since 5.0.4
*/
public function loadObject(object $object): self;
/**
* Loads data into the registry from an array.
*
* The loaded data will be merged into the registry's existing data.
*
* @param array $array The array of data to load into the registry.
*
* @return self
* @since 5.0.4
*/
public function loadArray(array $array): self;
/**
* Loads data into the registry from a file.
*
* @param string $path The path to the file to load.
* @param string $format The format of the file. Supported formats: 'json', 'ini', 'xml', 'php'.
*
* @return self
* @throws \InvalidArgumentException If the file does not exist or is not readable.
* @throws \RuntimeException If the file cannot be read.
* @since 5.0.4
*/
public function loadFile(string $path, string $format = 'json'): self;
/**
* Sets a value into the registry using multiple keys.
*
@ -30,7 +148,7 @@ interface Registryinterface extends Activeregistryinterface
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return self
* @since 3.2.0
* @since 3.2.0
*/
public function set(string $path, $value): self;
@ -46,7 +164,7 @@ interface Registryinterface extends Activeregistryinterface
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return self
* @since 3.2.0
* @since 3.2.0
*/
public function add(string $path, $value, ?bool $asArray = null): self;
@ -58,9 +176,9 @@ interface Registryinterface extends Activeregistryinterface
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return mixed The value or sub-array from the storage. Null if the location doesn't exist.
* @since 3.2.0
* @since 3.2.0
*/
public function get(string $path, $default = null);
public function get(string $path, $default = null): mixed;
/**
* Removes a value (or sub-array) from the registry using multiple keys.
@ -69,7 +187,7 @@ interface Registryinterface extends Activeregistryinterface
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return self
* @since 3.2.0
* @since 3.2.0
*/
public function remove(string $path): self;
@ -80,18 +198,207 @@ interface Registryinterface extends Activeregistryinterface
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return bool True if the location exists, false otherwise.
* @since 3.2.0
* @since 3.2.0
*/
public function exists(string $path): bool;
/**
* Specify data which should be serialized to JSON.
*
* @return mixed Data which can be serialized by json_encode(),
* which is a value of any type other than a resource.
* @since 5.0.4
*/
public function jsonSerialize(): mixed;
/**
* Count elements of the registry.
*
* @return int The number of elements in the registry.
* @since 5.0.4
*/
public function count(): int;
/**
* Whether a given offset exists in the registry.
*
* @param mixed $offset An offset to check for.
*
* @return bool True if the offset exists, false otherwise.
* @since 5.0.4
*/
public function offsetExists(mixed $offset): bool;
/**
* Retrieve the value at a given offset.
*
* @param mixed $offset The offset to retrieve.
*
* @return mixed The value at the specified offset.
* @since 5.0.4
*/
public function offsetGet(mixed $offset): mixed;
/**
* Set the value at a given offset.
*
* @param mixed $offset The offset to assign the value to.
* @param mixed $value The value to set.
*
* @return void
* @since 5.0.4
*/
public function offsetSet(mixed $offset, mixed $value): void;
/**
* Unset the value at a given offset.
*
* @param mixed $offset The offset to unset.
*
* @return void
* @since 5.0.4
*/
public function offsetUnset(mixed $offset): void;
/**
* Retrieve an external iterator for the registry.
*
* @return \Traversable An instance of an object implementing Iterator or Traversable.
* @since 5.0.4
*/
public function getIterator(): \Traversable;
/**
* Get the registry data as an associative array.
*
* @return array The registry data.
* @since 5.0.4
*/
public function toArray(): array;
/**
* Get the registry data as an object.
*
* @return object The registry data converted to an object.
* @since 5.0.4
*/
public function toObject();
/**
* Converts the registry data to a string in the specified format.
*
* @param string $format The format to output the string in. Supported formats: 'json', 'ini', 'xml', 'php'.
* @param array $options Options used by the formatter.
*
* @return string The registry data in the specified format.
*
* @throws \InvalidArgumentException If the format is not supported.
* @since 5.0.4
*/
public function toString(string $format = 'JSON', array $options = []): string;
/**
* Flattens the registry data into a one-dimensional array.
*
* @param string|null $separator The separator for the key names.
* @param bool $full True to include the full path as keys.
*
* @return array The flattened data array.
* @since 5.0.4
*/
public function flatten(?string $separator = null, bool $full = false): array;
/**
* Sets a default value if not already set.
*
* @param string $path The registry path (e.g., 'vdm.content.builder').
* @param mixed $default The default value to set if the path does not exist.
*
* @return mixed The value of the path after the method call.
* @since 5.0.4
*/
public function def(string $path, $default);
/**
* Merges another registry into this one.
*
* The data from the source registry will be merged into this registry,
* overwriting any existing values with the same keys.
*
* @param Registryinterface $source The registry to merge with this one.
*
* @return self
* @since 5.0.4
*/
public function merge(Registryinterface $source): self;
/**
* Clears all data from the registry.
*
* @return self
* @since 5.0.4
*/
public function clear(): self;
/**
* Extracts a subset of the registry data based on a given path.
*
* @param string $path The registry path to extract.
* @param mixed $default Optional default value, returned if the path does not exist.
* @param string|null $separator The path separator.
*
* @return self A new Registry instance with the extracted data.
* @since 5.0.4
*/
public function extract(string $path, $default = null, ?string $separator = null): self;
/**
* Appends content into the registry.
*
* If a key exists, the value will be appended to the existing value.
*
* @param string $path The registry path (e.g., 'vdm.content.builder').
* @param mixed $value The value to append.
*
* @return self
* @since 5.0.4
*/
public function append(string $path, $value): self;
/**
* Gets the name of the registry.
*
* @return string|null The name of the registry.
* @since 5.0.4
*/
public function getName(): ?string;
/**
* Sets the name of the registry.
*
* @param string|null $name The name to set.
*
* @return self
* @since 5.0.4
*/
public function setName(?string $name): self;
/**
* Sets a separator value
*
* @param string|null $value The value to set.
*
* @return self
* @since 3.2.0
* @since 3.2.0
*/
public function setSeparator(?string $value): self;
public function setSeparator(?string $value): self;
/**
* Gets the current path separator used in registry paths.
*
* @return string|null The path separator.
* @since 5.0.4
*/
public function getSeparator(): ?string;
}

View File

@ -1,3 +1,120 @@
/**
* Magic method to get a value from the registry.
*
* Allows for accessing registry data using object property syntax.
*
* @param string $name The name of the property to get.
*
* @return mixed The value of the property, or null if not found.
* @since 5.0.4
*/
public function __get($name);
/**
* Magic method to set a value in the registry.
*
* Allows for setting registry data using object property syntax.
*
* @param string $name The name of the property to set.
* @param mixed $value The value to set.
*
* @return void
* @since 5.0.4
*/
public function __set($name, $value);
/**
* Magic method to check if a property is set in the registry.
*
* Allows for using isset() on registry properties.
*
* @param string $name The name of the property to check.
*
* @return bool True if the property is set, false otherwise.
* @since 5.0.4
*/
public function __isset($name);
/**
* Magic method to unset a property in the registry.
*
* Allows for using unset() on registry properties.
*
* @param string $name The name of the property to unset.
*
* @return void
* @since 5.0.4
*/
public function __unset($name);
/**
* Magic method to clone the registry.
*
* Performs a deep copy of the registry data.
*
* @return void
* @since 5.0.4
*/
public function __clone();
/**
* Magic method to convert the registry to a string.
*
* Returns the registry data in JSON format.
*
* @return string The registry data in JSON format.
* @since 5.0.4
*/
public function __toString();
/**
* Loads data into the registry from a string using Joomla's format classes.
*
* @param string $data The data string to load.
* @param string $format The format of the data string. Supported formats: 'json', 'ini', 'xml', 'php'.
* @param array $options Options used by the formatter
*
* @return self
* @throws \InvalidArgumentException If the format is not supported.
* @since 5.0.4
*/
public function loadString(string $data, string $format = 'JSON', array $options = []): self;
/**
* Loads data into the registry from an object.
*
* @param object $object The data object to load.
*
* @return self
* @since 5.0.4
*/
public function loadObject(object $object): self;
/**
* Loads data into the registry from an array.
*
* The loaded data will be merged into the registry's existing data.
*
* @param array $array The array of data to load into the registry.
*
* @return self
* @since 5.0.4
*/
public function loadArray(array $array): self;
/**
* Loads data into the registry from a file.
*
* @param string $path The path to the file to load.
* @param string $format The format of the file. Supported formats: 'json', 'ini', 'xml', 'php'.
*
* @return self
* @throws \InvalidArgumentException If the file does not exist or is not readable.
* @throws \RuntimeException If the file cannot be read.
* @since 5.0.4
*/
public function loadFile(string $path, string $format = 'json'): self;
/**
* Sets a value into the registry using multiple keys.
*
@ -6,7 +123,7 @@
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return self
* @since 3.2.0
* @since 3.2.0
*/
public function set(string $path, $value): self;
@ -22,7 +139,7 @@
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return self
* @since 3.2.0
* @since 3.2.0
*/
public function add(string $path, $value, ?bool $asArray = null): self;
@ -34,9 +151,9 @@
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return mixed The value or sub-array from the storage. Null if the location doesn't exist.
* @since 3.2.0
* @since 3.2.0
*/
public function get(string $path, $default = null);
public function get(string $path, $default = null): mixed;
/**
* Removes a value (or sub-array) from the registry using multiple keys.
@ -45,7 +162,7 @@
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return self
* @since 3.2.0
* @since 3.2.0
*/
public function remove(string $path): self;
@ -56,16 +173,205 @@
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return bool True if the location exists, false otherwise.
* @since 3.2.0
* @since 3.2.0
*/
public function exists(string $path): bool;
/**
* Specify data which should be serialized to JSON.
*
* @return mixed Data which can be serialized by json_encode(),
* which is a value of any type other than a resource.
* @since 5.0.4
*/
public function jsonSerialize(): mixed;
/**
* Count elements of the registry.
*
* @return int The number of elements in the registry.
* @since 5.0.4
*/
public function count(): int;
/**
* Whether a given offset exists in the registry.
*
* @param mixed $offset An offset to check for.
*
* @return bool True if the offset exists, false otherwise.
* @since 5.0.4
*/
public function offsetExists(mixed $offset): bool;
/**
* Retrieve the value at a given offset.
*
* @param mixed $offset The offset to retrieve.
*
* @return mixed The value at the specified offset.
* @since 5.0.4
*/
public function offsetGet(mixed $offset): mixed;
/**
* Set the value at a given offset.
*
* @param mixed $offset The offset to assign the value to.
* @param mixed $value The value to set.
*
* @return void
* @since 5.0.4
*/
public function offsetSet(mixed $offset, mixed $value): void;
/**
* Unset the value at a given offset.
*
* @param mixed $offset The offset to unset.
*
* @return void
* @since 5.0.4
*/
public function offsetUnset(mixed $offset): void;
/**
* Retrieve an external iterator for the registry.
*
* @return \Traversable An instance of an object implementing Iterator or Traversable.
* @since 5.0.4
*/
public function getIterator(): \Traversable;
/**
* Get the registry data as an associative array.
*
* @return array The registry data.
* @since 5.0.4
*/
public function toArray(): array;
/**
* Get the registry data as an object.
*
* @return object The registry data converted to an object.
* @since 5.0.4
*/
public function toObject();
/**
* Converts the registry data to a string in the specified format.
*
* @param string $format The format to output the string in. Supported formats: 'json', 'ini', 'xml', 'php'.
* @param array $options Options used by the formatter.
*
* @return string The registry data in the specified format.
*
* @throws \InvalidArgumentException If the format is not supported.
* @since 5.0.4
*/
public function toString(string $format = 'JSON', array $options = []): string;
/**
* Flattens the registry data into a one-dimensional array.
*
* @param string|null $separator The separator for the key names.
* @param bool $full True to include the full path as keys.
*
* @return array The flattened data array.
* @since 5.0.4
*/
public function flatten(?string $separator = null, bool $full = false): array;
/**
* Sets a default value if not already set.
*
* @param string $path The registry path (e.g., 'vdm.content.builder').
* @param mixed $default The default value to set if the path does not exist.
*
* @return mixed The value of the path after the method call.
* @since 5.0.4
*/
public function def(string $path, $default);
/**
* Merges another registry into this one.
*
* The data from the source registry will be merged into this registry,
* overwriting any existing values with the same keys.
*
* @param Registryinterface $source The registry to merge with this one.
*
* @return self
* @since 5.0.4
*/
public function merge(Registryinterface $source): self;
/**
* Clears all data from the registry.
*
* @return self
* @since 5.0.4
*/
public function clear(): self;
/**
* Extracts a subset of the registry data based on a given path.
*
* @param string $path The registry path to extract.
* @param mixed $default Optional default value, returned if the path does not exist.
* @param string|null $separator The path separator.
*
* @return self A new Registry instance with the extracted data.
* @since 5.0.4
*/
public function extract(string $path, $default = null, ?string $separator = null): self;
/**
* Appends content into the registry.
*
* If a key exists, the value will be appended to the existing value.
*
* @param string $path The registry path (e.g., 'vdm.content.builder').
* @param mixed $value The value to append.
*
* @return self
* @since 5.0.4
*/
public function append(string $path, $value): self;
/**
* Gets the name of the registry.
*
* @return string|null The name of the registry.
* @since 5.0.4
*/
public function getName(): ?string;
/**
* Sets the name of the registry.
*
* @param string|null $name The name to set.
*
* @return self
* @since 5.0.4
*/
public function setName(?string $name): self;
/**
* Sets a separator value
*
* @param string|null $value The value to set.
*
* @return self
* @since 3.2.0
* @since 3.2.0
*/
public function setSeparator(?string $value): self;
public function setSeparator(?string $value): self;
/**
* Gets the current path separator used in registry paths.
*
* @return string|null The path separator.
* @since 5.0.4
*/
public function getSeparator(): ?string;

View File

@ -14,7 +14,7 @@
"af0eedbe-603b-4671-8e5a-28165d88254b"
],
"namespace": "[[[NamespacePrefix]]]\\Joomla\\Interfaces.Registryinterface",
"description": "The Registry Interface\r\n\r\n@since 3.2.0",
"description": "The Registry Interface\r\n\r\n@since 3.2.0\r\n@since 5.0.4 Joomla Registry Compatible",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
"head": "",
"composer": ""

View File

@ -250,6 +250,7 @@ final class Manager
'entity' => $entity,
'access' => $fileType['download_access'] ?? 1,
'guid' => $this->getGuid('guid'),
'created_by' => $this->user->id
];
}
}

View File

@ -217,5 +217,6 @@
'entity' => $entity,
'access' => $fileType['download_access'] ?? 1,
'guid' => $this->getGuid('guid'),
'created_by' => $this->user->id
];
}

View File

@ -0,0 +1,134 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# final class Item (Details)
> namespace: **VDM\Joomla\Componentbuilder\Import**
```uml
@startuml
class Item << (F,LightGreen) >> #RoyalBlue {
# Validator $validator
# DataItem $item
# Row $row
+ __construct(Validator $validator, DataItem $item, ...)
+ get(string $table, array $columns) : ?array
- getImportValue(mixed $value, string $field, ...) : mixed
- validImportValue(mixed $value, string $field, ...) : mixed
- getLocalValue(mixed $value, array $link) : mixed|null
- isValueExists(mixed $value, array $link) : bool
- setLocalValue(mixed $value, array $link) : mixed|null
- insertItemWithGuid(mixed $value, array $link) : ?string
- insertItemWithId(mixed $value, array $link) : mixed|null
}
note right of Item::__construct
Constructor.
since: 4.0.3
arguments:
Validator $validator
DataItem $item
Row $row
end note
note left of Item::get
Get the item from the import row values and ensure it is valid
since: 4.0.3
return: ?array
end note
note right of Item::getImportValue
Get the correct value needed for the import of the related row (item).
since: 4.0.3
return: mixed
arguments:
mixed $value
string $field
string $table
?array $link
end note
note left of Item::validImportValue
Make sure we have a valid import value
since: 4.0.3
return: mixed
arguments:
mixed $value
string $field
string $table
end note
note right of Item::getLocalValue
Helper function to get the local value from the database table.
since: 4.0.3
return: mixed|null
end note
note left of Item::isValueExists
Check if the value exists in the table for the given link.
since: 4.0.3
return: bool
end note
note right of Item::setLocalValue
Create a new value in the database table if it doesn't already exist.
since: 4.0.3
return: mixed|null
end note
note left of Item::insertItemWithGuid
Insert a new item with a GUID.
since: 4.0.3
return: ?string
end note
note right of Item::insertItemWithId
Insert a new item with a non-numeric ID.
since: 4.0.3
return: mixed|null
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---68a0f9af_265a_4db1_bae9_a4e4531f94d7---Power
```
> remember to replace the `---` with `___` to activate this Power in your code
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,270 @@
<?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\Interfaces\TableValidatorInterface as Validator;
use VDM\Joomla\Interfaces\Data\ItemInterface as DataItem;
use VDM\Joomla\Componentbuilder\Interfaces\ImportRowInterface as Row;
use VDM\Joomla\Utilities\GuidHelper;
use VDM\Joomla\Componentbuilder\Interfaces\ImportItemInterface;
/**
* Import Item Class
*
* @since 4.0.3
*/
final class Item implements ImportItemInterface
{
/**
* The Table Validator Class.
*
* @var Validator
* @since 4.0.3
*/
protected Validator $validator;
/**
* The Item Class.
*
* @var Item
* @since 4.0.3
*/
protected DataItem $item;
/**
* The Import Row Class.
*
* @var Row
* @since 4.0.3
*/
protected Row $row;
/**
* Constructor.
*
* @param Validator $validator The Table ValidatorI Class.
* @param DataItem $item The Item Class.
* @param Row $row The Import Row Class.
*
* @since 4.0.3
*/
public function __construct(Validator $validator, DataItem $item, Row $row)
{
$this->validator = $validator;
$this->item = $item;
$this->row = $row;
}
/**
* Get the item from the import row values and ensure it is valid
*
* @param string $table The table these columns belongs to.
* @param array $columns The columns to extract.
*
* @return array|null
* @since 4.0.3
*/
public function get(string $table, array $columns): ?array
{
$item = [];
foreach ($columns as $column => $map)
{
if (($value = $this->row->getValue($column)) !== null && !isset($item[$map['name']]))
{
// get the valid importable value
$item[$map['name']] = $this->getImportValue($value, $map['name'], $table, $map['link'] ?? null);
// remove value from global row values set
$this->row->unsetValue($column);
}
}
return $item ?? null;
}
/**
* Get the correct value needed for the import of the related row (item).
*
* @param mixed $value The value from the row.
* @param string $field The field name where the value is being stored.
* @param string $table The table this field belongs to.
* @param array $link The field link values.
*
* @return mixed
* @since 4.0.3
*/
private function getImportValue($value, string $field, string $table, ?array $link)
{
// Validate the link array and return the original value if invalid
if (empty($link) || $link['type'] !== 1 || empty($link['table']) || empty($link['key']) || empty($link['value']))
{
return $this->validImportValue($value, $field, $table);
}
// Handle GUID key with validation via GuidHelper
if ($link['key'] === 'guid' && GuidHelper::item($value, $link['table']))
{
return $value;
}
// Handle numeric ID with validation
if ($link['key'] === 'id' && is_numeric($value) && $this->isValueExists($value, $link))
{
return (int) $value;
}
// Attempt to retrieve the local value
$local_value = $this->getLocalValue($value, $link);
// If no local value exists, create it if necessary
if ($local_value === null)
{
$local_value = $this->setLocalValue($value, $link);
}
return $this->validImportValue($local_value, $field, $table);
}
/**
* Make sure we have a valid import value
*
* @param mixed $value The value.
* @param string $field The field name where the value is being stored.
* @param string $table The table this field belongs to.
*
* @return mixed
* @since 4.0.3
*/
private function validImportValue($value, string $field, string $table)
{
// make sure our value will fit in the database table datatype
return $this->validator->getValid($value, $field, $table);
}
/**
* Helper function to get the local value from the database table.
*
* @param mixed $value The value to search for.
* @param array $link The field link details.
*
* @return mixed|null The local value or null if not found.
* @since 4.0.3
*/
private function getLocalValue($value, array $link)
{
// Attempt to retrieve the value based on the link['value'] and link['key']
$local_value = $this->item->table($link['table'])->value($value, $link['value'], $link['key']);
// If not found, try retrieving by link['key'] and link['key']
if ($local_value === null && $this->isValueExists($value, $link))
{
return $value;
}
return $local_value;
}
/**
* Check if the value exists in the table for the given link.
*
* @param mixed $value The value to check.
* @param array $link The field link details.
*
* @return bool True if the value exists, false otherwise.
* @since 4.0.3
*/
private function isValueExists($value, array $link): bool
{
return $this->item->table($link['table'])->value($value, $link['key'], $link['key']) !== null;
}
/**
* Create a new value in the database table if it doesn't already exist.
*
* @param mixed $value The value to create.
* @param array $link The field link details.
*
* @return mixed|null The newly created value or null if creation failed.
* @since 4.0.3
*/
private function setLocalValue($value, array $link)
{
// Handle GUID creation if the provided value is not valid
if ($link['key'] === 'guid')
{
if (!GuidHelper::valid($value))
{
return $this->insertItemWithGuid($value, $link);
}
return null;
}
// Handle ID creation
if ($link['key'] === 'id')
{
if (!is_numeric($value))
{
return $this->insertItemWithId($value, $link);
}
return null;
}
// could not create local item (we don't have enough details)
return null;
}
/**
* Insert a new item with a GUID.
*
* @param mixed $value The value to insert.
* @param array $link The field link details.
*
* @return string|null The new GUID or null if insertion failed.
* @since 4.0.3
*/
private function insertItemWithGuid($value, array $link): ?string
{
$guid = GuidHelper::get();
$item = (object) [$link['value'] => $value, $link['key'] => $guid];
if ($this->item->table($link['table'])->set($item, $link['key'], 'insert'))
{
return $guid;
}
return null;
}
/**
* Insert a new item with a non-numeric ID.
*
* @param mixed $value The value to insert.
* @param array $link The field link details.
*
* @return mixed|null The new ID or null if insertion failed.
* @since 4.0.3
*/
private function insertItemWithId($value, array $link)
{
$item = (object) [$link['key'] => 0, $link['value'] => $value];
if ($this->item->table($link['table'])->set($item, $link['key'], 'insert'))
{
return $this->item->table($link['table'])->value($value, $link['value'], $link['key']);
}
return null;
}
}

View File

@ -0,0 +1,240 @@
/**
* The Table Validator Class.
*
* @var Validator
* @since 4.0.3
*/
protected Validator $validator;
/**
* The Item Class.
*
* @var Item
* @since 4.0.3
*/
protected DataItem $item;
/**
* The Import Row Class.
*
* @var Row
* @since 4.0.3
*/
protected Row $row;
/**
* Constructor.
*
* @param Validator $validator The Table ValidatorI Class.
* @param DataItem $item The Item Class.
* @param Row $row The Import Row Class.
*
* @since 4.0.3
*/
public function __construct(Validator $validator, DataItem $item, Row $row)
{
$this->validator = $validator;
$this->item = $item;
$this->row = $row;
}
/**
* Get the item from the import row values and ensure it is valid
*
* @param string $table The table these columns belongs to.
* @param array $columns The columns to extract.
*
* @return array|null
* @since 4.0.3
*/
public function get(string $table, array $columns): ?array
{
$item = [];
foreach ($columns as $column => $map)
{
if (($value = $this->row->getValue($column)) !== null && !isset($item[$map['name']]))
{
// get the valid importable value
$item[$map['name']] = $this->getImportValue($value, $map['name'], $table, $map['link'] ?? null);
// remove value from global row values set
$this->row->unsetValue($column);
}
}
return $item ?? null;
}
/**
* Get the correct value needed for the import of the related row (item).
*
* @param mixed $value The value from the row.
* @param string $field The field name where the value is being stored.
* @param string $table The table this field belongs to.
* @param array $link The field link values.
*
* @return mixed
* @since 4.0.3
*/
private function getImportValue($value, string $field, string $table, ?array $link)
{
// Validate the link array and return the original value if invalid
if (empty($link) || $link['type'] !== 1 || empty($link['table']) || empty($link['key']) || empty($link['value']))
{
return $this->validImportValue($value, $field, $table);
}
// Handle GUID key with validation via GuidHelper
if ($link['key'] === 'guid' && GuidHelper::item($value, $link['table']))
{
return $value;
}
// Handle numeric ID with validation
if ($link['key'] === 'id' && is_numeric($value) && $this->isValueExists($value, $link))
{
return (int) $value;
}
// Attempt to retrieve the local value
$local_value = $this->getLocalValue($value, $link);
// If no local value exists, create it if necessary
if ($local_value === null)
{
$local_value = $this->setLocalValue($value, $link);
}
return $this->validImportValue($local_value, $field, $table);
}
/**
* Make sure we have a valid import value
*
* @param mixed $value The value.
* @param string $field The field name where the value is being stored.
* @param string $table The table this field belongs to.
*
* @return mixed
* @since 4.0.3
*/
private function validImportValue($value, string $field, string $table)
{
// make sure our value will fit in the database table datatype
return $this->validator->getValid($value, $field, $table);
}
/**
* Helper function to get the local value from the database table.
*
* @param mixed $value The value to search for.
* @param array $link The field link details.
*
* @return mixed|null The local value or null if not found.
* @since 4.0.3
*/
private function getLocalValue($value, array $link)
{
// Attempt to retrieve the value based on the link['value'] and link['key']
$local_value = $this->item->table($link['table'])->value($value, $link['value'], $link['key']);
// If not found, try retrieving by link['key'] and link['key']
if ($local_value === null && $this->isValueExists($value, $link))
{
return $value;
}
return $local_value;
}
/**
* Check if the value exists in the table for the given link.
*
* @param mixed $value The value to check.
* @param array $link The field link details.
*
* @return bool True if the value exists, false otherwise.
* @since 4.0.3
*/
private function isValueExists($value, array $link): bool
{
return $this->item->table($link['table'])->value($value, $link['key'], $link['key']) !== null;
}
/**
* Create a new value in the database table if it doesn't already exist.
*
* @param mixed $value The value to create.
* @param array $link The field link details.
*
* @return mixed|null The newly created value or null if creation failed.
* @since 4.0.3
*/
private function setLocalValue($value, array $link)
{
// Handle GUID creation if the provided value is not valid
if ($link['key'] === 'guid')
{
if (!GuidHelper::valid($value))
{
return $this->insertItemWithGuid($value, $link);
}
return null;
}
// Handle ID creation
if ($link['key'] === 'id')
{
if (!is_numeric($value))
{
return $this->insertItemWithId($value, $link);
}
return null;
}
// could not create local item (we don't have enough details)
return null;
}
/**
* Insert a new item with a GUID.
*
* @param mixed $value The value to insert.
* @param array $link The field link details.
*
* @return string|null The new GUID or null if insertion failed.
* @since 4.0.3
*/
private function insertItemWithGuid($value, array $link): ?string
{
$guid = GuidHelper::get();
$item = (object) [$link['value'] => $value, $link['key'] => $guid];
if ($this->item->table($link['table'])->set($item, $link['key'], 'insert'))
{
return $guid;
}
return null;
}
/**
* Insert a new item with a non-numeric ID.
*
* @param mixed $value The value to insert.
* @param array $link The field link details.
*
* @return mixed|null The new ID or null if insertion failed.
* @since 4.0.3
*/
private function insertItemWithId($value, array $link)
{
$item = (object) [$link['key'] => 0, $link['value'] => $value];
if ($this->item->table($link['table'])->set($item, $link['key'], 'insert'))
{
return $this->item->table($link['table'])->value($value, $link['value'], $link['key']);
}
return null;
}

View File

@ -0,0 +1,38 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "",
"guid": "68a0f9af-265a-4db1-bae9-a4e4531f94d7",
"implements": [
"53f55e5b-63cb-49e7-b1e6-33e7a9f97856"
],
"load_selection": null,
"name": "Item",
"power_version": "1.0.0",
"system_name": "JCB.Import.Item",
"type": "final class",
"use_selection": {
"use_selection0": {
"use": "feb3affa-5102-4307-93db-04525f4c66f0",
"as": "Validator"
},
"use_selection1": {
"use": "05744dd3-4030-4cf8-8dda-a93ab809b473",
"as": "DataItem"
},
"use_selection2": {
"use": "3d3ec064-9867-41e6-a48a-964c15d753aa",
"as": "Row"
},
"use_selection3": {
"use": "9c513baf-b279-43fd-ae29-a585c8cbc4f0",
"as": "default"
}
},
"extendsinterfaces": null,
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Import.Item",
"description": "Import Item 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": "",
"composer": ""
}

View File

@ -14,9 +14,11 @@
abstract Database #Orange {
# $db
# string $table
# string $dateFormat
+ __construct()
# quote(mixed $value) : mixed
# getTable(string $table) : string
# getDateFormat() : string
}
note right of Database::__construct
@ -39,6 +41,13 @@ core component as needed
since: 3.2.0
return: string
end note
note right of Database::getDateFormat
Get the date format to return in the quote
since: 5.0.2
return: string
end note
@enduml
```

View File

@ -38,6 +38,14 @@ abstract class Database
*/
protected string $table;
/**
* Date format to return
*
* @var string
* @since 5.0.2
*/
protected string $dateFormat = 'Y-m-d H:i:s';
/**
* Constructor
*
@ -62,23 +70,32 @@ abstract class Database
**/
protected function quote($value)
{
if ($value === null) // hmm the null does pose an issue (will keep an eye on this)
if ($value === null)
{
return 'NULL';
}
if (is_numeric($value))
{
// If the value is a numeric string (e.g., "0123"), treat it as a string to preserve the format
if (is_string($value) && ltrim($value, '0') !== $value)
{
return $this->db->quote($value);
}
if (filter_var($value, FILTER_VALIDATE_INT))
{
return (int) $value;
}
elseif (filter_var($value, FILTER_VALIDATE_FLOAT))
if (filter_var($value, FILTER_VALIDATE_FLOAT))
{
return (float) $value;
}
}
elseif (is_bool($value)) // not sure if this will work well (but its correct)
// Handle boolean values
if (is_bool($value))
{
return $value ? 'TRUE' : 'FALSE';
}
@ -86,10 +103,10 @@ abstract class Database
// For date and datetime values
if ($value instanceof \DateTime)
{
return $this->db->quote($value->format('Y-m-d H:i:s'));
return $this->db->quote($value->format($this->getDateFormat()));
}
// For other data types, just escape it
// For other types of values, quote as string
return $this->db->quote($value);
}
@ -110,6 +127,17 @@ abstract class Database
}
return $table;
}
/**
* Get the date format to return in the quote
*
* @return string
* @since 5.0.2
**/
protected function getDateFormat(): string
{
return $this->dateFormat;
}
}

View File

@ -13,6 +13,14 @@
*/
protected string $table;
/**
* Date format to return
*
* @var string
* @since 5.0.2
*/
protected string $dateFormat = 'Y-m-d H:i:s';
/**
* Constructor
*
@ -37,23 +45,32 @@
**/
protected function quote($value)
{
if ($value === null) // hmm the null does pose an issue (will keep an eye on this)
if ($value === null)
{
return 'NULL';
}
if (is_numeric($value))
{
// If the value is a numeric string (e.g., "0123"), treat it as a string to preserve the format
if (is_string($value) && ltrim($value, '0') !== $value)
{
return $this->db->quote($value);
}
if (filter_var($value, FILTER_VALIDATE_INT))
{
return (int) $value;
}
elseif (filter_var($value, FILTER_VALIDATE_FLOAT))
if (filter_var($value, FILTER_VALIDATE_FLOAT))
{
return (float) $value;
}
}
elseif (is_bool($value)) // not sure if this will work well (but its correct)
// Handle boolean values
if (is_bool($value))
{
return $value ? 'TRUE' : 'FALSE';
}
@ -61,10 +78,10 @@
// For date and datetime values
if ($value instanceof \DateTime)
{
return $this->db->quote($value->format('Y-m-d H:i:s'));
return $this->db->quote($value->format($this->getDateFormat()));
}
// For other data types, just escape it
// For other types of values, quote as string
return $this->db->quote($value);
}
@ -85,4 +102,15 @@
}
return $table;
}
/**
* Get the date format to return in the quote
*
* @return string
* @since 5.0.2
**/
protected function getDateFormat(): string
{
return $this->dateFormat;
}

View File

@ -0,0 +1,184 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# final class Validator (Details)
> namespace: **VDM\Joomla\Componentbuilder\Table**
```uml
@startuml
class Validator << (F,LightGreen) >> #RoyalBlue {
# Table $table
# array $validators
# array $defaults
# array $datatypes
+ __construct(Table $table)
+ getValid(mixed $value, string $field, ...) : mixed
- validate(mixed $value, array $dbField) : bool
- getDefault(array $dbField, mixed $value) : mixed
- parseDataType(string $datatype) : array
- getDatabaseField(string $field, string $table) : array
- registerValidators() : void
- registerDefaults() : void
- validateInteger(mixed $value, array $typeInfo) : bool
- validateString(mixed $value, array $typeInfo) : bool
- validateText(mixed $value, array $typeInfo) : bool
- validateFloat(mixed $value, array $typeInfo) : bool
- validateDecimal(mixed $value, array $typeInfo) : bool
- validateDate(mixed $value, array $typeInfo) : bool
- validateJson(mixed $value, array $typeInfo) : bool
- validateBlob(mixed $value, array $typeInfo) : bool
}
note right of Validator::__construct
Constructor.
since: 5.3.0
end note
note left of Validator::getValid
Returns the valid value based on datatype definition.
If the value is valid, return it. If not, return the default value,
NULL (if allowed), or an empty string if 'EMPTY' is set.
since: 5.3.0
return: mixed
arguments:
mixed $value
string $field
string $table
end note
note right of Validator::validate
Validate if the given value is valid for the provided database field.
This is a private method as `getValid()` will handle the actual logic.
since: 5.3.0
return: bool
end note
note left of Validator::getDefault
Handle returning the default value, null, or empty string if validation fails.
since: 5.3.0
return: mixed
end note
note right of Validator::parseDataType
Parse the data type from the database field and extract details like type, size, and precision.
since: 5.3.0
return: array
end note
note left of Validator::getDatabaseField
Retrieve the database field structure for the specified field and table.
In your case, you use `$db = $this->table->get($table, $field, 'db')`.
since: 5.3.0
return: array
end note
note right of Validator::registerValidators
Register validators for MySQL data types.
since: 5.3.0
return: void
end note
note left of Validator::registerDefaults
Register default values for MySQL data types.
since: 5.3.0
return: void
end note
note right of Validator::validateInteger
Validate integer types (including tinyint, smallint, mediumint, etc.).
since: 5.3.0
return: bool
end note
note left of Validator::validateString
Validate string types like VARCHAR and CHAR.
since: 5.3.0
return: bool
end note
note right of Validator::validateText
Validate text types like TEXT, TINYTEXT, MEDIUMTEXT, LONGTEXT.
since: 5.3.0
return: bool
end note
note left of Validator::validateFloat
Validate float, double, and decimal types.
since: 5.3.0
return: bool
end note
note right of Validator::validateDecimal
Validate decimal types (numeric precision and scale).
since: 5.3.0
return: bool
end note
note left of Validator::validateDate
Validate date, datetime, timestamp, and time types.
since: 5.3.0
return: bool
end note
note right of Validator::validateJson
Validate JSON types.
since: 5.3.0
return: bool
end note
note left of Validator::validateBlob
Validate BLOB types (including TINYBLOB, MEDIUMBLOB, LONGBLOB).
since: 5.3.0
return: bool
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---79fd4f39_824d_4ab6_936d_959705ff24ec---Power
```
> remember to replace the `---` with `___` to activate this Power in your code
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,426 @@
<?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\Table;
use VDM\Joomla\Componentbuilder\Table;
use VDM\Joomla\Interfaces\TableValidatorInterface;
/**
* Table Value Validator
*
* @since 5.3.0
*/
final class Validator implements TableValidatorInterface
{
/**
* The Table Class.
*
* @var Table
* @since 5.3.0
*/
protected Table $table;
/**
* A map of MySQL base types to their respective validation methods.
*
* @var array
* @since 5.3.0
*/
protected array $validators = [];
/**
* A map of defaults for the respective datatypes.
*
* @var array
* @since 5.3.0
*/
protected array $defaults = [];
/**
* Cache of the parsed datatype details
*
* @var array
* @since 5.3.0
*/
protected array $datatypes = [];
/**
* Constructor.
*
* @param Table $table The Table Class.
*
* @since 5.3.0
*/
public function __construct(Table $table)
{
$this->table = $table;
// Register datatype validators (mapping MySQL types to handlers)
$this->registerValidators();
// Register datatype defaults
$this->registerDefaults();
}
/**
* Returns the valid value based on datatype definition.
* If the value is valid, return it. If not, return the default value,
* NULL (if allowed), or an empty string if 'EMPTY' is set.
*
* @param mixed $value The value to validate.
* @param string $field The field name.
* @param string $table The table name.
*
* @return mixed Returns the valid value, or the default, NULL, or empty string based on validation.
* @since 5.3.0
*/
public function getValid($value, string $field, string $table)
{
// Get the database field definition
if (($dbField = $this->getDatabaseField($field, $table)) === null)
{
return null; // not legal field or table
}
// Check if the value is valid for the field
if ($this->validate($value, $dbField))
{
return $value;
}
// If invalid, return default, NULL (if allowed), or empty string
return $this->getDefault($dbField, $value);
}
/**
* Validate if the given value is valid for the provided database field.
* This is a private method as `getValid()` will handle the actual logic.
*
* @param mixed $value The value to validate.
* @param array $dbField The database field details (type, default, null_switch, etc.).
*
* @return bool Returns true if the value is valid, false otherwise.
* @since 5.3.0
*/
private function validate($value, array $dbField): bool
{
// Extract datatype and handle the validation
$typeInfo = $this->parseDataType($dbField['type']);
$baseType = $typeInfo['type'];
// Use the appropriate validator if it exists
if (isset($this->validators[$baseType]))
{
return call_user_func($this->validators[$baseType], $value, $typeInfo);
}
// If no validator exists, assume invalid
return false;
}
/**
* Handle returning the default value, null, or empty string if validation fails.
*
* @param array $dbField The database field details.
* @param mixed $value The value to validate.
*
* @return mixed The default value, null, or empty string based on field settings.
* @since 5.3.0
*/
private function getDefault(array $dbField, $value)
{
// get default value from field db
$db_default = isset($dbField['default']) ? $dbField['default'] : null;
// If a default value is provided, return it
if ($db_default !== null)
{
return strtoupper($db_default) === 'EMPTY' ? '' : $db_default;
}
// Check if NULL is allowed
if (isset($dbField['null_switch']) && strtoupper($dbField['null_switch']) === 'NULL')
{
return null;
}
// Fallback to datatype default
$typeInfo = $this->parseDataType($dbField['type']);
return $this->defaults[$typeInfo['type']] ?? '';
}
/**
* Parse the data type from the database field and extract details like type, size, and precision.
*
* @param string $datatype The full MySQL datatype (e.g., VARCHAR(255)).
*
* @return array An array containing 'type', 'size', and other relevant info.
* @since 5.3.0
*/
private function parseDataType(string $datatype): array
{
if (isset($this->datatypes[$datatype]))
{
return $this->datatypes[$datatype];
}
$pattern = '/(?<type>\w+)(\((?<size>\d+)(,\s*(?<precision>\d+))?\))?/i';
preg_match($pattern, $datatype, $matches);
$result = [
'type' => isset($matches['type']) ? strtolower($matches['type']) : strtolower($datatype),
'size' => $matches['size'] ?? null,
'precision' => $matches['precision'] ?? null,
];
return $this->datatypes[$datatype] = $result;
}
/**
* Retrieve the database field structure for the specified field and table.
* In your case, you use `$db = $this->table->get($table, $field, 'db')`.
*
* @param string $field The field name.
* @param string $table The table name.
*
* @return array The database field details, including type, default, null_switch, etc.
* @since 5.3.0
*/
private function getDatabaseField(string $field, string $table): array
{
// Simulated retrieval of field details. Replace with actual logic.
return $this->table->get($table, $field, 'db');
}
/**
* Register validators for MySQL data types.
*
* @return void
* @since 5.3.0
*/
private function registerValidators(): void
{
$this->validators = [
'int' => [$this, 'validateInteger'],
'tinyint' => [$this, 'validateInteger'],
'smallint' => [$this, 'validateInteger'],
'mediumint' => [$this, 'validateInteger'],
'bigint' => [$this, 'validateInteger'],
'varchar' => [$this, 'validateString'],
'char' => [$this, 'validateString'],
'text' => [$this, 'validateText'],
'tinytext' => [$this, 'validateText'],
'mediumtext' => [$this, 'validateText'],
'longtext' => [$this, 'validateText'],
'decimal' => [$this, 'validateDecimal'],
'float' => [$this, 'validateFloat'],
'double' => [$this, 'validateFloat'],
'date' => [$this, 'validateDate'],
'datetime' => [$this, 'validateDate'],
'timestamp' => [$this, 'validateDate'],
'time' => [$this, 'validateDate'],
'json' => [$this, 'validateJson'],
'blob' => [$this, 'validateBlob'],
'tinyblob' => [$this, 'validateBlob'],
'mediumblob' => [$this, 'validateBlob'],
'longblob' => [$this, 'validateBlob'],
];
}
/**
* Register default values for MySQL data types.
*
* @return void
* @since 5.3.0
*/
private function registerDefaults(): void
{
$this->defaults = [
'int' => 0,
'tinyint' => 0,
'smallint' => 0,
'mediumint' => 0,
'bigint' => 0,
'varchar' => '',
'char' => '',
'text' => '',
'tinytext' => '',
'mediumtext' => '',
'longtext' => '',
'decimal' => 0.0,
'float' => 0.0,
'double' => 0.0,
'date' => '0000-00-00',
'datetime' => '0000-00-00 00:00:00',
'timestamp' => '0000-00-00 00:00:00',
'time' => '00:00:00',
'json' => '{}',
'blob' => '',
'tinyblob' => '',
'mediumblob' => '',
'longblob' => '',
];
}
// ----------------- Validation Methods -----------------
/**
* Validate integer types (including tinyint, smallint, mediumint, etc.).
*
* @param mixed $value The value to validate.
* @param array $typeInfo The parsed data type information.
*
* @return bool True if valid, false otherwise.
* @since 5.3.0
*/
private function validateInteger($value, array $typeInfo): bool
{
if (!is_numeric($value))
{
return false;
}
$value = (int)$value;
if (isset($typeInfo['unsigned']) && $typeInfo['unsigned'] && $value < 0)
{
return false;
}
return true;
}
/**
* Validate string types like VARCHAR and CHAR.
*
* @param mixed $value The value to validate.
* @param array $typeInfo The parsed data type information.
*
* @return bool True if valid, false otherwise.
* @since 5.3.0
*/
private function validateString($value, array $typeInfo): bool
{
if (!is_string($value))
{
return false;
}
// Check if the length exceeds the allowed size
if ($typeInfo['size'] !== null && strlen($value) > (int)$typeInfo['size'])
{
return false;
}
return true;
}
/**
* Validate text types like TEXT, TINYTEXT, MEDIUMTEXT, LONGTEXT.
*
* @param mixed $value The value to validate.
* @param array $typeInfo The parsed data type information.
*
* @return bool True if valid, false otherwise.
* @since 5.3.0
*/
private function validateText($value, array $typeInfo): bool
{
return is_string($value);
}
/**
* Validate float, double, and decimal types.
*
* @param mixed $value The value to validate.
* @param array $typeInfo The parsed data type information.
*
* @return bool True if valid, false otherwise.
* @since 5.3.0
*/
private function validateFloat($value, array $typeInfo): bool
{
return is_numeric($value);
}
/**
* Validate decimal types (numeric precision and scale).
*
* @param mixed $value The value to validate.
* @param array $typeInfo The parsed data type information.
*
* @return bool True if valid, false otherwise.
* @since 5.3.0
*/
private function validateDecimal($value, array $typeInfo): bool
{
return is_numeric($value);
}
/**
* Validate date, datetime, timestamp, and time types.
*
* @param mixed $value The value to validate.
* @param array $typeInfo The parsed data type information.
*
* @return bool True if valid, false otherwise.
* @since 5.3.0
*/
private function validateDate($value, array $typeInfo): bool
{
$formats = [
'date' => 'Y-m-d',
'datetime' => 'Y-m-d H:i:s',
'timestamp' => 'Y-m-d H:i:s',
'time' => 'H:i:s',
];
if (!isset($formats[$typeInfo['type']]))
{
return false;
}
$dateTime = \DateTime::createFromFormat($formats[$typeInfo['type']], $value);
return $dateTime && $dateTime->format($formats[$typeInfo['type']]) === $value;
}
/**
* Validate JSON types.
*
* @param mixed $value The value to validate.
* @param array $typeInfo The parsed data type information.
*
* @return bool True if valid, false otherwise.
* @since 5.3.0
*/
private function validateJson($value, array $typeInfo): bool
{
json_decode($value);
return json_last_error() === JSON_ERROR_NONE;
}
/**
* Validate BLOB types (including TINYBLOB, MEDIUMBLOB, LONGBLOB).
*
* @param mixed $value The value to validate.
* @param array $typeInfo The parsed data type information.
*
* @return bool True if valid, false otherwise.
* @since 5.3.0
*/
private function validateBlob($value, array $typeInfo): bool
{
return is_string($value) || is_resource($value);
}
}

View File

@ -0,0 +1,399 @@
/**
* The Table Class.
*
* @var Table
* @since 5.3.0
*/
protected Table $table;
/**
* A map of MySQL base types to their respective validation methods.
*
* @var array
* @since 5.3.0
*/
protected array $validators = [];
/**
* A map of defaults for the respective datatypes.
*
* @var array
* @since 5.3.0
*/
protected array $defaults = [];
/**
* Cache of the parsed datatype details
*
* @var array
* @since 5.3.0
*/
protected array $datatypes = [];
/**
* Constructor.
*
* @param Table $table The Table Class.
*
* @since 5.3.0
*/
public function __construct(Table $table)
{
$this->table = $table;
// Register datatype validators (mapping MySQL types to handlers)
$this->registerValidators();
// Register datatype defaults
$this->registerDefaults();
}
/**
* Returns the valid value based on datatype definition.
* If the value is valid, return it. If not, return the default value,
* NULL (if allowed), or an empty string if 'EMPTY' is set.
*
* @param mixed $value The value to validate.
* @param string $field The field name.
* @param string $table The table name.
*
* @return mixed Returns the valid value, or the default, NULL, or empty string based on validation.
* @since 5.3.0
*/
public function getValid($value, string $field, string $table)
{
// Get the database field definition
if (($dbField = $this->getDatabaseField($field, $table)) === null)
{
return null; // not legal field or table
}
// Check if the value is valid for the field
if ($this->validate($value, $dbField))
{
return $value;
}
// If invalid, return default, NULL (if allowed), or empty string
return $this->getDefault($dbField, $value);
}
/**
* Validate if the given value is valid for the provided database field.
* This is a private method as `getValid()` will handle the actual logic.
*
* @param mixed $value The value to validate.
* @param array $dbField The database field details (type, default, null_switch, etc.).
*
* @return bool Returns true if the value is valid, false otherwise.
* @since 5.3.0
*/
private function validate($value, array $dbField): bool
{
// Extract datatype and handle the validation
$typeInfo = $this->parseDataType($dbField['type']);
$baseType = $typeInfo['type'];
// Use the appropriate validator if it exists
if (isset($this->validators[$baseType]))
{
return call_user_func($this->validators[$baseType], $value, $typeInfo);
}
// If no validator exists, assume invalid
return false;
}
/**
* Handle returning the default value, null, or empty string if validation fails.
*
* @param array $dbField The database field details.
* @param mixed $value The value to validate.
*
* @return mixed The default value, null, or empty string based on field settings.
* @since 5.3.0
*/
private function getDefault(array $dbField, $value)
{
// get default value from field db
$db_default = isset($dbField['default']) ? $dbField['default'] : null;
// If a default value is provided, return it
if ($db_default !== null)
{
return strtoupper($db_default) === 'EMPTY' ? '' : $db_default;
}
// Check if NULL is allowed
if (isset($dbField['null_switch']) && strtoupper($dbField['null_switch']) === 'NULL')
{
return null;
}
// Fallback to datatype default
$typeInfo = $this->parseDataType($dbField['type']);
return $this->defaults[$typeInfo['type']] ?? '';
}
/**
* Parse the data type from the database field and extract details like type, size, and precision.
*
* @param string $datatype The full MySQL datatype (e.g., VARCHAR(255)).
*
* @return array An array containing 'type', 'size', and other relevant info.
* @since 5.3.0
*/
private function parseDataType(string $datatype): array
{
if (isset($this->datatypes[$datatype]))
{
return $this->datatypes[$datatype];
}
$pattern = '/(?<type>\w+)(\((?<size>\d+)(,\s*(?<precision>\d+))?\))?/i';
preg_match($pattern, $datatype, $matches);
$result = [
'type' => isset($matches['type']) ? strtolower($matches['type']) : strtolower($datatype),
'size' => $matches['size'] ?? null,
'precision' => $matches['precision'] ?? null,
];
return $this->datatypes[$datatype] = $result;
}
/**
* Retrieve the database field structure for the specified field and table.
* In your case, you use `$db = $this->table->get($table, $field, 'db')`.
*
* @param string $field The field name.
* @param string $table The table name.
*
* @return array The database field details, including type, default, null_switch, etc.
* @since 5.3.0
*/
private function getDatabaseField(string $field, string $table): array
{
// Simulated retrieval of field details. Replace with actual logic.
return $this->table->get($table, $field, 'db');
}
/**
* Register validators for MySQL data types.
*
* @return void
* @since 5.3.0
*/
private function registerValidators(): void
{
$this->validators = [
'int' => [$this, 'validateInteger'],
'tinyint' => [$this, 'validateInteger'],
'smallint' => [$this, 'validateInteger'],
'mediumint' => [$this, 'validateInteger'],
'bigint' => [$this, 'validateInteger'],
'varchar' => [$this, 'validateString'],
'char' => [$this, 'validateString'],
'text' => [$this, 'validateText'],
'tinytext' => [$this, 'validateText'],
'mediumtext' => [$this, 'validateText'],
'longtext' => [$this, 'validateText'],
'decimal' => [$this, 'validateDecimal'],
'float' => [$this, 'validateFloat'],
'double' => [$this, 'validateFloat'],
'date' => [$this, 'validateDate'],
'datetime' => [$this, 'validateDate'],
'timestamp' => [$this, 'validateDate'],
'time' => [$this, 'validateDate'],
'json' => [$this, 'validateJson'],
'blob' => [$this, 'validateBlob'],
'tinyblob' => [$this, 'validateBlob'],
'mediumblob' => [$this, 'validateBlob'],
'longblob' => [$this, 'validateBlob'],
];
}
/**
* Register default values for MySQL data types.
*
* @return void
* @since 5.3.0
*/
private function registerDefaults(): void
{
$this->defaults = [
'int' => 0,
'tinyint' => 0,
'smallint' => 0,
'mediumint' => 0,
'bigint' => 0,
'varchar' => '',
'char' => '',
'text' => '',
'tinytext' => '',
'mediumtext' => '',
'longtext' => '',
'decimal' => 0.0,
'float' => 0.0,
'double' => 0.0,
'date' => '0000-00-00',
'datetime' => '0000-00-00 00:00:00',
'timestamp' => '0000-00-00 00:00:00',
'time' => '00:00:00',
'json' => '{}',
'blob' => '',
'tinyblob' => '',
'mediumblob' => '',
'longblob' => '',
];
}
// ----------------- Validation Methods -----------------
/**
* Validate integer types (including tinyint, smallint, mediumint, etc.).
*
* @param mixed $value The value to validate.
* @param array $typeInfo The parsed data type information.
*
* @return bool True if valid, false otherwise.
* @since 5.3.0
*/
private function validateInteger($value, array $typeInfo): bool
{
if (!is_numeric($value))
{
return false;
}
$value = (int)$value;
if (isset($typeInfo['unsigned']) && $typeInfo['unsigned'] && $value < 0)
{
return false;
}
return true;
}
/**
* Validate string types like VARCHAR and CHAR.
*
* @param mixed $value The value to validate.
* @param array $typeInfo The parsed data type information.
*
* @return bool True if valid, false otherwise.
* @since 5.3.0
*/
private function validateString($value, array $typeInfo): bool
{
if (!is_string($value))
{
return false;
}
// Check if the length exceeds the allowed size
if ($typeInfo['size'] !== null && strlen($value) > (int)$typeInfo['size'])
{
return false;
}
return true;
}
/**
* Validate text types like TEXT, TINYTEXT, MEDIUMTEXT, LONGTEXT.
*
* @param mixed $value The value to validate.
* @param array $typeInfo The parsed data type information.
*
* @return bool True if valid, false otherwise.
* @since 5.3.0
*/
private function validateText($value, array $typeInfo): bool
{
return is_string($value);
}
/**
* Validate float, double, and decimal types.
*
* @param mixed $value The value to validate.
* @param array $typeInfo The parsed data type information.
*
* @return bool True if valid, false otherwise.
* @since 5.3.0
*/
private function validateFloat($value, array $typeInfo): bool
{
return is_numeric($value);
}
/**
* Validate decimal types (numeric precision and scale).
*
* @param mixed $value The value to validate.
* @param array $typeInfo The parsed data type information.
*
* @return bool True if valid, false otherwise.
* @since 5.3.0
*/
private function validateDecimal($value, array $typeInfo): bool
{
return is_numeric($value);
}
/**
* Validate date, datetime, timestamp, and time types.
*
* @param mixed $value The value to validate.
* @param array $typeInfo The parsed data type information.
*
* @return bool True if valid, false otherwise.
* @since 5.3.0
*/
private function validateDate($value, array $typeInfo): bool
{
$formats = [
'date' => 'Y-m-d',
'datetime' => 'Y-m-d H:i:s',
'timestamp' => 'Y-m-d H:i:s',
'time' => 'H:i:s',
];
if (!isset($formats[$typeInfo['type']]))
{
return false;
}
$dateTime = \DateTime::createFromFormat($formats[$typeInfo['type']], $value);
return $dateTime && $dateTime->format($formats[$typeInfo['type']]) === $value;
}
/**
* Validate JSON types.
*
* @param mixed $value The value to validate.
* @param array $typeInfo The parsed data type information.
*
* @return bool True if valid, false otherwise.
* @since 5.3.0
*/
private function validateJson($value, array $typeInfo): bool
{
json_decode($value);
return json_last_error() === JSON_ERROR_NONE;
}
/**
* Validate BLOB types (including TINYBLOB, MEDIUMBLOB, LONGBLOB).
*
* @param mixed $value The value to validate.
* @param array $typeInfo The parsed data type information.
*
* @return bool True if valid, false otherwise.
* @since 5.3.0
*/
private function validateBlob($value, array $typeInfo): bool
{
return is_string($value) || is_resource($value);
}

View File

@ -0,0 +1,26 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "",
"guid": "79fd4f39-824d-4ab6-936d-959705ff24ec",
"implements": [
"feb3affa-5102-4307-93db-04525f4c66f0"
],
"load_selection": null,
"name": "Validator",
"power_version": "1.0.0",
"system_name": "VDM.Table.Validator",
"type": "final class",
"use_selection": {
"use_selection0": {
"use": "bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8",
"as": "default"
}
},
"extendsinterfaces": null,
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Table.Validator",
"description": "Table Value Validator\r\n\r\n@since 5.3.0",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
"head": "",
"composer": ""
}

View File

@ -6,16 +6,16 @@
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# trait ToString (Details)
# trait PathToString (Details)
> namespace: **VDM\Joomla\Abstraction\Registry\Traits**
```uml
@startuml
class ToString << (T,Orange) >> #Turquoise {
+ toString(string $path, string $separator = '') : string
class PathToString << (T,Orange) >> #Turquoise {
+ pathToString(string $path, string $separator = '') : string
}
note right of ToString::toString
note right of PathToString::pathToString
Convert an array of values to a string (or return string)
since: 3.2.0

View File

@ -13,11 +13,12 @@ namespace VDM\Joomla\Abstraction\Registry\Traits;
/**
* To String Values
* Path To String Values
*
* @since 3.2.0
* @since 3.2.0
* @since 5.0.2 name changed to PathToString to avoid collusion in core registry class
*/
trait ToString
trait PathToString
{
/**
* Convert an array of values to a string (or return string)
@ -26,9 +27,9 @@ trait ToString
* @param string $seperator Return string separator
*
* @return string
* @since 3.2.0
* @since 3.2.0
*/
public function toString(string $path, string $separator = ''): string
public function pathToString(string $path, string $separator = ''): string
{
// Return default value if path is empty
if (empty($path))

View File

@ -5,9 +5,9 @@
* @param string $seperator Return string separator
*
* @return string
* @since 3.2.0
* @since 3.2.0
*/
public function toString(string $path, string $separator = ''): string
public function pathToString(string $path, string $separator = ''): string
{
// Return default value if path is empty
if (empty($path))

View File

@ -5,14 +5,14 @@
"guid": "7d494d91-ab60-43cd-aecf-d50e07f7f30e",
"implements": null,
"load_selection": null,
"name": "ToString",
"name": "PathToString",
"power_version": "1.0.0",
"system_name": "VDM.Abstraction.Registry.Traits.ToString",
"system_name": "VDM.Abstraction.Registry.Traits.PathToString",
"type": "trait",
"use_selection": null,
"extendsinterfaces": null,
"namespace": "[[[NamespacePrefix]]]\\Joomla\\Abstraction.Registry.Traits.ToString",
"description": "To String Values\r\n\r\n@since 3.2.0",
"namespace": "[[[NamespacePrefix]]]\\Joomla\\Abstraction.Registry.Traits.PathToString",
"description": "Path To String Values\r\n\r\n@since 3.2.0\r\n@since 5.0.2 name changed to PathToString 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",
"head": "",
"composer": ""

View File

@ -14,16 +14,141 @@
@startuml
abstract Registry #Orange {
# ?string $separator
# ?string $name
+ __construct(mixed $data = null, ?string $separator = null)
+ __get(string $name) : mixed
+ __set(string $name, mixed $value) : void
+ __isset(string $name) : bool
+ __unset(string $name) : void
+ __clone() : void
+ __toString() : string
+ loadString(string $data, string $format = 'JSON', ...) : self
+ loadObject(object $object) : self
+ loadArray(array $array) : self
+ loadFile(string $path, string $format = 'json') : self
+ set(string $path, mixed $value) : self
+ add(string $path, mixed $value, ...) : self
+ get(string $path, mixed $default = null) : mixed
+ remove(string $path) : self
+ exists(string $path) : bool
+ jsonSerialize() : mixed
+ count() : int
+ offsetExists(mixed $offset) : bool
+ offsetGet(mixed $offset) : mixed
+ offsetSet(mixed $offset, mixed $value) : void
+ offsetUnset(mixed $offset) : void
+ getIterator() : \Traversable
+ toArray() : array
+ toObject() : object
+ toString(string $format = 'JSON', array $options = []) : string
+ flatten(?string $separator = null, bool $full = false) : array
+ def(string $path, mixed $default) : mixed
+ merge(Registryinterface $source) : self
+ clear() : self
+ extract(string $path, mixed $default = null, ...) : self
+ append(string $path, mixed $value) : self
+ getName() : ?string
+ setName(?string $name) : self
+ setSeparator(?string $value) : self
+ getSeparator() : ?string
# arrayToObject(mixed $data) : mixed
# objectToArray(mixed $data) : mixed
# arrayMergeRecursive(array $array1, array $array2) : array
# flattenArray(array $array, string $separator, ...) : array
# getActiveKeys(string $path) : ?array
}
note right of Registry::set
note right of Registry::__construct
Constructor.
Initializes the Registry object with optional data.
Can be an array, string, or object.
since: 5.0.4
end note
note left of Registry::__get
Magic method to get a value from the registry.
Allows for accessing registry data using object property syntax.
since: 5.0.4
return: mixed
end note
note right of Registry::__set
Magic method to set a value in the registry.
Allows for setting registry data using object property syntax.
since: 5.0.4
return: void
end note
note left of Registry::__isset
Magic method to check if a property is set in the registry.
Allows for using isset() on registry properties.
since: 5.0.4
return: bool
end note
note right of Registry::__unset
Magic method to unset a property in the registry.
Allows for using unset() on registry properties.
since: 5.0.4
return: void
end note
note left of Registry::__clone
Magic method to clone the registry.
Performs a deep copy of the registry data.
since: 5.0.4
return: void
end note
note right of Registry::__toString
Magic method to convert the registry to a string.
Returns the registry data in JSON format.
since: 5.0.4
return: string
end note
note left of Registry::loadString
Loads data into the registry from a string using Joomla's format classes.
since: 5.0.4
return: self
arguments:
string $data
string $format = 'JSON'
array $options = []
end note
note right of Registry::loadObject
Loads data into the registry from an object.
since: 5.0.4
return: self
end note
note left of Registry::loadArray
Loads data into the registry from an array.
The loaded data will be merged into the registry's existing data.
since: 5.0.4
return: self
end note
note right of Registry::loadFile
Loads data into the registry from a file.
since: 5.0.4
return: self
end note
note left of Registry::set
Sets a value into the registry using multiple keys.
since: 3.2.0
@ -45,7 +170,7 @@ Override in child class allowed set class property $addAsArray = true.
?bool $asArray = null
end note
note right of Registry::get
note left of Registry::get
Retrieves a value (or sub-array) from the registry using multiple keys.
since: 3.2.0
@ -59,13 +184,148 @@ note right of Registry::remove
return: self
end note
note right of Registry::exists
note left of Registry::exists
Checks the existence of a particular location in the registry using multiple keys.
since: 3.2.0
return: bool
end note
note right of Registry::jsonSerialize
Specify data which should be serialized to JSON.
which is a value of any type other than a resource.
since: 5.0.4
return: mixed
end note
note left of Registry::count
Count elements of the registry.
since: 5.0.4
return: int
end note
note right of Registry::offsetExists
Whether a given offset exists in the registry.
since: 5.0.4
return: bool
end note
note left of Registry::offsetGet
Retrieve the value at a given offset.
since: 5.0.4
return: mixed
end note
note right of Registry::offsetSet
Set the value at a given offset.
since: 5.0.4
return: void
end note
note left of Registry::offsetUnset
Unset the value at a given offset.
since: 5.0.4
return: void
end note
note right of Registry::getIterator
Retrieve an external iterator for the registry.
since: 5.0.4
return: \Traversable
end note
note left of Registry::toArray
Get the registry data as an associative array.
since: 5.0.4
return: array
end note
note right of Registry::toObject
Get the registry data as an object.
since: 5.0.4
return: object
end note
note left of Registry::toString
Converts the registry data to a string in the specified format.
since: 5.0.4
return: string
end note
note right of Registry::flatten
Flattens the registry data into a one-dimensional array.
since: 5.0.4
return: array
end note
note left of Registry::def
Sets a default value if not already set.
since: 5.0.4
return: mixed
end note
note right of Registry::merge
Merges another registry into this one.
The data from the source registry will be merged into this registry,
overwriting any existing values with the same keys.
since: 5.0.4
return: self
end note
note left of Registry::clear
Clears all data from the registry.
since: 5.0.4
return: self
end note
note right of Registry::extract
Extracts a subset of the registry data based on a given path.
since: 5.0.4
return: self
arguments:
string $path
mixed $default = null
?string $separator = null
end note
note left of Registry::append
Appends content into the registry.
If a key exists, the value will be appended to the existing value.
since: 5.0.4
return: self
end note
note right of Registry::getName
Gets the name of the registry.
since: 5.0.4
return: ?string
end note
note left of Registry::setName
Sets the name of the registry.
since: 5.0.4
return: self
end note
note right of Registry::setSeparator
Sets a separator value
@ -73,6 +333,54 @@ note right of Registry::setSeparator
return: self
end note
note left of Registry::getSeparator
Gets the current path separator used in registry paths.
since: 5.0.4
return: ?string
end note
note right of Registry::arrayToObject
Recursively converts an array to an object.
This method is used to convert the internal array data into an object
structure suitable for serialization or other operations that require objects.
since: 5.0.4
return: mixed
end note
note left of Registry::objectToArray
Recursively converts an object to an array.
This method is used to convert data loaded from formats that produce objects
(e.g., JSON, XML) into an array structure for internal storage.
since: 5.0.4
return: mixed
end note
note right of Registry::arrayMergeRecursive
Recursively merges two arrays.
This method merges the elements of two arrays together so that the values of one
are appended to the end of the previous one. It preserves numeric keys.
since: 5.0.4
return: array
end note
note left of Registry::flattenArray
Helper function to recursively flatten the array.
since: 5.0.4
return: array
arguments:
array $array
string $separator
bool $full
array $flattened = []
string $path = ''
end note
note right of Registry::getActiveKeys
Get that the active keys from a path

View File

@ -12,6 +12,7 @@
namespace VDM\Joomla\Abstraction;
use Joomla\Registry\Factory as FormatFactory;
use VDM\Joomla\Interfaces\Registryinterface;
use VDM\Joomla\Abstraction\ActiveRegistry;
@ -21,18 +22,238 @@ use VDM\Joomla\Abstraction\ActiveRegistry;
*
* Don't use this beyond 10 dimensional depth for best performance.
*
* @since 3.2.0
* @since 3.2.0
* @since 5.0.4 Joomla Registry Compatible
*/
abstract class Registry extends ActiveRegistry implements Registryinterface
abstract class Registry extends ActiveRegistry implements Registryinterface, \JsonSerializable, \ArrayAccess, \IteratorAggregate, \Countable
{
/**
* Path separator
*
* @var string|null
* @since 3.2.0
* @since 3.2.0
*/
protected ?string $separator = '.';
/**
* The name of the registry.
*
* @var string|null
* @since 5.0.4
*/
protected ?string $name = null;
/**
* Constructor.
*
* Initializes the Registry object with optional data.
*
* @param mixed $data Optional data to load into the registry.
* Can be an array, string, or object.
* @param string|null $separator The path separator, and empty string will flatten the registry.
* @since 5.0.4
*/
public function __construct($data = null, ?string $separator = null)
{
// we don't allow null on initialization (default is a dot)
// so that all class inheritance can override the separator property
// use an empty string if you want to flatten the registry
if ($separator !== null)
{
$this->setSeparator($separator);
}
if ($data !== null)
{
if (is_array($data))
{
$this->loadArray($data);
}
elseif (is_string($data))
{
$this->loadString($data);
}
elseif (is_object($data))
{
$this->loadObject($data);
}
}
}
/**
* Magic method to get a value from the registry.
*
* Allows for accessing registry data using object property syntax.
*
* @param string $name The name of the property to get.
*
* @return mixed The value of the property, or null if not found.
* @since 5.0.4
*/
public function __get($name)
{
return $this->get($name);
}
/**
* Magic method to set a value in the registry.
*
* Allows for setting registry data using object property syntax.
*
* @param string $name The name of the property to set.
* @param mixed $value The value to set.
*
* @return void
* @since 5.0.4
*/
public function __set($name, $value)
{
$this->set($name, $value);
}
/**
* Magic method to check if a property is set in the registry.
*
* Allows for using isset() on registry properties.
*
* @param string $name The name of the property to check.
*
* @return bool True if the property is set, false otherwise.
* @since 5.0.4
*/
public function __isset($name)
{
return $this->exists($name);
}
/**
* Magic method to unset a property in the registry.
*
* Allows for using unset() on registry properties.
*
* @param string $name The name of the property to unset.
*
* @return void
* @since 5.0.4
*/
public function __unset($name)
{
$this->remove($name);
}
/**
* Magic method to clone the registry.
*
* Performs a deep copy of the registry data.
*
* @return void
* @since 5.0.4
*/
public function __clone()
{
$this->active = unserialize(serialize($this->active));
}
/**
* Magic method to convert the registry to a string.
*
* Returns the registry data in JSON format.
*
* @return string The registry data in JSON format.
* @since 5.0.4
*/
public function __toString()
{
return $this->toString();
}
/**
* Loads data into the registry from a string using Joomla's format classes.
*
* @param string $data The data string to load.
* @param string $format The format of the data string. Supported formats: 'json', 'ini', 'xml', 'php'.
* @param array $options Options used by the formatter
*
* @return self
* @throws \InvalidArgumentException If the format is not supported.
* @since 5.0.4
*/
public function loadString(string $data, string $format = 'JSON', array $options = []): self
{
// Load a string into the given namespace [or default namespace if not given]
$object = FormatFactory::getFormat($format, $options)->stringToObject($data, $options);
// Merge the object into the registry
$this->loadObject($object);
return $this;
}
/**
* Loads data into the registry from an object.
*
* @param object $object The data object to load.
*
* @return self
* @since 5.0.4
*/
public function loadObject(object $object): self
{
// Convert the object to an array
$array = $this->objectToArray($object);
// Merge the array into the registry
$this->loadArray($array);
return $this;
}
/**
* Loads data into the registry from an array.
*
* The loaded data will be merged into the registry's existing data.
*
* @param array $array The array of data to load into the registry.
*
* @return self
* @since 5.0.4
*/
public function loadArray(array $array): self
{
$this->active = $this->arrayMergeRecursive($this->active, $array);
return $this;
}
/**
* Loads data into the registry from a file.
*
* @param string $path The path to the file to load.
* @param string $format The format of the file. Supported formats: 'json', 'ini', 'xml', 'php'.
*
* @return self
* @throws \InvalidArgumentException If the file does not exist or is not readable.
* @throws \RuntimeException If the file cannot be read.
* @since 5.0.4
*/
public function loadFile(string $path, string $format = 'json'): self
{
if (!file_exists($path) || !is_readable($path))
{
throw new \InvalidArgumentException("File does not exist or is not readable: {$path}");
}
$data = file_get_contents($path);
if ($data === false)
{
throw new \RuntimeException("Failed to read file: {$path}");
}
$this->loadString($data, $format);
return $this;
}
/**
* Sets a value into the registry using multiple keys.
*
@ -41,7 +262,7 @@ abstract class Registry extends ActiveRegistry implements Registryinterface
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return self
* @since 3.2.0
* @since 3.2.0
*/
public function set(string $path, $value): self
{
@ -67,7 +288,7 @@ abstract class Registry extends ActiveRegistry implements Registryinterface
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return self
* @since 3.2.0
* @since 3.2.0
*/
public function add(string $path, $value, ?bool $asArray = null): self
{
@ -89,9 +310,9 @@ abstract class Registry extends ActiveRegistry implements Registryinterface
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return mixed The value or sub-array from the storage. Null if the location doesn't exist.
* @since 3.2.0
* @since 3.2.0
*/
public function get(string $path, $default = null)
public function get(string $path, $default = null): mixed
{
if (($keys = $this->getActiveKeys($path)) === null)
{
@ -108,7 +329,7 @@ abstract class Registry extends ActiveRegistry implements Registryinterface
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return self
* @since 3.2.0
* @since 3.2.0
*/
public function remove(string $path): self
{
@ -129,7 +350,7 @@ abstract class Registry extends ActiveRegistry implements Registryinterface
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return bool True if the location exists, false otherwise.
* @since 3.2.0
* @since 3.2.0
*/
public function exists(string $path): bool
{
@ -141,13 +362,308 @@ abstract class Registry extends ActiveRegistry implements Registryinterface
return $this->existsActive(...$keys);
}
/**
* Specify data which should be serialized to JSON.
*
* @return mixed Data which can be serialized by json_encode(),
* which is a value of any type other than a resource.
* @since 5.0.4
*/
public function jsonSerialize(): mixed
{
return $this->active;
}
/**
* Count elements of the registry.
*
* @return int The number of elements in the registry.
* @since 5.0.4
*/
public function count(): int
{
return count($this->active);
}
/**
* Whether a given offset exists in the registry.
*
* @param mixed $offset An offset to check for.
*
* @return bool True if the offset exists, false otherwise.
* @since 5.0.4
*/
public function offsetExists(mixed $offset): bool
{
if (!is_string($offset))
{
return false;
}
return $this->exists($offset);
}
/**
* Retrieve the value at a given offset.
*
* @param mixed $offset The offset to retrieve.
*
* @return mixed The value at the specified offset.
* @since 5.0.4
*/
public function offsetGet(mixed $offset): mixed
{
if (!is_string($offset))
{
return null;
}
return $this->get($offset);
}
/**
* Set the value at a given offset.
*
* @param mixed $offset The offset to assign the value to.
* @param mixed $value The value to set.
*
* @return void
* @since 5.0.4
*/
public function offsetSet(mixed $offset, mixed $value): void
{
if (!is_string($offset))
{
return;
}
$this->set($offset, $value);
}
/**
* Unset the value at a given offset.
*
* @param mixed $offset The offset to unset.
*
* @return void
* @since 5.0.4
*/
public function offsetUnset(mixed $offset): void
{
if (!is_string($offset))
{
return;
}
$this->remove($offset);
}
/**
* Retrieve an external iterator for the registry.
*
* @return \Traversable An instance of an object implementing Iterator or Traversable.
* @since 5.0.4
*/
public function getIterator(): \Traversable
{
return new \ArrayIterator($this->active);
}
/**
* Get the registry data as an associative array.
*
* @return array The registry data.
* @since 5.0.4
*/
public function toArray(): array
{
return $this->active;
}
/**
* Get the registry data as an object.
*
* @return object The registry data converted to an object.
* @since 5.0.4
*/
public function toObject()
{
return $this->arrayToObject($this->active);
}
/**
* Converts the registry data to a string in the specified format.
*
* @param string $format The format to output the string in. Supported formats: 'json', 'ini', 'xml', 'php'.
* @param array $options Options used by the formatter.
*
* @return string The registry data in the specified format.
*
* @throws \InvalidArgumentException If the format is not supported.
* @since 5.0.4
*/
public function toString(string $format = 'JSON', array $options = []): string
{
// Convert the internal array to an object
$object = $this->arrayToObject($this->active);
return FormatFactory::getFormat($format, $options)->objectToString($object, $options);
}
/**
* Flattens the registry data into a one-dimensional array.
*
* @param string|null $separator The separator for the key names.
* @param bool $full True to include the full path as keys.
*
* @return array The flattened data array.
* @since 5.0.4
*/
public function flatten(?string $separator = null, bool $full = false): array
{
// we use default separator
if ($separator === null)
{
$separator = $this->separator;
}
return $this->flattenArray($this->active, $separator, $full);
}
/**
* Sets a default value if not already set.
*
* @param string $path The registry path (e.g., 'vdm.content.builder').
* @param mixed $default The default value to set if the path does not exist.
*
* @return mixed The value of the path after the method call.
* @since 5.0.4
*/
public function def(string $path, $default)
{
if (!$this->exists($path))
{
$this->set($path, $default);
return $default;
}
return $this->get($path);
}
/**
* Merges another registry into this one.
*
* The data from the source registry will be merged into this registry,
* overwriting any existing values with the same keys.
*
* @param Registryinterface $source The registry to merge with this one.
*
* @return self
* @since 5.0.4
*/
public function merge(Registryinterface $source): self
{
$this->active = $this->arrayMergeRecursive($this->active, $source->toArray());
return $this;
}
/**
* Clears all data from the registry.
*
* @return self
* @since 5.0.4
*/
public function clear(): self
{
$this->active = [];
return $this;
}
/**
* Extracts a subset of the registry data based on a given path.
*
* @param string $path The registry path to extract.
* @param mixed $default Optional default value, returned if the path does not exist.
* @param string|null $separator The path separator.
*
* @return self A new Registry instance with the extracted data.
* @since 5.0.4
*/
public function extract(string $path, $default = null, ?string $separator = null): self
{
$originalSeparator = $this->getSeparator();
if ($separator !== null)
{
$this->setSeparator($separator);
}
$data = $this->get($path, $default);
if ($separator !== null)
{
$this->setSeparator($originalSeparator);
}
$newRegistry = new static();
if ($data !== $default)
{
if (is_array($data))
{
$newRegistry->loadArray($data);
}
else
{
$newRegistry->set('value', $data);
}
}
return $newRegistry;
}
/**
* Appends content into the registry.
*
* If a key exists, the value will be appended to the existing value.
*
* @param string $path The registry path (e.g., 'vdm.content.builder').
* @param mixed $value The value to append.
*
* @return self
* @since 5.0.4
*/
public function append(string $path, $value): self
{
return $this->add($path, $value, false);
}
/**
* Gets the name of the registry.
*
* @return string|null The name of the registry.
* @since 5.0.4
*/
public function getName(): ?string
{
return $this->name;
}
/**
* Sets the name of the registry.
*
* @param string|null $name The name to set.
*
* @return self
* @since 5.0.4
*/
public function setName(?string $name): self
{
$this->name = $name;
return $this;
}
/**
* Sets a separator value
*
* @param string|null $value The value to set.
*
* @return self
* @since 3.2.0
* @since 3.2.0
*/
public function setSeparator(?string $value): self
{
@ -156,13 +672,140 @@ abstract class Registry extends ActiveRegistry implements Registryinterface
return $this;
}
/**
* Gets the current path separator used in registry paths.
*
* @return string|null The path separator.
* @since 5.0.4
*/
public function getSeparator(): ?string
{
return $this->separator;
}
/**
* Recursively converts an array to an object.
*
* This method is used to convert the internal array data into an object
* structure suitable for serialization or other operations that require objects.
*
* @param mixed $data The data to convert.
*
* @return mixed The converted object, or the original data if not an array.
* @since 5.0.4
*/
protected function arrayToObject($data)
{
if (is_array($data))
{
$object = new \stdClass();
foreach ($data as $key => $value)
{
// Handle numeric keys for object properties
if (is_numeric($key))
{
$key = 'item' . $key;
}
$object->{$key} = $this->arrayToObject($value);
}
return $object;
}
else
{
return $data;
}
}
/**
* Recursively converts an object to an array.
*
* This method is used to convert data loaded from formats that produce objects
* (e.g., JSON, XML) into an array structure for internal storage.
*
* @param mixed $data The data to convert.
*
* @return mixed The converted array, or the original data if not an object.
* @since 5.0.4
*/
protected function objectToArray($data)
{
return json_decode(json_encode($data), true);
}
/**
* Recursively merges two arrays.
*
* This method merges the elements of two arrays together so that the values of one
* are appended to the end of the previous one. It preserves numeric keys.
*
* @param array $array1 The array to merge into.
* @param array $array2 The array to merge from.
*
* @return array The merged array.
* @since 5.0.4
*/
protected function arrayMergeRecursive(array $array1, array $array2): array
{
foreach ($array2 as $key => $value)
{
// If the value is an array and the key exists in both arrays, merge recursively
if (is_array($value) && isset($array1[$key]) && is_array($array1[$key]))
{
$array1[$key] = $this->arrayMergeRecursive($array1[$key], $value);
}
else
{
// Otherwise, replace or set the value
$array1[$key] = $value;
}
}
return $array1;
}
/**
* Helper function to recursively flatten the array.
*
* @param array $array The array to flatten.
* @param string $separator The separator for the key names.
* @param bool $full True to include the full path as keys.
* @param array $flattened The flattened array (used internally for recursion).
* @param string $path The current path (used internally for recursion).
*
* @return array The flattened array.
* @since 5.0.4
*/
protected function flattenArray(array $array, string $separator, bool $full, array $flattened = [], string $path = ''): array
{
foreach ($array as $key => $value)
{
if ($full)
{
$newPath = $path === '' ? $key : $path . $separator . $key;
}
else
{
$newPath = $key;
}
if (is_array($value))
{
$flattened = $this->flattenArray($value, $separator, $full, $flattened, $newPath);
}
else
{
$flattened[$newPath] = $value;
}
}
return $flattened;
}
/**
* Get that the active keys from a path
*
* @param string $path The path to determine the location registry.
*
* @return array|null The valid array of keys
* @since 3.2.0
* @since 3.2.0
*/
protected function getActiveKeys(string $path): ?array
{

View File

@ -2,10 +2,229 @@
* Path separator
*
* @var string|null
* @since 3.2.0
* @since 3.2.0
*/
protected ?string $separator = '.';
/**
* The name of the registry.
*
* @var string|null
* @since 5.0.4
*/
protected ?string $name = null;
/**
* Constructor.
*
* Initializes the Registry object with optional data.
*
* @param mixed $data Optional data to load into the registry.
* Can be an array, string, or object.
* @param string|null $separator The path separator, and empty string will flatten the registry.
* @since 5.0.4
*/
public function __construct($data = null, ?string $separator = null)
{
// we don't allow null on initialization (default is a dot)
// so that all class inheritance can override the separator property
// use an empty string if you want to flatten the registry
if ($separator !== null)
{
$this->setSeparator($separator);
}
if ($data !== null)
{
if (is_array($data))
{
$this->loadArray($data);
}
elseif (is_string($data))
{
$this->loadString($data);
}
elseif (is_object($data))
{
$this->loadObject($data);
}
}
}
/**
* Magic method to get a value from the registry.
*
* Allows for accessing registry data using object property syntax.
*
* @param string $name The name of the property to get.
*
* @return mixed The value of the property, or null if not found.
* @since 5.0.4
*/
public function __get($name)
{
return $this->get($name);
}
/**
* Magic method to set a value in the registry.
*
* Allows for setting registry data using object property syntax.
*
* @param string $name The name of the property to set.
* @param mixed $value The value to set.
*
* @return void
* @since 5.0.4
*/
public function __set($name, $value)
{
$this->set($name, $value);
}
/**
* Magic method to check if a property is set in the registry.
*
* Allows for using isset() on registry properties.
*
* @param string $name The name of the property to check.
*
* @return bool True if the property is set, false otherwise.
* @since 5.0.4
*/
public function __isset($name)
{
return $this->exists($name);
}
/**
* Magic method to unset a property in the registry.
*
* Allows for using unset() on registry properties.
*
* @param string $name The name of the property to unset.
*
* @return void
* @since 5.0.4
*/
public function __unset($name)
{
$this->remove($name);
}
/**
* Magic method to clone the registry.
*
* Performs a deep copy of the registry data.
*
* @return void
* @since 5.0.4
*/
public function __clone()
{
$this->active = unserialize(serialize($this->active));
}
/**
* Magic method to convert the registry to a string.
*
* Returns the registry data in JSON format.
*
* @return string The registry data in JSON format.
* @since 5.0.4
*/
public function __toString()
{
return $this->toString();
}
/**
* Loads data into the registry from a string using Joomla's format classes.
*
* @param string $data The data string to load.
* @param string $format The format of the data string. Supported formats: 'json', 'ini', 'xml', 'php'.
* @param array $options Options used by the formatter
*
* @return self
* @throws \InvalidArgumentException If the format is not supported.
* @since 5.0.4
*/
public function loadString(string $data, string $format = 'JSON', array $options = []): self
{
// Load a string into the given namespace [or default namespace if not given]
$object = FormatFactory::getFormat($format, $options)->stringToObject($data, $options);
// Merge the object into the registry
$this->loadObject($object);
return $this;
}
/**
* Loads data into the registry from an object.
*
* @param object $object The data object to load.
*
* @return self
* @since 5.0.4
*/
public function loadObject(object $object): self
{
// Convert the object to an array
$array = $this->objectToArray($object);
// Merge the array into the registry
$this->loadArray($array);
return $this;
}
/**
* Loads data into the registry from an array.
*
* The loaded data will be merged into the registry's existing data.
*
* @param array $array The array of data to load into the registry.
*
* @return self
* @since 5.0.4
*/
public function loadArray(array $array): self
{
$this->active = $this->arrayMergeRecursive($this->active, $array);
return $this;
}
/**
* Loads data into the registry from a file.
*
* @param string $path The path to the file to load.
* @param string $format The format of the file. Supported formats: 'json', 'ini', 'xml', 'php'.
*
* @return self
* @throws \InvalidArgumentException If the file does not exist or is not readable.
* @throws \RuntimeException If the file cannot be read.
* @since 5.0.4
*/
public function loadFile(string $path, string $format = 'json'): self
{
if (!file_exists($path) || !is_readable($path))
{
throw new \InvalidArgumentException("File does not exist or is not readable: {$path}");
}
$data = file_get_contents($path);
if ($data === false)
{
throw new \RuntimeException("Failed to read file: {$path}");
}
$this->loadString($data, $format);
return $this;
}
/**
* Sets a value into the registry using multiple keys.
*
@ -14,7 +233,7 @@
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return self
* @since 3.2.0
* @since 3.2.0
*/
public function set(string $path, $value): self
{
@ -40,7 +259,7 @@
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return self
* @since 3.2.0
* @since 3.2.0
*/
public function add(string $path, $value, ?bool $asArray = null): self
{
@ -62,9 +281,9 @@
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return mixed The value or sub-array from the storage. Null if the location doesn't exist.
* @since 3.2.0
* @since 3.2.0
*/
public function get(string $path, $default = null)
public function get(string $path, $default = null): mixed
{
if (($keys = $this->getActiveKeys($path)) === null)
{
@ -81,7 +300,7 @@
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return self
* @since 3.2.0
* @since 3.2.0
*/
public function remove(string $path): self
{
@ -102,7 +321,7 @@
*
* @throws \InvalidArgumentException If any of the path values are not a number or string.
* @return bool True if the location exists, false otherwise.
* @since 3.2.0
* @since 3.2.0
*/
public function exists(string $path): bool
{
@ -114,13 +333,308 @@
return $this->existsActive(...$keys);
}
/**
* Specify data which should be serialized to JSON.
*
* @return mixed Data which can be serialized by json_encode(),
* which is a value of any type other than a resource.
* @since 5.0.4
*/
public function jsonSerialize(): mixed
{
return $this->active;
}
/**
* Count elements of the registry.
*
* @return int The number of elements in the registry.
* @since 5.0.4
*/
public function count(): int
{
return count($this->active);
}
/**
* Whether a given offset exists in the registry.
*
* @param mixed $offset An offset to check for.
*
* @return bool True if the offset exists, false otherwise.
* @since 5.0.4
*/
public function offsetExists(mixed $offset): bool
{
if (!is_string($offset))
{
return false;
}
return $this->exists($offset);
}
/**
* Retrieve the value at a given offset.
*
* @param mixed $offset The offset to retrieve.
*
* @return mixed The value at the specified offset.
* @since 5.0.4
*/
public function offsetGet(mixed $offset): mixed
{
if (!is_string($offset))
{
return null;
}
return $this->get($offset);
}
/**
* Set the value at a given offset.
*
* @param mixed $offset The offset to assign the value to.
* @param mixed $value The value to set.
*
* @return void
* @since 5.0.4
*/
public function offsetSet(mixed $offset, mixed $value): void
{
if (!is_string($offset))
{
return;
}
$this->set($offset, $value);
}
/**
* Unset the value at a given offset.
*
* @param mixed $offset The offset to unset.
*
* @return void
* @since 5.0.4
*/
public function offsetUnset(mixed $offset): void
{
if (!is_string($offset))
{
return;
}
$this->remove($offset);
}
/**
* Retrieve an external iterator for the registry.
*
* @return \Traversable An instance of an object implementing Iterator or Traversable.
* @since 5.0.4
*/
public function getIterator(): \Traversable
{
return new \ArrayIterator($this->active);
}
/**
* Get the registry data as an associative array.
*
* @return array The registry data.
* @since 5.0.4
*/
public function toArray(): array
{
return $this->active;
}
/**
* Get the registry data as an object.
*
* @return object The registry data converted to an object.
* @since 5.0.4
*/
public function toObject()
{
return $this->arrayToObject($this->active);
}
/**
* Converts the registry data to a string in the specified format.
*
* @param string $format The format to output the string in. Supported formats: 'json', 'ini', 'xml', 'php'.
* @param array $options Options used by the formatter.
*
* @return string The registry data in the specified format.
*
* @throws \InvalidArgumentException If the format is not supported.
* @since 5.0.4
*/
public function toString(string $format = 'JSON', array $options = []): string
{
// Convert the internal array to an object
$object = $this->arrayToObject($this->active);
return FormatFactory::getFormat($format, $options)->objectToString($object, $options);
}
/**
* Flattens the registry data into a one-dimensional array.
*
* @param string|null $separator The separator for the key names.
* @param bool $full True to include the full path as keys.
*
* @return array The flattened data array.
* @since 5.0.4
*/
public function flatten(?string $separator = null, bool $full = false): array
{
// we use default separator
if ($separator === null)
{
$separator = $this->separator;
}
return $this->flattenArray($this->active, $separator, $full);
}
/**
* Sets a default value if not already set.
*
* @param string $path The registry path (e.g., 'vdm.content.builder').
* @param mixed $default The default value to set if the path does not exist.
*
* @return mixed The value of the path after the method call.
* @since 5.0.4
*/
public function def(string $path, $default)
{
if (!$this->exists($path))
{
$this->set($path, $default);
return $default;
}
return $this->get($path);
}
/**
* Merges another registry into this one.
*
* The data from the source registry will be merged into this registry,
* overwriting any existing values with the same keys.
*
* @param Registryinterface $source The registry to merge with this one.
*
* @return self
* @since 5.0.4
*/
public function merge(Registryinterface $source): self
{
$this->active = $this->arrayMergeRecursive($this->active, $source->toArray());
return $this;
}
/**
* Clears all data from the registry.
*
* @return self
* @since 5.0.4
*/
public function clear(): self
{
$this->active = [];
return $this;
}
/**
* Extracts a subset of the registry data based on a given path.
*
* @param string $path The registry path to extract.
* @param mixed $default Optional default value, returned if the path does not exist.
* @param string|null $separator The path separator.
*
* @return self A new Registry instance with the extracted data.
* @since 5.0.4
*/
public function extract(string $path, $default = null, ?string $separator = null): self
{
$originalSeparator = $this->getSeparator();
if ($separator !== null)
{
$this->setSeparator($separator);
}
$data = $this->get($path, $default);
if ($separator !== null)
{
$this->setSeparator($originalSeparator);
}
$newRegistry = new static();
if ($data !== $default)
{
if (is_array($data))
{
$newRegistry->loadArray($data);
}
else
{
$newRegistry->set('value', $data);
}
}
return $newRegistry;
}
/**
* Appends content into the registry.
*
* If a key exists, the value will be appended to the existing value.
*
* @param string $path The registry path (e.g., 'vdm.content.builder').
* @param mixed $value The value to append.
*
* @return self
* @since 5.0.4
*/
public function append(string $path, $value): self
{
return $this->add($path, $value, false);
}
/**
* Gets the name of the registry.
*
* @return string|null The name of the registry.
* @since 5.0.4
*/
public function getName(): ?string
{
return $this->name;
}
/**
* Sets the name of the registry.
*
* @param string|null $name The name to set.
*
* @return self
* @since 5.0.4
*/
public function setName(?string $name): self
{
$this->name = $name;
return $this;
}
/**
* Sets a separator value
*
* @param string|null $value The value to set.
*
* @return self
* @since 3.2.0
* @since 3.2.0
*/
public function setSeparator(?string $value): self
{
@ -129,13 +643,140 @@
return $this;
}
/**
* Gets the current path separator used in registry paths.
*
* @return string|null The path separator.
* @since 5.0.4
*/
public function getSeparator(): ?string
{
return $this->separator;
}
/**
* Recursively converts an array to an object.
*
* This method is used to convert the internal array data into an object
* structure suitable for serialization or other operations that require objects.
*
* @param mixed $data The data to convert.
*
* @return mixed The converted object, or the original data if not an array.
* @since 5.0.4
*/
protected function arrayToObject($data)
{
if (is_array($data))
{
$object = new \stdClass();
foreach ($data as $key => $value)
{
// Handle numeric keys for object properties
if (is_numeric($key))
{
$key = 'item' . $key;
}
$object->{$key} = $this->arrayToObject($value);
}
return $object;
}
else
{
return $data;
}
}
/**
* Recursively converts an object to an array.
*
* This method is used to convert data loaded from formats that produce objects
* (e.g., JSON, XML) into an array structure for internal storage.
*
* @param mixed $data The data to convert.
*
* @return mixed The converted array, or the original data if not an object.
* @since 5.0.4
*/
protected function objectToArray($data)
{
return json_decode(json_encode($data), true);
}
/**
* Recursively merges two arrays.
*
* This method merges the elements of two arrays together so that the values of one
* are appended to the end of the previous one. It preserves numeric keys.
*
* @param array $array1 The array to merge into.
* @param array $array2 The array to merge from.
*
* @return array The merged array.
* @since 5.0.4
*/
protected function arrayMergeRecursive(array $array1, array $array2): array
{
foreach ($array2 as $key => $value)
{
// If the value is an array and the key exists in both arrays, merge recursively
if (is_array($value) && isset($array1[$key]) && is_array($array1[$key]))
{
$array1[$key] = $this->arrayMergeRecursive($array1[$key], $value);
}
else
{
// Otherwise, replace or set the value
$array1[$key] = $value;
}
}
return $array1;
}
/**
* Helper function to recursively flatten the array.
*
* @param array $array The array to flatten.
* @param string $separator The separator for the key names.
* @param bool $full True to include the full path as keys.
* @param array $flattened The flattened array (used internally for recursion).
* @param string $path The current path (used internally for recursion).
*
* @return array The flattened array.
* @since 5.0.4
*/
protected function flattenArray(array $array, string $separator, bool $full, array $flattened = [], string $path = ''): array
{
foreach ($array as $key => $value)
{
if ($full)
{
$newPath = $path === '' ? $key : $path . $separator . $key;
}
else
{
$newPath = $key;
}
if (is_array($value))
{
$flattened = $this->flattenArray($value, $separator, $full, $flattened, $newPath);
}
else
{
$flattened[$newPath] = $value;
}
}
return $flattened;
}
/**
* Get that the active keys from a path
*
* @param string $path The path to determine the location registry.
*
* @return array|null The valid array of keys
* @since 3.2.0
* @since 3.2.0
*/
protected function getActiveKeys(string $path): ?array
{

View File

@ -1,10 +1,11 @@
{
"add_head": "0",
"add_head": "1",
"add_licensing_template": "2",
"extends": "43134867-5cb8-4280-9be8-309fd2fd135f",
"guid": "7e822c03-1b20-41d1-9427-f5b8d5836af7",
"implements": [
"64e291c2-11f1-423d-a44d-837cc12cc017"
"64e291c2-11f1-423d-a44d-837cc12cc017",
"-1"
],
"load_selection": null,
"name": "Registry",
@ -14,8 +15,9 @@
"use_selection": null,
"extendsinterfaces": null,
"namespace": "[[[NamespacePrefix]]]\\Joomla\\Abstraction.Registry",
"description": "VDM Basic Registry.\r\n\r\nDon't use this beyond 10 dimensional depth for best performance.\r\n\r\n@since 3.2.0",
"description": "VDM Basic Registry.\r\n\r\nDon't use this beyond 10 dimensional depth for best performance.\r\n\r\n@since 3.2.0\r\n@since 5.0.4 Joomla Registry Compatible",
"implements_custom": " \\JsonSerializable, \\ArrayAccess, \\IteratorAggregate, \\Countable",
"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": "use Joomla\\Registry\\Factory as FormatFactory;",
"composer": ""
}

View File

@ -0,0 +1,79 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# abstract class Import (Details)
> namespace: **VDM\Joomla\Abstraction\Console**
> extends: **AbstractCommand**
```uml
@startuml
abstract Import #Orange {
# Items $items
# ImportEngine $import
# string $queueTable
# string $queueStatusField
# int $queueWaitState
# int $queueProcessingState
# string $targetName
# string $targetImportClass
# static $defaultName
+ __construct(?string $name = null)
# configure() : void
# doExecute(InputInterface $input, OutputInterface $output) : int
}
note right of Import::__construct
Constructor.
since: 5.0.2
end note
note right of Import::configure
Configures the CLI command, setting up the description and help text.
This command parses the import queue and imports items that are still in the queue.
It is useful for automatically processing pending item imports in the virtual warehouse.
since: 5.0.2
return: void
end note
note right of Import::doExecute
Executes the CLI command, processing each spreadsheet in the import queue.
since: 5.0.2
return: int
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---85321deb_5c3a_401b_9ce1_039a746add51---Power
```
> remember to replace the `---` with `___` to activate this Power in your code
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -0,0 +1,258 @@
<?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\Abstraction\Console;
use Joomla\CMS\Factory;
use Joomla\Console\Command\AbstractCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use VDM\Joomla\Componentbuilder\Import\Factory as ImportFactory;
use VDM\Joomla\Componentbuilder\Interfaces\Spreadsheet\ImportCliInterface as ImportEngine;
use VDM\Joomla\Data\Items;
use VDM\Joomla\Utilities\Component\Helper;
/**
* Console Import
*
* @since 5.0.2
*/
abstract class Import extends AbstractCommand
{
/**
* The Items Class.
*
* @var Items
* @since 5.0.2
*/
protected Items $items;
/**
* The Import Class.
*
* @var ImportEngine
* @since 5.0.2
*/
protected ImportEngine $import;
/**
* The queue table name.
*
* @var string
* @since 5.0.2
*/
protected string $queueTable;
/**
* The queue status field
*
* @var string
* @since 5.0.2
*/
protected string $queueStatusField;
/**
* The queue awaiting status
*
* @var int
* @since 5.0.2
*/
protected int $queueWaitState;
/**
* The queue processing status
*
* @var int
* @since 5.0.2
*/
protected int $queueProcessingState;
/**
* The main import target name.
*
* @var string
* @since 5.0.2
*/
protected string $targetName;
/**
* The target import class.
*
* @var string
* @since 5.0.2
*/
protected string $targetImportClass;
/**
* The default command name.
*
* @var string
* @since 5.0.2
*/
protected static $defaultName;
/**
* Constructor.
*
* @param string|null $name The name of the command; if the name is empty and no default is set, a name must be set in the configure() method
*
* @since 5.0.2
*/
public function __construct(?string $name = null)
{
// make sure we know what component we are working with
Helper::setOption('com_componentbuilder');
// Load administrator language file for backend
$lang = Factory::getLanguage();
$lang->load('com_componentbuilder', JPATH_ADMINISTRATOR);
$this->items = ImportFactory::_('Data.Items');
$this->import = ImportFactory::_($this->targetImportClass);
parent::__construct($name);
}
/**
* Configures the CLI command, setting up the description and help text.
*
* This command parses the import queue and imports items that are still in the queue.
* It is useful for automatically processing pending item imports in the virtual warehouse.
*
* @return void
* @since 5.0.2
*/
protected function configure(): void
{
$this->setDescription("Processes the import queue and {$this->targetName} imports all spreadsheets that are still in the queue.");
$this->setHelp(
<<<EOF
The <info>%command.name%</info> command parses the import queue and processes all {$this->targetName} spreadsheets that are still pending import.
This is useful for keeping the system up-to-date with incoming data.
Usage:
<info>php joomla.php %command.name%</info>
EOF);
}
/**
* Executes the CLI command, processing each spreadsheet in the import queue.
*
* @param InputInterface $input The input to inject into the command.
* @param OutputInterface $output The output to inject into the command.
*
* @return int The command exit code (0 for success).
* @since 5.0.2
*/
protected function doExecute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);
// Output the title for the task
$io->title("Component Builder: {$this->targetName} import status");
// Get all imports in the queue that are in waiting state
if (($queue = $this->items->table($this->queueTable)->get([$this->queueWaitState], $this->queueStatusField)) === null)
{
// Get the current date and time
$timestamp = date('Y-m-d H:i:s');
// Output the notice of no imports to be done
$io->info("No {$this->targetName} imports found in the queue. Idle at {$timestamp}.");
return 0;
}
// take spreadsheets out of queue
$this->items->table($this->queueTable)->set(array_map(function($item) {
return [
'guid' => $item->guid,
$this->queueStatusField => $this->queueProcessingState
];
}, $queue));
// size of the queue
$numberSteps = count((array) $queue);
// Output initial task information
$io->info("Initiating import for {$numberSteps} {$this->targetName} spreadsheet(s) in the queue.");
$io->newLine(2);
// Create a progress bar for the overall import process
$progressBar = $io->createProgressBar($numberSteps);
$progressBar->start();
// Track success and failure counts
$successCount = 0;
$failureCount = 0;
// Import one spreadsheet at a time
foreach ($queue as $spreadsheet)
{
$io->newLine(2);
// Output the current spreadsheet being processed
$io->section("Processing spreadsheet #{$spreadsheet->guid}...");
// Import the data found in the spreadsheet
$this->import->data($spreadsheet);
// Get the completion message
$completion = $this->import->message();
// Track success based on completion message
if ($completion->message_success)
{
$successCount++;
// Output the success message for this spreadsheet
$io->success($completion->message_success);
}
// Track failure based on completion message
if ($completion->message_error)
{
$failureCount++;
// Output the error message for this spreadsheet
$io->error($completion->message_error);
}
// Advance the main progress bar by one step
sleep(1);
$progressBar->advance();
$io->newLine(1);
}
// Finish the main progress bar
$progressBar->finish();
$io->newLine(2);
// Calculate the success and failure percentages
$totalProcessed = $successCount + $failureCount;
$successRate = ($totalProcessed > 0) ? round(($successCount / $totalProcessed) * 100) : 0;
$failureRate = ($totalProcessed > 0) ? round(($failureCount / $totalProcessed) * 100) : 0;
// Get the current date and time
$timestamp = date('Y-m-d H:i:s');
// Output the success and failure summary with the timestamp
$io->info("The {$this->targetName} import finished: {$successRate}% success, {$failureRate}% failure. Completed at {$timestamp}.");
$io->newLine(1);
return 0;
}
}

View File

@ -0,0 +1,224 @@
/**
* The Items Class.
*
* @var Items
* @since 5.0.2
*/
protected Items $items;
/**
* The Import Class.
*
* @var ImportEngine
* @since 5.0.2
*/
protected ImportEngine $import;
/**
* The queue table name.
*
* @var string
* @since 5.0.2
*/
protected string $queueTable;
/**
* The queue status field
*
* @var string
* @since 5.0.2
*/
protected string $queueStatusField;
/**
* The queue awaiting status
*
* @var int
* @since 5.0.2
*/
protected int $queueWaitState;
/**
* The queue processing status
*
* @var int
* @since 5.0.2
*/
protected int $queueProcessingState;
/**
* The main import target name.
*
* @var string
* @since 5.0.2
*/
protected string $targetName;
/**
* The target import class.
*
* @var string
* @since 5.0.2
*/
protected string $targetImportClass;
/**
* The default command name.
*
* @var string
* @since 5.0.2
*/
protected static $defaultName;
/**
* Constructor.
*
* @param string|null $name The name of the command; if the name is empty and no default is set, a name must be set in the configure() method
*
* @since 5.0.2
*/
public function __construct(?string $name = null)
{
// make sure we know what component we are working with
Helper::setOption('com_[[[component]]]');
// Load administrator language file for backend
$lang = Factory::getLanguage();
$lang->load('com_[[[component]]]', JPATH_ADMINISTRATOR);
$this->items = ImportFactory::_('Data.Items');
$this->import = ImportFactory::_($this->targetImportClass);
parent::__construct($name);
}
/**
* Configures the CLI command, setting up the description and help text.
*
* This command parses the import queue and imports items that are still in the queue.
* It is useful for automatically processing pending item imports in the virtual warehouse.
*
* @return void
* @since 5.0.2
*/
protected function configure(): void
{
$this->setDescription("Processes the import queue and {$this->targetName} imports all spreadsheets that are still in the queue.");
$this->setHelp(
<<<EOF
The <info>%command.name%</info> command parses the import queue and processes all {$this->targetName} spreadsheets that are still pending import.
This is useful for keeping the system up-to-date with incoming data.
Usage:
<info>php joomla.php %command.name%</info>
EOF);
}
/**
* Executes the CLI command, processing each spreadsheet in the import queue.
*
* @param InputInterface $input The input to inject into the command.
* @param OutputInterface $output The output to inject into the command.
*
* @return int The command exit code (0 for success).
* @since 5.0.2
*/
protected function doExecute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);
// Output the title for the task
$io->title("Component Builder: {$this->targetName} import status");
// Get all imports in the queue that are in waiting state
if (($queue = $this->items->table($this->queueTable)->get([$this->queueWaitState], $this->queueStatusField)) === null)
{
// Get the current date and time
$timestamp = date('Y-m-d H:i:s');
// Output the notice of no imports to be done
$io->info("No {$this->targetName} imports found in the queue. Idle at {$timestamp}.");
return 0;
}
// take spreadsheets out of queue
$this->items->table($this->queueTable)->set(array_map(function($item) {
return [
'guid' => $item->guid,
$this->queueStatusField => $this->queueProcessingState
];
}, $queue));
// size of the queue
$numberSteps = count((array) $queue);
// Output initial task information
$io->info("Initiating import for {$numberSteps} {$this->targetName} spreadsheet(s) in the queue.");
$io->newLine(2);
// Create a progress bar for the overall import process
$progressBar = $io->createProgressBar($numberSteps);
$progressBar->start();
// Track success and failure counts
$successCount = 0;
$failureCount = 0;
// Import one spreadsheet at a time
foreach ($queue as $spreadsheet)
{
$io->newLine(2);
// Output the current spreadsheet being processed
$io->section("Processing spreadsheet #{$spreadsheet->guid}...");
// Import the data found in the spreadsheet
$this->import->data($spreadsheet);
// Get the completion message
$completion = $this->import->message();
// Track success based on completion message
if ($completion->message_success)
{
$successCount++;
// Output the success message for this spreadsheet
$io->success($completion->message_success);
}
// Track failure based on completion message
if ($completion->message_error)
{
$failureCount++;
// Output the error message for this spreadsheet
$io->error($completion->message_error);
}
// Advance the main progress bar by one step
sleep(1);
$progressBar->advance();
$io->newLine(1);
}
// Finish the main progress bar
$progressBar->finish();
$io->newLine(2);
// Calculate the success and failure percentages
$totalProcessed = $successCount + $failureCount;
$successRate = ($totalProcessed > 0) ? round(($successCount / $totalProcessed) * 100) : 0;
$failureRate = ($totalProcessed > 0) ? round(($failureCount / $totalProcessed) * 100) : 0;
// Get the current date and time
$timestamp = date('Y-m-d H:i:s');
// Output the success and failure summary with the timestamp
$io->info("The {$this->targetName} import finished: {$successRate}% success, {$failureRate}% failure. Completed at {$timestamp}.");
$io->newLine(1);
return 0;
}

View File

@ -0,0 +1,37 @@
{
"add_head": "1",
"add_licensing_template": "2",
"extends": "-1",
"guid": "85321deb-5c3a-401b-9ce1-039a746add51",
"implements": null,
"load_selection": null,
"name": "Import",
"power_version": "1.0.0",
"system_name": "VDM.Abstraction.Console.Import",
"type": "abstract class",
"use_selection": {
"use_selection0": {
"use": "ff8d5fdb-2d1f-4178-bd18-a43b8efd1068",
"as": "ImportFactory"
},
"use_selection1": {
"use": "0f3f7188-3e0d-4d1a-8dee-7f8026cb65a9",
"as": "ImportEngine"
},
"use_selection2": {
"use": "21bca8a4-5b28-41c4-843e-8097f0ba7cca",
"as": "default"
},
"use_selection3": {
"use": "640b5352-fb09-425f-a26e-cd44eda03f15",
"as": "default"
}
},
"extendsinterfaces": null,
"namespace": "[[[NamespacePrefix]]]\\Joomla\\Abstraction.Console.Import",
"description": "Console Import\r\n\r\n@since 5.0.2",
"extends_custom": "AbstractCommand",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
"head": "use Joomla\\CMS\\Factory;\r\nuse Joomla\\Console\\Command\\AbstractCommand;\r\nuse Symfony\\Component\\Console\\Input\\InputInterface;\r\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\r\nuse Symfony\\Component\\Console\\Style\\SymfonyStyle;",
"composer": ""
}

View File

@ -29,6 +29,14 @@ use VDM\Joomla\Abstraction\Factory as ExtendingFactory;
*/
abstract class Factory extends ExtendingFactory implements FactoryInterface
{
/**
* Package Container
*
* @var Container|null
* @since 5.0.3
**/
protected static ?Container $container = null;
/**
* Create a container object
*

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