Compare commits

..

1 Commits

221 changed files with 1781 additions and 21869 deletions

View File

@ -47,8 +47,6 @@ This repository contains an index (see below) of all the approved powers within
- **final class Items** | [Details](src/21bca8a4-5b28-41c4-843e-8097f0ba7cca) | [Code](src/21bca8a4-5b28-41c4-843e-8097f0ba7cca/code.php) | [Settings](src/21bca8a4-5b28-41c4-843e-8097f0ba7cca/settings.json) | SPK: `Super---21bca8a4_5b28_41c4_843e_8097f0ba7cca---Power`
- **final class MultiSubform** | [Details](src/e0198c3f-777a-4a0b-87b7-e6a198afc8f9) | [Code](src/e0198c3f-777a-4a0b-87b7-e6a198afc8f9/code.php) | [Settings](src/e0198c3f-777a-4a0b-87b7-e6a198afc8f9/settings.json) | SPK: `Super---e0198c3f_777a_4a0b_87b7_e6a198afc8f9---Power`
- **final class Subform** | [Details](src/85785701-07b2-4f81-bc1e-0f423700c254) | [Code](src/85785701-07b2-4f81-bc1e-0f423700c254/code.php) | [Settings](src/85785701-07b2-4f81-bc1e-0f423700c254/settings.json) | SPK: `Super---85785701_07b2_4f81_bc1e_0f423700c254---Power`
- **final class UsersSubform** | [Details](src/46b98346-ec98-42b3-a393-96c7d1282b1c) | [Code](src/46b98346-ec98-42b3-a393-96c7d1282b1c/code.php) | [Settings](src/46b98346-ec98-42b3-a393-96c7d1282b1c/settings.json) | SPK: `Super---46b98346_ec98_42b3_a393_96c7d1282b1c---Power`
- **trait Guid** | [Details](src/5acded67-0e3d-4c6b-a6ea-b533b076de0c) | [Code](src/5acded67-0e3d-4c6b-a6ea-b533b076de0c/code.php) | [Settings](src/5acded67-0e3d-4c6b-a6ea-b533b076de0c/settings.json) | SPK: `Super---5acded67_0e3d_4c6b_a6ea_b533b076de0c---Power`
- **Namespace**: [VDM\Joomla\Database](#vdm-joomla-database)
- **final class Delete** | [Details](src/92291f1f-f248-4ec0-9f2a-3d47c49eeac1) | [Code](src/92291f1f-f248-4ec0-9f2a-3d47c49eeac1/code.php) | [Settings](src/92291f1f-f248-4ec0-9f2a-3d47c49eeac1/settings.json) | SPK: `Super---92291f1f_f248_4ec0_9f2a_3d47c49eeac1---Power`
@ -68,8 +66,7 @@ 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 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 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 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)
@ -86,7 +83,6 @@ 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,14 +90,8 @@ This repository contains an index (see below) of all the approved powers within
- **abstract class GuidHelper** | [Details](src/9c513baf-b279-43fd-ae29-a585c8cbc4f0) | [Code](src/9c513baf-b279-43fd-ae29-a585c8cbc4f0/code.php) | [Settings](src/9c513baf-b279-43fd-ae29-a585c8cbc4f0/settings.json) | SPK: `Super---9c513baf_b279_43fd_ae29_a585c8cbc4f0---Power`
- **abstract class JsonHelper** | [Details](src/4b225c51-d293-48e4-b3f6-5136cf5c3f18) | [Code](src/4b225c51-d293-48e4-b3f6-5136cf5c3f18/code.php) | [Settings](src/4b225c51-d293-48e4-b3f6-5136cf5c3f18/settings.json) | SPK: `Super---4b225c51_d293_48e4_b3f6_5136cf5c3f18---Power`
- **abstract class MathHelper** | [Details](src/152c8793-8b75-4715-996a-257b9f65451c) | [Code](src/152c8793-8b75-4715-996a-257b9f65451c/code.php) | [Settings](src/152c8793-8b75-4715-996a-257b9f65451c/settings.json) | SPK: `Super---152c8793_8b75_4715_996a_257b9f65451c---Power`
- **abstract class 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`
@ -109,49 +99,10 @@ This repository contains an index (see below) of all the approved powers within
- **Namespace**: [VDM\Joomla\Componentbuilder\Abstraction](#vdm-joomla-componentbuilder-abstraction)
- **abstract class 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`
- **Namespace**: [VDM\Joomla\Componentbuilder\File](#vdm-joomla-componentbuilder-file)
- **abstract class Factory** | [Details](src/884eca78-281f-4eab-b962-d97e355af16d) | [Code](src/884eca78-281f-4eab-b962-d97e355af16d/code.php) | [Settings](src/884eca78-281f-4eab-b962-d97e355af16d/settings.json) | SPK: `Super---884eca78_281f_4eab_b962_d97e355af16d---Power`
- **final class Display** | [Details](src/d46c4667-378b-49e8-9782-ffb28d92415a) | [Code](src/d46c4667-378b-49e8-9782-ffb28d92415a/code.php) | [Settings](src/d46c4667-378b-49e8-9782-ffb28d92415a/settings.json) | SPK: `Super---d46c4667_378b_49e8_9782_ffb28d92415a---Power`
- **final class Handler** | [Details](src/4144ad3b-2ad5-401f-af0c-a3d856c1e688) | [Code](src/4144ad3b-2ad5-401f-af0c-a3d856c1e688/code.php) | [Settings](src/4144ad3b-2ad5-401f-af0c-a3d856c1e688/settings.json) | SPK: `Super---4144ad3b_2ad5_401f_af0c_a3d856c1e688---Power`
- **final class Manager** | [Details](src/67a5e0ca-0ff0-4979-9b41-da0b09988016) | [Code](src/67a5e0ca-0ff0-4979-9b41-da0b09988016/code.php) | [Settings](src/67a5e0ca-0ff0-4979-9b41-da0b09988016/settings.json) | SPK: `Super---67a5e0ca_0ff0_4979_9b41_da0b09988016---Power`
- **final class Type** | [Details](src/12a2a8de-a893-4dbb-a53d-b52de4f6cb0e) | [Code](src/12a2a8de-a893-4dbb-a53d-b52de4f6cb0e/code.php) | [Settings](src/12a2a8de-a893-4dbb-a53d-b52de4f6cb0e/settings.json) | SPK: `Super---12a2a8de_a893_4dbb_a53d_b52de4f6cb0e---Power`
- **Namespace**: [VDM\Joomla\Componentbuilder\Import](#vdm-joomla-componentbuilder-import)
- **abstract class Factory** | [Details](src/ff8d5fdb-2d1f-4178-bd18-a43b8efd1068) | [Code](src/ff8d5fdb-2d1f-4178-bd18-a43b8efd1068/code.php) | [Settings](src/ff8d5fdb-2d1f-4178-bd18-a43b8efd1068/settings.json) | SPK: `Super---ff8d5fdb_2d1f_4178_bd18_a43b8efd1068---Power`
- **final class Assessor** | [Details](src/19a66b48-620c-439b-ab8a-3c0d43e040c3) | [Code](src/19a66b48-620c-439b-ab8a-3c0d43e040c3/code.php) | [Settings](src/19a66b48-620c-439b-ab8a-3c0d43e040c3/settings.json) | SPK: `Super---19a66b48_620c_439b_ab8a_3c0d43e040c3---Power`
- **final class Item** | [Details](src/68a0f9af-265a-4db1-bae9-a4e4531f94d7) | [Code](src/68a0f9af-265a-4db1-bae9-a4e4531f94d7/code.php) | [Settings](src/68a0f9af-265a-4db1-bae9-a4e4531f94d7/settings.json) | SPK: `Super---68a0f9af_265a_4db1_bae9_a4e4531f94d7---Power`
- **final class Mapper** | [Details](src/90b48ea8-0930-48d1-869a-bce9c901589c) | [Code](src/90b48ea8-0930-48d1-869a-bce9c901589c/code.php) | [Settings](src/90b48ea8-0930-48d1-869a-bce9c901589c/settings.json) | SPK: `Super---90b48ea8_0930_48d1_869a_bce9c901589c---Power`
- **final class Message** | [Details](src/eef6ffc2-2af0-4336-958f-e0b9cf7c4ad0) | [Code](src/eef6ffc2-2af0-4336-958f-e0b9cf7c4ad0/code.php) | [Settings](src/eef6ffc2-2af0-4336-958f-e0b9cf7c4ad0/settings.json) | SPK: `Super---eef6ffc2_2af0_4336_958f_e0b9cf7c4ad0---Power`
- **final class Row** | [Details](src/afb5b891-7130-422a-b389-1934b0e4fc48) | [Code](src/afb5b891-7130-422a-b389-1934b0e4fc48/code.php) | [Settings](src/afb5b891-7130-422a-b389-1934b0e4fc48/settings.json) | SPK: `Super---afb5b891_7130_422a_b389_1934b0e4fc48---Power`
- **final class Status** | [Details](src/d2a859ac-3f2a-4f69-a77f-f118b2e0a459) | [Code](src/d2a859ac-3f2a-4f69-a77f-f118b2e0a459/code.php) | [Settings](src/d2a859ac-3f2a-4f69-a77f-f118b2e0a459/settings.json) | SPK: `Super---d2a859ac_3f2a_4f69_a77f_f118b2e0a459---Power`
- **class Data** | [Details](src/05f23281-58e3-482e-be42-2dc1355ef4ea) | [Code](src/05f23281-58e3-482e-be42-2dc1355ef4ea/code.php) | [Settings](src/05f23281-58e3-482e-be42-2dc1355ef4ea/settings.json) | SPK: `Super---05f23281_58e3_482e_be42_2dc1355ef4ea---Power`
- **Namespace**: [VDM\Joomla\Componentbuilder\Interfaces](#vdm-joomla-componentbuilder-interfaces)
- **interface ImportAssessorInterface** | [Details](src/57c00d53-5581-4fd1-b3ea-080422710243) | [Code](src/57c00d53-5581-4fd1-b3ea-080422710243/code.php) | [Settings](src/57c00d53-5581-4fd1-b3ea-080422710243/settings.json) | SPK: `Super---57c00d53_5581_4fd1_b3ea_080422710243---Power`
- **interface ImportItemInterface** | [Details](src/53f55e5b-63cb-49e7-b1e6-33e7a9f97856) | [Code](src/53f55e5b-63cb-49e7-b1e6-33e7a9f97856/code.php) | [Settings](src/53f55e5b-63cb-49e7-b1e6-33e7a9f97856/settings.json) | SPK: `Super---53f55e5b_63cb_49e7_b1e6_33e7a9f97856---Power`
- **interface ImportMapperInterface** | [Details](src/250a7272-9ae1-4c63-a058-26bad9ad6f70) | [Code](src/250a7272-9ae1-4c63-a058-26bad9ad6f70/code.php) | [Settings](src/250a7272-9ae1-4c63-a058-26bad9ad6f70/settings.json) | SPK: `Super---250a7272_9ae1_4c63_a058_26bad9ad6f70---Power`
- **interface ImportMessageInterface** | [Details](src/23ad6e72-1b82-40fb-836c-50da690bb174) | [Code](src/23ad6e72-1b82-40fb-836c-50da690bb174/code.php) | [Settings](src/23ad6e72-1b82-40fb-836c-50da690bb174/settings.json) | SPK: `Super---23ad6e72_1b82_40fb_836c_50da690bb174---Power`
- **interface ImportRowInterface** | [Details](src/3d3ec064-9867-41e6-a48a-964c15d753aa) | [Code](src/3d3ec064-9867-41e6-a48a-964c15d753aa/code.php) | [Settings](src/3d3ec064-9867-41e6-a48a-964c15d753aa/settings.json) | SPK: `Super---3d3ec064_9867_41e6_a48a_964c15d753aa---Power`
- **interface ImportStatusInterface** | [Details](src/0e44d149-4863-47ec-8f0f-6a821ab3e77f) | [Code](src/0e44d149-4863-47ec-8f0f-6a821ab3e77f/code.php) | [Settings](src/0e44d149-4863-47ec-8f0f-6a821ab3e77f/settings.json) | SPK: `Super---0e44d149_4863_47ec_8f0f_6a821ab3e77f---Power`
- **Namespace**: [VDM\Joomla\Componentbuilder\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`
- **Namespace**: [VDM\Joomla\Data\Action](#vdm-joomla-data-action)
- **class Delete** | [Details](src/3fc72954-a303-4cac-b53c-554be38b85e7) | [Code](src/3fc72954-a303-4cac-b53c-554be38b85e7/code.php) | [Settings](src/3fc72954-a303-4cac-b53c-554be38b85e7/settings.json) | SPK: `Super---3fc72954_a303_4cac_b53c_554be38b85e7---Power`
@ -161,7 +112,6 @@ This repository contains an index (see below) of all the approved powers within
- **Namespace**: [VDM\Joomla\Interfaces\Data](#vdm-joomla-interfaces-data)
- **interface DeleteInterface** | [Details](src/d8f9ba53-c490-4e8b-8e9f-6757224e069c) | [Code](src/d8f9ba53-c490-4e8b-8e9f-6757224e069c/code.php) | [Settings](src/d8f9ba53-c490-4e8b-8e9f-6757224e069c/settings.json) | SPK: `Super---d8f9ba53_c490_4e8b_8e9f_6757224e069c---Power`
- **interface GuidInterface** | [Details](src/576685fd-263c-46bb-9fdc-1f5eb234cbb6) | [Code](src/576685fd-263c-46bb-9fdc-1f5eb234cbb6/code.php) | [Settings](src/576685fd-263c-46bb-9fdc-1f5eb234cbb6/settings.json) | SPK: `Super---576685fd_263c_46bb_9fdc_1f5eb234cbb6---Power`
- **interface InsertInterface** | [Details](src/03bbc8d5-86e8-4d2f-ae5f-0d44a4f7af13) | [Code](src/03bbc8d5-86e8-4d2f-ae5f-0d44a4f7af13/code.php) | [Settings](src/03bbc8d5-86e8-4d2f-ae5f-0d44a4f7af13/settings.json) | SPK: `Super---03bbc8d5_86e8_4d2f_ae5f_0d44a4f7af13---Power`
- **interface ItemInterface** | [Details](src/05744dd3-4030-4cf8-8dda-a93ab809b473) | [Code](src/05744dd3-4030-4cf8-8dda-a93ab809b473/code.php) | [Settings](src/05744dd3-4030-4cf8-8dda-a93ab809b473/settings.json) | SPK: `Super---05744dd3_4030_4cf8_8dda_a93ab809b473---Power`
- **interface ItemsInterface** | [Details](src/7212e4db-371f-4cfd-8122-32e9bb100d83) | [Code](src/7212e4db-371f-4cfd-8122-32e9bb100d83/code.php) | [Settings](src/7212e4db-371f-4cfd-8122-32e9bb100d83/settings.json) | SPK: `Super---7212e4db_371f_4cfd_8122_32e9bb100d83---Power`
@ -200,20 +150,6 @@ This repository contains an index (see below) of all the approved powers within
- **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 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`
- **Namespace**: [VDM\Joomla\Interfaces\Git\Repository](#vdm-joomla-interfaces-git-repository)
- **interface ContentsInterface** | [Details](src/d1de5d5b-bf29-4031-8094-76c4f6c75900) | [Code](src/d1de5d5b-bf29-4031-8094-76c4f6c75900/code.php) | [Settings](src/d1de5d5b-bf29-4031-8094-76c4f6c75900/settings.json) | SPK: `Super---d1de5d5b_bf29_4031_8094_76c4f6c75900---Power`

View File

@ -1,45 +0,0 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# 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

@ -1,26 +0,0 @@
<?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

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

View File

@ -1,19 +0,0 @@
{
"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

@ -1,89 +0,0 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# 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

@ -1,75 +0,0 @@
<?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

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

@ -1,19 +0,0 @@
{
"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

@ -1,60 +0,0 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# 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

@ -1,40 +0,0 @@
<?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

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

@ -1,19 +0,0 @@
{
"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

@ -1,138 +0,0 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# final class Type (Details)
> namespace: **VDM\Joomla\Componentbuilder\File**
```uml
@startuml
class Type << (F,LightGreen) >> #RoyalBlue {
# Item $item
# array $fileTypes
+ __construct(Item $item)
+ get(string $guid, string $target) : ?array
+ load(string $guid, string $target) : ?array
+ details(string $guid) : ?object
# validTarget(object $data, string $target) : bool
# getFieldName(object $data) : string
# getAllow(object $data) : string
# getAllowSpan(object $data) : string
# getAllowFormats(object $data) : ?array
# getFileTypePath(object $data) : ?string
# getLastFolderName(string $path) : ?string
}
note right of Type::__construct
Constructor.
since: 5.0.2
end note
note left of Type::get
Retrieves the file type details (ajax)
since: 5.0.2
return: ?array
end note
note right of Type::load
Retrieves the file type details (upload)
since: 5.0.2
return: ?array
end note
note left of Type::details
Retrieves the file type details
since: 5.0.2
return: ?object
end note
note right of Type::validTarget
Valid if this is a correct target trying to call this file type
since: 5.0.2
return: bool
end note
note left of Type::getFieldName
Retrieves the field name
since: 5.0.2
return: string
end note
note right of Type::getAllow
Retrieves the allow formats (for script)
since: 5.0.2
return: string
end note
note left of Type::getAllowSpan
Retrieves the allow formats (for span)
since: 5.0.2
return: string
end note
note right of Type::getAllowFormats
Retrieves the allow formats
since: 5.0.2
return: ?array
end note
note left of Type::getFileTypePath
Retrieves the file type path based on provided data.
Performs safety checks and returns either a cleaned path if it exists
and is a writable directory, or constructs a relative path to the 'images' folder
based on the last folder name from the given path.
since: 5.0.2
return: ?string
end note
note right of Type::getLastFolderName
Recursively retrieves the last folder name from a given path, ignoring any file names.
If the last part of the path contains a dot (indicating a file), it moves up the directory tree
until it finds a valid folder name. Returns null if no valid folder is found.
since: 5.0.2
return: ?string
end note
@enduml
```
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
To add this specific Power to your project in JCB:
> simply use this SPK
```
Super---12a2a8de_a893_4dbb_a53d_b52de4f6cb0e---Power
```
> remember to replace the `---` with `___` to activate this Power in your code
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -1,301 +0,0 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2020
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\File;
use Joomla\Filesystem\Path;
use VDM\Joomla\Interfaces\Data\ItemInterface as Item;
/**
* File Type Class
*
* @since 5.0.2
*/
final class Type
{
/**
* The Item Class.
*
* @var Item
* @since 5.0.2
*/
protected Item $item;
/**
* The File Types
*
* @var array
* @since 5.0.2
*/
protected array $fileTypes = [1 => 'image' , 2 => 'document' , 3 => 'media', 4 => 'file'];
/**
* Constructor.
*
* @param Item $item The Item Class.
*
* @since 5.0.2
*/
public function __construct(Item $item)
{
$this->item = $item;
}
/**
* Retrieves the file type details (ajax)
*
* @param string $guid The GUID (Globally Unique Identifier) used as the key to retrieve the file type
* @param string $target The entity target name.
*
* @return array|null The item object if found, or null if the item does not exist.
* @since 5.0.2
*/
public function get(string $guid, string $target): ?array
{
if (($fileType = $this->details($guid)) !== null &&
$this->validTarget($fileType, $target))
{
return [
'name' => $this->getFieldName($fileType),
'allow' => $this->getAllow($fileType),
'allow_span' => $this->getAllowSpan($fileType),
'file_type_span' => $fileType->name ?? 'file',
'display_fields' => $fileType->display_fields ?? null,
'param_fields' => $fileType->param_fields ?? null,
];
}
return null;
}
/**
* Retrieves the file type details (upload)
*
* @param string $guid The GUID (Globally Unique Identifier) used as the key to retrieve the file type
* @param string $target The entity target name.
*
* @return array|null The item object if found, or null if the item does not exist.
* @since 5.0.2
*/
public function load(string $guid, string $target): ?array
{
if (($fileType = $this->details($guid)) !== null &&
$this->validTarget($fileType, $target))
{
return [
'name' => $fileType->name ?? 'files',
'access' => $fileType->access ?? 1,
'download_access' => $fileType->download_access ?? 1,
'field' => $this->getFieldName($fileType),
'type' => $this->getFieldName($fileType),
'formats' => $this->getAllowFormats($fileType) ?? [],
'filter' => $fileType->filter ?? null,
'path' => $this->getFileTypePath($fileType)
];
}
return null;
}
/**
* Retrieves the file type details
*
* @param string $guid The GUID (Globally Unique Identifier) used as the key to retrieve the file type.
*
* @return object|null The item object if found, or null if the item does not exist.
* @since 5.0.2
*/
public function details(string $guid): ?object
{
return $this->item->table('file_type')->get($guid);
}
/**
* Valid if this is a correct target trying to call this file type
*
* @param object $data The type data array
* @param string $target The entity target name.
*
* @return bool True if valid target
* @since 5.0.2
*/
protected function validTarget(object $data, string $target): bool
{
$targets = $data->target ?? null;
if (!empty($targets))
{
$targets = (array) $targets;
return in_array($target, $targets);
}
return false;
}
/**
* Retrieves the field name
*
* @param object $data The type data array
*
* @return string The field name
* @since 5.0.2
*/
protected function getFieldName(object $data): string
{
$type = $data->type ?? 4;
if (isset($this->fileTypes[$type]))
{
return $this->fileTypes[$type];
}
return 'file';
}
/**
* Retrieves the allow formats (for script)
*
* @param object $data The type data array
*
* @return string The allow values
* @since 5.0.2
*/
protected function getAllow(object $data): string
{
$formats = $this->getAllowFormats($data);
if (!empty($formats))
{
return '*.(' . implode('|', $formats) . ')';
}
return '';
}
/**
* Retrieves the allow formats (for span)
*
* @param object $data The type data array
*
* @return string The allow values
* @since 5.0.2
*/
protected function getAllowSpan(object $data): string
{
$formats = $this->getAllowFormats($data);
if (!empty($formats))
{
return '(formats allowed: <b>' . implode(', ', $formats) . '</b>)';
}
return '';
}
/**
* Retrieves the allow formats
*
* @param object|null $data The type data array
*
* @return array|null The allow values
* @since 5.0.2
*/
protected function getAllowFormats(object $data): ?array
{
$type = $data->type ?? 4;
switch ($type)
{
case 1:
$formats = $data->image_formats ?? null;
break;
case 2:
$formats = $data->document_formats ?? null;
break;
case 3:
$formats = $data->media_formats ?? null;
break;
default:
$formats = $data->file_formats ?? null;
break;
}
if ($formats)
{
return (array) $formats;
}
return null;
}
/**
* Retrieves the file type path based on provided data.
*
* Performs safety checks and returns either a cleaned path if it exists
* and is a writable directory, or constructs a relative path to the 'images' folder
* based on the last folder name from the given path.
*
* @param object $data The type data object containing path information.
*
* @return string|null Returns the cleaned file path or null if no valid path is found.
* @since 5.0.2
*/
protected function getFileTypePath(object $data): ?string
{
// Validate the provided path data
$path = isset($data->path) && is_string($data->path) && trim($data->path) !== '' ?
Path::clean(trim($data->path)) : null;
// Return the path if it's a valid directory and writable
if ($path !== null && is_dir($path) && is_writable($path))
{
return $path;
}
// If no valid path is found, try to derive a relative path from the 'images' folder
if ($path !== null && ($folder = $this->getLastFolderName($path)) !== null)
{
return JPATH_SITE . '/images/' . $folder;
}
return null;
}
/**
* Recursively retrieves the last folder name from a given path, ignoring any file names.
* If the last part of the path contains a dot (indicating a file), it moves up the directory tree
* until it finds a valid folder name. Returns null if no valid folder is found.
*
* @param string $path The file system path from which to extract the last folder name.
*
* @return string|null Returns the last folder name if found, or null if no valid folder exists.
* @since 5.0.2
*/
protected function getLastFolderName(string $path): ?string
{
// Remove any trailing slashes to avoid an empty result
$path = rtrim($path, '/\\');
// If the path becomes empty, return null (base case)
if (empty($path))
{
return null;
}
// Get the last part of the path
$lastPart = basename($path);
// If the last part contains a dot (and it's not a hidden folder), move up the directory tree
if (strpos($lastPart, '.') > 0)
{
// If it contains a dot, treat it as a file and move up one level
return $this->getLastFolderName(dirname($path));
}
// Return the last folder name (if it's valid and not a file)
return $lastPart;
}
}

View File

@ -1,274 +0,0 @@
/**
* The Item Class.
*
* @var Item
* @since 5.0.2
*/
protected Item $item;
/**
* The File Types
*
* @var array
* @since 5.0.2
*/
protected array $fileTypes = [1 => 'image' , 2 => 'document' , 3 => 'media', 4 => 'file'];
/**
* Constructor.
*
* @param Item $item The Item Class.
*
* @since 5.0.2
*/
public function __construct(Item $item)
{
$this->item = $item;
}
/**
* Retrieves the file type details (ajax)
*
* @param string $guid The GUID (Globally Unique Identifier) used as the key to retrieve the file type
* @param string $target The entity target name.
*
* @return array|null The item object if found, or null if the item does not exist.
* @since 5.0.2
*/
public function get(string $guid, string $target): ?array
{
if (($fileType = $this->details($guid)) !== null &&
$this->validTarget($fileType, $target))
{
return [
'name' => $this->getFieldName($fileType),
'allow' => $this->getAllow($fileType),
'allow_span' => $this->getAllowSpan($fileType),
'file_type_span' => $fileType->name ?? 'file',
'display_fields' => $fileType->display_fields ?? null,
'param_fields' => $fileType->param_fields ?? null,
];
}
return null;
}
/**
* Retrieves the file type details (upload)
*
* @param string $guid The GUID (Globally Unique Identifier) used as the key to retrieve the file type
* @param string $target The entity target name.
*
* @return array|null The item object if found, or null if the item does not exist.
* @since 5.0.2
*/
public function load(string $guid, string $target): ?array
{
if (($fileType = $this->details($guid)) !== null &&
$this->validTarget($fileType, $target))
{
return [
'name' => $fileType->name ?? 'files',
'access' => $fileType->access ?? 1,
'download_access' => $fileType->download_access ?? 1,
'field' => $this->getFieldName($fileType),
'type' => $this->getFieldName($fileType),
'formats' => $this->getAllowFormats($fileType) ?? [],
'filter' => $fileType->filter ?? null,
'path' => $this->getFileTypePath($fileType)
];
}
return null;
}
/**
* Retrieves the file type details
*
* @param string $guid The GUID (Globally Unique Identifier) used as the key to retrieve the file type.
*
* @return object|null The item object if found, or null if the item does not exist.
* @since 5.0.2
*/
public function details(string $guid): ?object
{
return $this->item->table('file_type')->get($guid);
}
/**
* Valid if this is a correct target trying to call this file type
*
* @param object $data The type data array
* @param string $target The entity target name.
*
* @return bool True if valid target
* @since 5.0.2
*/
protected function validTarget(object $data, string $target): bool
{
$targets = $data->target ?? null;
if (!empty($targets))
{
$targets = (array) $targets;
return in_array($target, $targets);
}
return false;
}
/**
* Retrieves the field name
*
* @param object $data The type data array
*
* @return string The field name
* @since 5.0.2
*/
protected function getFieldName(object $data): string
{
$type = $data->type ?? 4;
if (isset($this->fileTypes[$type]))
{
return $this->fileTypes[$type];
}
return 'file';
}
/**
* Retrieves the allow formats (for script)
*
* @param object $data The type data array
*
* @return string The allow values
* @since 5.0.2
*/
protected function getAllow(object $data): string
{
$formats = $this->getAllowFormats($data);
if (!empty($formats))
{
return '*.(' . implode('|', $formats) . ')';
}
return '';
}
/**
* Retrieves the allow formats (for span)
*
* @param object $data The type data array
*
* @return string The allow values
* @since 5.0.2
*/
protected function getAllowSpan(object $data): string
{
$formats = $this->getAllowFormats($data);
if (!empty($formats))
{
return '(formats allowed: <b>' . implode(', ', $formats) . '</b>)';
}
return '';
}
/**
* Retrieves the allow formats
*
* @param object|null $data The type data array
*
* @return array|null The allow values
* @since 5.0.2
*/
protected function getAllowFormats(object $data): ?array
{
$type = $data->type ?? 4;
switch ($type)
{
case 1:
$formats = $data->image_formats ?? null;
break;
case 2:
$formats = $data->document_formats ?? null;
break;
case 3:
$formats = $data->media_formats ?? null;
break;
default:
$formats = $data->file_formats ?? null;
break;
}
if ($formats)
{
return (array) $formats;
}
return null;
}
/**
* Retrieves the file type path based on provided data.
*
* Performs safety checks and returns either a cleaned path if it exists
* and is a writable directory, or constructs a relative path to the 'images' folder
* based on the last folder name from the given path.
*
* @param object $data The type data object containing path information.
*
* @return string|null Returns the cleaned file path or null if no valid path is found.
* @since 5.0.2
*/
protected function getFileTypePath(object $data): ?string
{
// Validate the provided path data
$path = isset($data->path) && is_string($data->path) && trim($data->path) !== '' ?
Path::clean(trim($data->path)) : null;
// Return the path if it's a valid directory and writable
if ($path !== null && is_dir($path) && is_writable($path))
{
return $path;
}
// If no valid path is found, try to derive a relative path from the 'images' folder
if ($path !== null && ($folder = $this->getLastFolderName($path)) !== null)
{
return JPATH_SITE . '/images/' . $folder;
}
return null;
}
/**
* Recursively retrieves the last folder name from a given path, ignoring any file names.
* If the last part of the path contains a dot (indicating a file), it moves up the directory tree
* until it finds a valid folder name. Returns null if no valid folder is found.
*
* @param string $path The file system path from which to extract the last folder name.
*
* @return string|null Returns the last folder name if found, or null if no valid folder exists.
* @since 5.0.2
*/
protected function getLastFolderName(string $path): ?string
{
// Remove any trailing slashes to avoid an empty result
$path = rtrim($path, '/\\');
// If the path becomes empty, return null (base case)
if (empty($path))
{
return null;
}
// Get the last part of the path
$lastPart = basename($path);
// If the last part contains a dot (and it's not a hidden folder), move up the directory tree
if (strpos($lastPart, '.') > 0)
{
// If it contains a dot, treat it as a file and move up one level
return $this->getLastFolderName(dirname($path));
}
// Return the last folder name (if it's valid and not a file)
return $lastPart;
}

View File

@ -1,24 +0,0 @@
{
"add_head": "1",
"add_licensing_template": "2",
"extends": "",
"guid": "12a2a8de-a893-4dbb-a53d-b52de4f6cb0e",
"implements": null,
"load_selection": null,
"name": "Type",
"power_version": "1.0.0",
"system_name": "Joomla.File.Type",
"type": "final class",
"use_selection": {
"use_selection0": {
"use": "05744dd3-4030-4cf8-8dda-a93ab809b473",
"as": "Item"
}
},
"extendsinterfaces": null,
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].File.Type",
"description": "File Type Class\r\n\r\n@since 5.0.2",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2020\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
"head": "use Joomla\\Filesystem\\Path;",
"composer": ""
}

View File

@ -2,7 +2,7 @@
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2020
* @created 3rd 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.

View File

@ -13,7 +13,7 @@
"extendsinterfaces": null,
"namespace": "[[[NamespacePrefix]]]\\Joomla\\Utilities.ClassHelper",
"description": "Class Helper for JCB Powers\r\n\r\n@since 3.2.2",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 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",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 3rd September, 2020\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
"head": "",
"composer": ""
}

View File

@ -1,72 +0,0 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# 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

@ -1,129 +0,0 @@
<?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\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

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

@ -1,34 +0,0 @@
{
"add_head": "0",
"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": "",
"composer": ""
}

View File

@ -15,7 +15,6 @@ class Table #Gold {
+ register(Container $container) : void
+ getTable(Container $container) : DataTable
+ getSchema(Container $container) : Schema
+ getValidator(Container $container) : Validator
}
note right of Table::register
@ -38,13 +37,6 @@ 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,7 +16,6 @@ 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;
/**
@ -41,9 +40,6 @@ 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);
}
/**
@ -72,21 +68,6 @@ 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,9 +13,6 @@
$container->alias(Schema::class, 'Table.Schema')
->share('Table.Schema', [$this, 'getSchema'], true);
$container->alias(Validator::class, 'Table.Validator')
->share('Table.Validator', [$this, 'getValidator'], true);
}
/**
@ -44,19 +41,4 @@
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,10 +19,6 @@
"use_selection1": {
"use": "b3d2ec33-76d4-4c3b-bb2c-86ac14a221ce",
"as": "default"
},
"use_selection2": {
"use": "79fd4f39-824d-4ab6-936d-959705ff24ec",
"as": "default"
}
},
"extendsinterfaces": null,

View File

@ -1,45 +0,0 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# class NoUserIdFoundException (Details)
> namespace: **VDM\Joomla\Componentbuilder\Utilities\Exception**
> extends: **\InvalidArgumentException**
```uml
@startuml
class NoUserIdFoundException #Gold {
}
@enduml
```
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
To add this specific Power to your project in JCB:
> simply use this SPK
```
Super---1c10a5f1_204d_4f17_ad9f_0e0684f2030d---Power
```
> remember to replace the `---` with `___` to activate this Power in your code
---
```
██╗ ██████╗██████╗
██║██╔════╝██╔══██╗
██║██║ ██████╔╝
██ ██║██║ ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
╚════╝ ╚═════╝╚═════╝
```
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)

View File

@ -1,23 +0,0 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2020
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\Utilities\Exception;
/**
* No User Id Found Exception
*
* @since 5.0.2
*/
class NoUserIdFoundException extends \InvalidArgumentException
{
}

View File

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

View File

@ -1,20 +0,0 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "-1",
"guid": "1c10a5f1-204d-4f17-ad9f-0e0684f2030d",
"implements": null,
"load_selection": null,
"name": "NoUserIdFoundException",
"power_version": "1.0.0",
"system_name": "Joomla.Utilities.Exception.NoUserIdFoundException",
"type": "class",
"use_selection": null,
"extendsinterfaces": null,
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Utilities.Exception.NoUserIdFoundException",
"description": "No User Id Found Exception\r\n\r\n@since 5.0.2",
"extends_custom": "\\InvalidArgumentException",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2020\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
"head": "",
"composer": ""
}

View File

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

View File

@ -1,115 +0,0 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2022
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\File\Service;
use Joomla\DI\Container;
use Joomla\DI\ServiceProviderInterface;
use VDM\Joomla\Componentbuilder\File\Type;
use VDM\Joomla\Componentbuilder\File\Handler;
use VDM\Joomla\Componentbuilder\File\Manager;
use VDM\Joomla\Componentbuilder\File\Display;
/**
* File Service Provider
*
* @since 5.0.3
*/
class File implements ServiceProviderInterface
{
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
* @since 5.0.3
*/
public function register(Container $container)
{
$container->alias(Type::class, 'File.Type')
->share('File.Type', [$this, 'getType'], true);
$container->alias(Handler::class, 'File.Handler')
->share('File.Handler', [$this, 'getHandler'], true);
$container->alias(Manager::class, 'File.Manager')
->share('File.Manager', [$this, 'getManager'], true);
$container->alias(Display::class, 'File.Display')
->share('File.Display', [$this, 'getDisplay'], true);
}
/**
* Get The Type Class.
*
* @param Container $container The DI container.
*
* @return Type
* @since 5.0.3
*/
public function getType(Container $container): Type
{
return new Type(
$container->get('Data.Item')
);
}
/**
* Get The Handler Class.
*
* @param Container $container The DI container.
*
* @return Handler
* @since 5.0.3
*/
public function getHandler(Container $container): Handler
{
return new Handler();
}
/**
* Get The Manager Class.
*
* @param Container $container The DI container.
*
* @return Manager
* @since 5.0.3
*/
public function getManager(Container $container): Manager
{
return new Manager(
$container->get('Data.Item'),
$container->get('Data.Items'),
$container->get('File.Type'),
$container->get('File.Handler')
);
}
/**
* Get The Display Class.
*
* @param Container $container The DI container.
*
* @return Display
* @since 5.0.3
*/
public function getDisplay(Container $container): Display
{
return new Display(
$container->get('Data.Item'),
$container->get('Data.Items')
);
}
}

View File

@ -1,84 +0,0 @@
/**
* Registers the service provider with a DI container.
*
* @param Container $container The DI container.
*
* @return void
* @since 5.0.3
*/
public function register(Container $container)
{
$container->alias(Type::class, 'File.Type')
->share('File.Type', [$this, 'getType'], true);
$container->alias(Handler::class, 'File.Handler')
->share('File.Handler', [$this, 'getHandler'], true);
$container->alias(Manager::class, 'File.Manager')
->share('File.Manager', [$this, 'getManager'], true);
$container->alias(Display::class, 'File.Display')
->share('File.Display', [$this, 'getDisplay'], true);
}
/**
* Get The Type Class.
*
* @param Container $container The DI container.
*
* @return Type
* @since 5.0.3
*/
public function getType(Container $container): Type
{
return new Type(
$container->get('Data.Item')
);
}
/**
* Get The Handler Class.
*
* @param Container $container The DI container.
*
* @return Handler
* @since 5.0.3
*/
public function getHandler(Container $container): Handler
{
return new Handler();
}
/**
* Get The Manager Class.
*
* @param Container $container The DI container.
*
* @return Manager
* @since 5.0.3
*/
public function getManager(Container $container): Manager
{
return new Manager(
$container->get('Data.Item'),
$container->get('Data.Items'),
$container->get('File.Type'),
$container->get('File.Handler')
);
}
/**
* Get The Display Class.
*
* @param Container $container The DI container.
*
* @return Display
* @since 5.0.3
*/
public function getDisplay(Container $container): Display
{
return new Display(
$container->get('Data.Item'),
$container->get('Data.Items')
);
}

View File

@ -1,39 +0,0 @@
{
"add_head": "1",
"add_licensing_template": "2",
"extends": "",
"guid": "202ccd9e-dfcf-4cde-a0ce-bde1fd27f088",
"implements": [
"-1"
],
"load_selection": null,
"name": "File",
"power_version": "1.0.0",
"system_name": "JCB.File.Service.File",
"type": "class",
"use_selection": {
"use_selection0": {
"use": "12a2a8de-a893-4dbb-a53d-b52de4f6cb0e",
"as": "default"
},
"use_selection1": {
"use": "4144ad3b-2ad5-401f-af0c-a3d856c1e688",
"as": "default"
},
"use_selection2": {
"use": "67a5e0ca-0ff0-4979-9b41-da0b09988016",
"as": "default"
},
"use_selection3": {
"use": "d46c4667-378b-49e8-9782-ffb28d92415a",
"as": "default"
}
},
"extendsinterfaces": null,
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].File.Service.File",
"description": "File Service Provider\r\n\r\n@since 5.0.3",
"implements_custom": "ServiceProviderInterface",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
"head": "use Joomla\\DI\\Container;\r\nuse Joomla\\DI\\ServiceProviderInterface;",
"composer": ""
}

View File

@ -1,108 +0,0 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# 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

@ -1,171 +0,0 @@
<?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

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

@ -1,51 +0,0 @@
{
"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

@ -1,120 +0,0 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# 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

@ -1,109 +0,0 @@
<?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

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

@ -1,19 +0,0 @@
{
"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

@ -1,68 +0,0 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# 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

@ -1,49 +0,0 @@
<?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

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

@ -1,19 +0,0 @@
{
"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,6 +35,14 @@ 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,3 +1,11 @@
/**
* Global Package Container
*
* @var Container|null
* @since 0.0.0
**/
protected static ?Container $container = null;
/**
* Get any class from the package container
*

View File

@ -36,7 +36,6 @@ note right of SubformInterface::get
string $linkKey
string $field
array $get
bool $multi = true
end note
note right of SubformInterface::set

View File

@ -36,12 +36,11 @@ interface SubformInterface
* @param string $linkKey The link key on which the items where linked in the child table.
* @param string $field The parent field name of the subform in the parent view.
* @param array $get The array SET of the keys of each row in the subform.
* @param bool $multi The switch to return a multiple set.
*
* @return array|null The subform
* @since 3.2.2
*/
public function get(string $linkValue, string $linkKey, string $field, array $get, bool $multi = true): ?array;
public function get(string $linkValue, string $linkKey, string $field, array $get): ?array;
/**
* Set a subform items

View File

@ -15,12 +15,11 @@
* @param string $linkKey The link key on which the items where linked in the child table.
* @param string $field The parent field name of the subform in the parent view.
* @param array $get The array SET of the keys of each row in the subform.
* @param bool $multi The switch to return a multiple set.
*
* @return array|null The subform
* @since 3.2.2
*/
public function get(string $linkValue, string $linkKey, string $field, array $get, bool $multi = true): ?array;
public function get(string $linkValue, string $linkKey, string $field, array $get): ?array;
/**
* Set a subform items

View File

@ -1,84 +0,0 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# 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

@ -1,68 +0,0 @@
<?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

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

@ -1,19 +0,0 @@
{
"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

@ -1,107 +0,0 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# final class Handler (Details)
> namespace: **VDM\Joomla\Componentbuilder\File**
> extends: **UploadHelper**
```uml
@startuml
class Handler << (F,LightGreen) >> #RoyalBlue {
+ setUseStreams(bool $useStreams) : self
+ setAllowUnsafe(bool $allowUnsafe) : self
+ setSafeFileOptions(array $safeFileOptions) : self
+ setEnqueueError(bool $enqueueError) : self
+ setLegalFormats(array $legalFormats) : self
+ getFile(string $field, string $type, ...) : ?array
+ getErrors(bool $toString = true) : string|array
}
note right of Handler::setUseStreams
Set the $useStreams property to use streams for file handling
since: 5.0.3
return: self
end note
note right of Handler::setAllowUnsafe
Set the $allowUnsafe property to allow or disallow unsafe file uploads.
since: 5.0.3
return: self
end note
note right of Handler::setSafeFileOptions
Set the $safeFileOptions property to define options for file safety checks.
since: 5.0.3
return: self
end note
note right of Handler::setEnqueueError
Set the $enqueueError property to control error reporting behavior.
since: 5.0.3
return: self
end note
note right of Handler::setLegalFormats
Set the $legalFormats property to define legal file formats.
since: 5.0.3
return: self
end note
note right of Handler::getFile
Get a file from the input based on field name and file type, then process it.
since: 3.0.11
return: ?array
arguments:
string $field
string $type
string $filter = null
string $path = null
end note
note right of Handler::getErrors
Get the error messages as a string.
since: 5.0.3
return: string|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---4144ad3b_2ad5_401f_af0c_a3d856c1e688---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

@ -1,129 +0,0 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2020
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\File;
use VDM\Joomla\Utilities\UploadHelper;
/**
* File Handler Class
*
* @since 5.0.2
*/
final class Handler extends UploadHelper
{
/**
* Set the $useStreams property to use streams for file handling
*
* @param bool $useStreams True to use streams, false otherwise.
*
* @return self Returns the current instance to allow for method chaining.
* @since 5.0.3
*/
public function setUseStreams(bool $useStreams): self
{
static::$useStreams = $useStreams;
return $this;
}
/**
* Set the $allowUnsafe property to allow or disallow unsafe file uploads.
*
* @param bool $allowUnsafe True to allow unsafe file uploads, false otherwise.
*
* @return self Returns the current instance to allow for method chaining.
* @since 5.0.3
*/
public function setAllowUnsafe(bool $allowUnsafe): self
{
static::$allowUnsafe = $allowUnsafe;
return $this;
}
/**
* Set the $safeFileOptions property to define options for file safety checks.
*
* @param array $safeFileOptions An array of options for InputFilter::isSafeFile.
*
* @return self Returns the current instance to allow for method chaining.
* @since 5.0.3
*/
public function setSafeFileOptions(array $safeFileOptions): self
{
static::$safeFileOptions = $safeFileOptions;
return $this;
}
/**
* Set the $enqueueError property to control error reporting behavior.
*
* @param bool $enqueueError True to enqueue error messages, false to store them in the internal error array.
*
* @return self Returns the current instance to allow for method chaining.
* @since 5.0.3
*/
public function setEnqueueError(bool $enqueueError): self
{
static::$enqueueError = $enqueueError;
return $this;
}
/**
* Set the $legalFormats property to define legal file formats.
*
* @param array $legalFormats An array of allowed file formats (e.g., ['jpg', 'png']).
*
* @return self Returns the current instance to allow for method chaining.
* @since 5.0.3
*/
public function setLegalFormats(array $legalFormats): self
{
static::$legalFormats = $legalFormats;
return $this;
}
/**
* Get a file from the input based on field name and file type, then process it.
*
* @param string $field The input field name for the file upload.
* @param string $type The type of file (e.g., 'image', 'document').
* @param string|null $filter The filter to apply when uploading the file.
* @param string|null $path The directory path where the file should be saved.
*
* @return array|null File details or false on failure.
* @since 3.0.11
*/
public function getFile(string $field, string $type, string $filter = null, string $path = null): ?array
{
return static::get($field, $type, $filter, $path);
}
/**
* Get the error messages as a string.
*
* @param bool $toString The option to return errors as a string
*
* @return string|array Returns the error messages as a single concatenated string.
* @since 5.0.3
*/
public function getErrors(bool $toString = true): string|array
{
return static::getError($toString);
}
}

View File

@ -1,103 +0,0 @@
/**
* Set the $useStreams property to use streams for file handling
*
* @param bool $useStreams True to use streams, false otherwise.
*
* @return self Returns the current instance to allow for method chaining.
* @since 5.0.3
*/
public function setUseStreams(bool $useStreams): self
{
static::$useStreams = $useStreams;
return $this;
}
/**
* Set the $allowUnsafe property to allow or disallow unsafe file uploads.
*
* @param bool $allowUnsafe True to allow unsafe file uploads, false otherwise.
*
* @return self Returns the current instance to allow for method chaining.
* @since 5.0.3
*/
public function setAllowUnsafe(bool $allowUnsafe): self
{
static::$allowUnsafe = $allowUnsafe;
return $this;
}
/**
* Set the $safeFileOptions property to define options for file safety checks.
*
* @param array $safeFileOptions An array of options for InputFilter::isSafeFile.
*
* @return self Returns the current instance to allow for method chaining.
* @since 5.0.3
*/
public function setSafeFileOptions(array $safeFileOptions): self
{
static::$safeFileOptions = $safeFileOptions;
return $this;
}
/**
* Set the $enqueueError property to control error reporting behavior.
*
* @param bool $enqueueError True to enqueue error messages, false to store them in the internal error array.
*
* @return self Returns the current instance to allow for method chaining.
* @since 5.0.3
*/
public function setEnqueueError(bool $enqueueError): self
{
static::$enqueueError = $enqueueError;
return $this;
}
/**
* Set the $legalFormats property to define legal file formats.
*
* @param array $legalFormats An array of allowed file formats (e.g., ['jpg', 'png']).
*
* @return self Returns the current instance to allow for method chaining.
* @since 5.0.3
*/
public function setLegalFormats(array $legalFormats): self
{
static::$legalFormats = $legalFormats;
return $this;
}
/**
* Get a file from the input based on field name and file type, then process it.
*
* @param string $field The input field name for the file upload.
* @param string $type The type of file (e.g., 'image', 'document').
* @param string|null $filter The filter to apply when uploading the file.
* @param string|null $path The directory path where the file should be saved.
*
* @return array|null File details or false on failure.
* @since 3.0.11
*/
public function getFile(string $field, string $type, string $filter = null, string $path = null): ?array
{
return static::get($field, $type, $filter, $path);
}
/**
* Get the error messages as a string.
*
* @param bool $toString The option to return errors as a string
*
* @return string|array Returns the error messages as a single concatenated string.
* @since 5.0.3
*/
public function getErrors(bool $toString = true): string|array
{
return static::getError($toString);
}

View File

@ -1,19 +0,0 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "d7600b43-771a-4747-9f5d-952765721799",
"guid": "4144ad3b-2ad5-401f-af0c-a3d856c1e688",
"implements": null,
"load_selection": null,
"name": "Handler",
"power_version": "1.0.0",
"system_name": "Joomla.File.Handler",
"type": "final class",
"use_selection": null,
"extendsinterfaces": null,
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].File.Handler",
"description": "File Handler Class\r\n\r\n@since 5.0.2",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2020\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
"head": "",
"composer": ""
}

View File

@ -1,231 +0,0 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# final class UsersSubform (Details)
> namespace: **VDM\Joomla\Data**
```uml
@startuml
class UsersSubform << (F,LightGreen) >> #RoyalBlue {
# Items $items
# string $table
# array $user
# User $identity
# array $activeUsers
+ __construct(Items $items, ?string $table = null)
+ table(string $table) : self
+ get(string $linkValue, string $linkKey, ...) : ?array
+ set(mixed $items, string $indexKey, ...) : bool
+ getTable() : string
- initializeUserProperties() : void
- purge(array $items, string $indexKey, ...) : void
- getUsersDetails(array $items) : array
- getUserDetails(array $item) : void
- converter(array $items, array $keySet, ...) : array
- process(mixed $items, string $indexKey, ...) : array
- getActiveUsers(string $linkKey, string $linkValue) : array
- setUserDetails(array $item, array $activeUsers) : int
- loadUser(array $item, array $activeUsers) : ?User
- extractUserDetails(array $item, ?User $user) : array
- assignUserGroups($details, ?User $user, ...) : void
- saveUserDetails(array $details, int $userId) : int
- isMultipleSets(array $array) : bool
}
note right of UsersSubform::__construct
Constructor.
since: 3.2.2
end note
note left of UsersSubform::table
Set the current active table
since: 3.2.2
return: self
end note
note right of UsersSubform::get
Get a subform items
since: 3.2.2
return: ?array
arguments:
string $linkValue
string $linkKey
string $field
array $get
bool $multi = true
end note
note left of UsersSubform::set
Set a subform items
since: 3.2.2
return: bool
arguments:
mixed $items
string $indexKey
string $linkKey
string $linkValue
end note
note right of UsersSubform::getTable
Get the current active table
since: 3.2.2
return: string
end note
note left of UsersSubform::initializeUserProperties
Initializes the user properties.
since: 5.0.2
return: void
end note
note right of UsersSubform::purge
Purge all items no longer in subform
since: 3.2.2
return: void
arguments:
array $items
string $indexKey
string $linkKey
string $linkValue
end note
note left of UsersSubform::getUsersDetails
Get the users details found in the user table.
since: 5.0.2
return: array
end note
note right of UsersSubform::getUserDetails
Get the user details found in the user table.
since: 5.0.2
return: void
end note
note left of UsersSubform::converter
Filters the specified keys from an array of objects or arrays, converts them to arrays,
and sets them by association with a specified key and an incrementing integer.
since: 3.2.2
return: array
arguments:
array $items
array $keySet
string $field
bool $multi
end note
note right of UsersSubform::process
Processes an array of arrays based on the specified key.
since: 3.2.2
return: array
arguments:
mixed $items
string $indexKey
string $linkKey
string $linkValue
end note
note left of UsersSubform::getActiveUsers
Get current active Users Linked to this entity
since: 5.0.2
return: array
end note
note right of UsersSubform::setUserDetails
Handles setting user details and saving them.
This function retrieves the user by ID, sets the user details,
and adds appropriate user groups before saving the user.
since: 5.0.2
return: int
end note
note left of UsersSubform::loadUser
Load the user based on the user ID from the item array.
since: 5.0.2
return: ?User
end note
note right of UsersSubform::extractUserDetails
Extract user details from the item array and prepare them for saving.
since: 5.0.2
return: array
end note
note left of UsersSubform::assignUserGroups
Assigns user groups based on existing groups and entity type.
since: 5.0.2
return: void
arguments:
$details
?User $user
array $item
end note
note right of UsersSubform::saveUserDetails
Save the user details using UserHelper and handle exceptions.
since: 5.0.2
return: int
end note
note left of UsersSubform::isMultipleSets
Function to determine if the array consists of multiple data sets (arrays of arrays).
since: 5.0.2
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---46b98346_ec98_42b3_a393_96c7d1282b1c---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

@ -1,614 +0,0 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2020
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Data;
use Joomla\CMS\Factory;
use Joomla\CMS\User\User;
use VDM\Joomla\Interfaces\Data\ItemsInterface as Items;
use VDM\Joomla\Data\Guid;
use VDM\Joomla\Componentbuilder\Utilities\UserHelper;
use VDM\Joomla\Componentbuilder\Utilities\Exception\NoUserIdFoundException;
use VDM\Joomla\Utilities\Component\Helper as Component;
use VDM\Joomla\Interfaces\Data\GuidInterface;
use VDM\Joomla\Interfaces\Data\SubformInterface;
/**
* CRUD the user data of any sub-form to another view (table)
*
* @since 5.0.2
*/
final class UsersSubform implements GuidInterface, SubformInterface
{
/**
* The Globally Unique Identifier.
*
* @since 5.0.2
*/
use Guid;
/**
* The Items Class.
*
* @var Items
* @since 3.2.2
*/
protected Items $items;
/**
* Table Name
*
* @var string
* @since 3.2.1
*/
protected string $table;
/**
* The user properties
*
* @var array
* @since 5.0.2
*/
protected array $user;
/**
* The current active user
*
* @var User
* @since 5.0.2
*/
protected User $identity;
/**
* The active users
*
* @var array
* @since 5.0.2
*/
protected array $activeUsers = [];
/**
* Constructor.
*
* @param Items $items The items Class.
* @param string|null $table The table name.
*
* @since 3.2.2
*/
public function __construct(Items $items, ?string $table = null)
{
$this->items = $items;
if ($table !== null)
{
$this->table = $table;
}
$this->identity = Factory::getApplication()->getIdentity();
// Retrieve the user properties
$this->initializeUserProperties();
}
/**
* 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
{
$this->table = $table;
return $this;
}
/**
* Get a subform items
*
* @param string $linkValue The value of the link key in child table.
* @param string $linkKey The link key on which the items where linked in the child table.
* @param string $field The parent field name of the subform in the parent view.
* @param array $get The array get:set of the keys of each row in the subform.
* @param bool $multi The switch to return a multiple set.
*
* @return array|null The subform
* @since 3.2.2
*/
public function get(string $linkValue, string $linkKey, string $field, array $get, bool $multi = true): ?array
{
if (($items = $this->items->table($this->getTable())->get([$linkValue], $linkKey)) !== null)
{
return $this->converter(
$this->getUsersDetails($items),
$get,
$field,
$multi
);
}
return null;
}
/**
* Set a subform items
*
* @param mixed $items The list of items from the subform to set
* @param string $indexKey The index key on which the items should be observed as it relates to insert/update/delete.
* @param string $linkKey The link key on which the items where linked in the child table.
* @param string $linkValue The value of the link key in child table.
*
* @return bool
* @since 3.2.2
*/
public function set(mixed $items, string $indexKey, string $linkKey, string $linkValue): bool
{
$items = $this->process($items, $indexKey, $linkKey, $linkValue);
$this->purge($items, $indexKey, $linkKey, $linkValue);
if (empty($items))
{
return true; // nothing to set (already purged)
}
return $this->items->table($this->getTable())->set(
$items, $indexKey
);
}
/**
* Get the current active table
*
* @return string
* @since 3.2.2
*/
public function getTable(): string
{
return $this->table;
}
/**
* Initializes the user properties.
*
* @return void
* @since 5.0.2
*/
private function initializeUserProperties(): void
{
$user = UserHelper::getUserById(0);
// Populate user properties array excluding the 'id'
foreach (get_object_vars($user) as $property => $value)
{
if ($property !== 'id')
{
$this->user[$property] = $property;
}
}
$this->user['password2'] = 'password2';
}
/**
* Purge all items no longer in subform
*
* @param array $items The list of items to set.
* @param string $indexKey The index key on which the items should be observed as it relates to insert/update/delete
* @param string $linkKey The link key on which the items where linked in the child table.
* @param string $linkValue The value of the link key in child table.
*
* @return void
* @since 3.2.2
*/
private function purge(array $items, string $indexKey, string $linkKey, string $linkValue): void
{
// Get the current index values from the database
$currentIndexValues = $this->items->table($this->getTable())->values([$linkValue], $linkKey, $indexKey);
if ($currentIndexValues !== null)
{
// Check if the items array is empty
if (empty($items))
{
// Set activeIndexValues to an empty array if items is empty
$activeIndexValues = [];
}
else
{
// Extract the index values from the items array
$activeIndexValues = array_values(array_map(function($item) use ($indexKey) {
return $item[$indexKey] ?? null;
}, $items));
}
// Find the index values that are no longer in the items array
$inactiveIndexValues = array_diff($currentIndexValues, $activeIndexValues);
// Delete the inactive index values
if (!empty($inactiveIndexValues))
{
$this->items->table($this->getTable())->delete($inactiveIndexValues, $indexKey);
// $this->deleteUsers($inactiveIndexValues); (soon)
}
}
}
/**
* Get the users details found in the user table.
*
* @param array $items Array of objects or arrays to be filtered.
*
* @return array
* @since 5.0.2
*/
private function getUsersDetails(array $items): array
{
foreach ($items as $index => &$item)
{
$item = (array) $item;
$this->getUserDetails($item);
}
return $items;
}
/**
* Get the user details found in the user table.
*
* @param array $item The user map array
*
* @return void
* @since 5.0.2
*/
private function getUserDetails(array &$item): void
{
// Validate the user_id and ensure it is numeric and greater than 0
if (empty($item['user_id']) || !is_numeric($item['user_id']) || $item['user_id'] <= 0)
{
return;
}
// Retrieve the user by ID
$user = UserHelper::getUserById((int)$item['user_id']);
// Verify if the user exists and the ID matches
if ($user && $user->id === (int) $item['user_id'])
{
// Iterate over public properties of the user object
foreach (get_object_vars($user) as $property => $value)
{
// Avoid overwriting the id in the item
if ($property !== 'id')
{
$item[$property] = $value;
}
}
}
}
/**
* Filters the specified keys from an array of objects or arrays, converts them to arrays,
* and sets them by association with a specified key and an incrementing integer.
*
* @param array $items Array of objects or arrays to be filtered.
* @param array $keySet Array of keys to retain in each item.
* @param string $field The field prefix for the resulting associative array.
* @param bool $multi The switch to return a multiple set.
*
* @return array Array of filtered arrays set by association.
* @since 3.2.2
*/
private function converter(array $items, array $keySet, string $field, bool $multi): array
{
/**
* Filters keys for a single item and converts it to an array.
*
* @param object|array $item The item to filter.
* @param array $keySet The keys to retain.
*
* @return array The filtered array.
* @since 3.2.2
*/
$filterKeys = function ($item, array $keySet) {
$filteredArray = [];
foreach ($keySet as $key) {
if (is_object($item) && property_exists($item, $key)) {
$filteredArray[$key] = $item->{$key};
} elseif (is_array($item) && array_key_exists($key, $item)) {
$filteredArray[$key] = $item[$key];
}
}
return $filteredArray;
};
$result = [];
foreach ($items as $index => $item)
{
if (!$multi)
{
return $filterKeys($item, $keySet);
}
$filteredArray = $filterKeys($item, $keySet);
$result[$field . $index] = $filteredArray;
}
return $result;
}
/**
* Processes an array of arrays based on the specified key.
*
* @param mixed $items Array of arrays to be processed.
* @param string $indexKey The index key on which the items should be observed as it relates to insert/update/delete
* @param string $linkKey The link key on which the items where linked in the child table.
* @param string $linkValue The value of the link key in child table.
*
* @return array The processed array of arrays.
* @since 3.2.2
*/
private function process($items, string $indexKey, string $linkKey, string $linkValue): array
{
$items = is_array($items) ? $items : [];
if ($items !== [] && !$this->isMultipleSets($items))
{
$items = [$items];
}
foreach ($items as $n => &$item)
{
$value = $item[$indexKey] ?? '';
switch ($indexKey) {
case 'guid':
if (empty($value))
{
// set INDEX
$item[$indexKey] = $this->getGuid($indexKey);
}
break;
case 'id':
if (empty($value))
{
$item[$indexKey] = 0;
}
break;
default:
// No action for other keys if empty
break;
}
// set LINK
$item[$linkKey] = $linkValue;
// create/update user
$item['user_id'] = $this->setUserDetails(
$item,
$this->getActiveUsers(
$linkKey,
$linkValue
)
);
// remove empty row (means no user linked)
if ($item['user_id'] == 0)
{
unset($items[$n]);
}
}
return array_values($items);
}
/**
* Get current active Users Linked to this entity
*
* @param string $linkKey The link key on which the items where linked in the child table.
* @param string $linkValue The value of the link key in child table.
*
* @return array The IDs of all active users.
* @since 5.0.2
*/
private function getActiveUsers(string $linkKey, string $linkValue): array
{
if (isset($this->activeUsers[$linkKey . $linkValue]))
{
return $this->activeUsers[$linkKey . $linkValue];
}
if (($users = $this->items->table($this->getTable())->values([$linkValue], $linkKey, 'user_id')) !== null)
{
$this->activeUsers[$linkKey . $linkValue] = $users;
return $users;
}
return [];
}
/**
* Handles setting user details and saving them.
*
* This function retrieves the user by ID, sets the user details,
* and adds appropriate user groups before saving the user.
*
* @param array $item The user details passed by reference.
* @param array $activeUsers The current active user linked to this entity.
*
* @return int The ID of the saved user, or 0 on failure.
* @since 5.0.2
*/
private function setUserDetails(array &$item, array $activeUsers): int
{
$user = $this->loadUser($item, $activeUsers);
$details = $this->extractUserDetails($item, $user);
if ($this->identity->id != $user->id)
{
$this->assignUserGroups($details, $user, $item);
}
return $this->saveUserDetails($details, $details['id'] ?? 0);
}
/**
* Load the user based on the user ID from the item array.
*
* @param array $item The array containing user details.
* @param array $activeUsers The current active user linked to this entity.
*
* @return User|null The user object if found, null otherwise.
* @since 5.0.2
*/
private function loadUser(array $item, array $activeUsers): ?User
{
if (!isset($item['user_id']) || !is_numeric($item['user_id']) || $item['user_id'] <= 0)
{
return null;
}
// only allow update to linked users
if (!in_array($item['user_id'], $activeUsers))
{
return null;
}
$user = UserHelper::getUserById((int) $item['user_id']);
if ($user && $user->id == $item['user_id'])
{
return $user;
}
return null;
}
/**
* Extract user details from the item array and prepare them for saving.
*
* @param array $item The array containing user details.
* @param User|null $user The user object if found, null otherwise.
*
* @return array The prepared user details array.
* @since 5.0.2
*/
private function extractUserDetails(array &$item, ?User $user): array
{
$details = [];
if ($user !== null)
{
$details['id'] = (int) $item['user_id'];
}
foreach ($this->user as $property)
{
if (isset($item[$property]))
{
$details[$property] = $item[$property];
unset($item[$property]);
}
}
return $details;
}
/**
* Assigns user groups based on existing groups and entity type.
*
* @param array &$details The array to store user details including groups.
* @param User|null $user The user object if found, null otherwise.
* @param array $item The array containing additional user details.
*
* @return void
* @since 5.0.2
*/
private function assignUserGroups(array &$details, ?User $user, array $item): void
{
$groups = $user !== null ? (array) $user->groups : [];
if (!empty($item['entity_type']))
{
$global_entity_groups = Component::getParams()->get($item['entity_type'] . '_groups', []);
foreach ($global_entity_groups as $group)
{
if (!in_array($group, $groups))
{
$groups[] = $group;
}
}
}
// Ensure $details['groups'] is an array if it exists, else default to an empty array
$detailsGroups = isset($details['groups']) ? (array) $details['groups'] : [];
// Merge the arrays and remove duplicates
$mergedGroups = array_unique(array_merge($detailsGroups, $groups));
// Only set $details['groups'] if the merged array is not empty
if (!empty($mergedGroups))
{
$details['groups'] = $mergedGroups;
}
else
{
unset($details['groups']);
}
}
/**
* Save the user details using UserHelper and handle exceptions.
*
* @param array $details The prepared user details array.
* @param int $userId The ID of the user being processed.
*
* @return int The ID of the saved user, or 0 on failure.
* @since 5.0.2
*/
private function saveUserDetails(array $details, int $userId): int
{
try {
return UserHelper::save($details, 0, ['useractivation' => 0, 'sendpassword' => 1, 'allowUserRegistration' => 1]);
} catch (NoUserIdFoundException $e) {
Factory::getApplication()->enqueueMessage($e->getMessage(), 'error');
} catch (\Exception $e) {
Factory::getApplication()->enqueueMessage($e->getMessage(), 'warning');
return $userId;
}
return 0;
}
/**
* Function to determine if the array consists of multiple data sets (arrays of arrays).
*
* @param array $array The input array to be checked.
*
* @return bool True if the array contains only arrays (multiple data sets), false otherwise.
* @since 5.0.2
*/
private function isMultipleSets(array $array): bool
{
foreach ($array as $element)
{
// As soon as we find a non-array element, return false
if (!is_array($element))
{
return false;
}
}
// If all elements are arrays, return true
return true;
}
}

View File

@ -1,580 +0,0 @@
/**
* The Globally Unique Identifier.
*
* @since 5.0.2
*/
use Guid;
/**
* The Items Class.
*
* @var Items
* @since 3.2.2
*/
protected Items $items;
/**
* Table Name
*
* @var string
* @since 3.2.1
*/
protected string $table;
/**
* The user properties
*
* @var array
* @since 5.0.2
*/
protected array $user;
/**
* The current active user
*
* @var User
* @since 5.0.2
*/
protected User $identity;
/**
* The active users
*
* @var array
* @since 5.0.2
*/
protected array $activeUsers = [];
/**
* Constructor.
*
* @param Items $items The items Class.
* @param string|null $table The table name.
*
* @since 3.2.2
*/
public function __construct(Items $items, ?string $table = null)
{
$this->items = $items;
if ($table !== null)
{
$this->table = $table;
}
$this->identity = Factory::getApplication()->getIdentity();
// Retrieve the user properties
$this->initializeUserProperties();
}
/**
* 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
{
$this->table = $table;
return $this;
}
/**
* Get a subform items
*
* @param string $linkValue The value of the link key in child table.
* @param string $linkKey The link key on which the items where linked in the child table.
* @param string $field The parent field name of the subform in the parent view.
* @param array $get The array get:set of the keys of each row in the subform.
* @param bool $multi The switch to return a multiple set.
*
* @return array|null The subform
* @since 3.2.2
*/
public function get(string $linkValue, string $linkKey, string $field, array $get, bool $multi = true): ?array
{
if (($items = $this->items->table($this->getTable())->get([$linkValue], $linkKey)) !== null)
{
return $this->converter(
$this->getUsersDetails($items),
$get,
$field,
$multi
);
}
return null;
}
/**
* Set a subform items
*
* @param mixed $items The list of items from the subform to set
* @param string $indexKey The index key on which the items should be observed as it relates to insert/update/delete.
* @param string $linkKey The link key on which the items where linked in the child table.
* @param string $linkValue The value of the link key in child table.
*
* @return bool
* @since 3.2.2
*/
public function set(mixed $items, string $indexKey, string $linkKey, string $linkValue): bool
{
$items = $this->process($items, $indexKey, $linkKey, $linkValue);
$this->purge($items, $indexKey, $linkKey, $linkValue);
if (empty($items))
{
return true; // nothing to set (already purged)
}
return $this->items->table($this->getTable())->set(
$items, $indexKey
);
}
/**
* Get the current active table
*
* @return string
* @since 3.2.2
*/
public function getTable(): string
{
return $this->table;
}
/**
* Initializes the user properties.
*
* @return void
* @since 5.0.2
*/
private function initializeUserProperties(): void
{
$user = UserHelper::getUserById(0);
// Populate user properties array excluding the 'id'
foreach (get_object_vars($user) as $property => $value)
{
if ($property !== 'id')
{
$this->user[$property] = $property;
}
}
$this->user['password2'] = 'password2';
}
/**
* Purge all items no longer in subform
*
* @param array $items The list of items to set.
* @param string $indexKey The index key on which the items should be observed as it relates to insert/update/delete
* @param string $linkKey The link key on which the items where linked in the child table.
* @param string $linkValue The value of the link key in child table.
*
* @return void
* @since 3.2.2
*/
private function purge(array $items, string $indexKey, string $linkKey, string $linkValue): void
{
// Get the current index values from the database
$currentIndexValues = $this->items->table($this->getTable())->values([$linkValue], $linkKey, $indexKey);
if ($currentIndexValues !== null)
{
// Check if the items array is empty
if (empty($items))
{
// Set activeIndexValues to an empty array if items is empty
$activeIndexValues = [];
}
else
{
// Extract the index values from the items array
$activeIndexValues = array_values(array_map(function($item) use ($indexKey) {
return $item[$indexKey] ?? null;
}, $items));
}
// Find the index values that are no longer in the items array
$inactiveIndexValues = array_diff($currentIndexValues, $activeIndexValues);
// Delete the inactive index values
if (!empty($inactiveIndexValues))
{
$this->items->table($this->getTable())->delete($inactiveIndexValues, $indexKey);
// $this->deleteUsers($inactiveIndexValues); (soon)
}
}
}
/**
* Get the users details found in the user table.
*
* @param array $items Array of objects or arrays to be filtered.
*
* @return array
* @since 5.0.2
*/
private function getUsersDetails(array $items): array
{
foreach ($items as $index => &$item)
{
$item = (array) $item;
$this->getUserDetails($item);
}
return $items;
}
/**
* Get the user details found in the user table.
*
* @param array $item The user map array
*
* @return void
* @since 5.0.2
*/
private function getUserDetails(array &$item): void
{
// Validate the user_id and ensure it is numeric and greater than 0
if (empty($item['user_id']) || !is_numeric($item['user_id']) || $item['user_id'] <= 0)
{
return;
}
// Retrieve the user by ID
$user = UserHelper::getUserById((int)$item['user_id']);
// Verify if the user exists and the ID matches
if ($user && $user->id === (int) $item['user_id'])
{
// Iterate over public properties of the user object
foreach (get_object_vars($user) as $property => $value)
{
// Avoid overwriting the id in the item
if ($property !== 'id')
{
$item[$property] = $value;
}
}
}
}
/**
* Filters the specified keys from an array of objects or arrays, converts them to arrays,
* and sets them by association with a specified key and an incrementing integer.
*
* @param array $items Array of objects or arrays to be filtered.
* @param array $keySet Array of keys to retain in each item.
* @param string $field The field prefix for the resulting associative array.
* @param bool $multi The switch to return a multiple set.
*
* @return array Array of filtered arrays set by association.
* @since 3.2.2
*/
private function converter(array $items, array $keySet, string $field, bool $multi): array
{
/**
* Filters keys for a single item and converts it to an array.
*
* @param object|array $item The item to filter.
* @param array $keySet The keys to retain.
*
* @return array The filtered array.
* @since 3.2.2
*/
$filterKeys = function ($item, array $keySet) {
$filteredArray = [];
foreach ($keySet as $key) {
if (is_object($item) && property_exists($item, $key)) {
$filteredArray[$key] = $item->{$key};
} elseif (is_array($item) && array_key_exists($key, $item)) {
$filteredArray[$key] = $item[$key];
}
}
return $filteredArray;
};
$result = [];
foreach ($items as $index => $item)
{
if (!$multi)
{
return $filterKeys($item, $keySet);
}
$filteredArray = $filterKeys($item, $keySet);
$result[$field . $index] = $filteredArray;
}
return $result;
}
/**
* Processes an array of arrays based on the specified key.
*
* @param mixed $items Array of arrays to be processed.
* @param string $indexKey The index key on which the items should be observed as it relates to insert/update/delete
* @param string $linkKey The link key on which the items where linked in the child table.
* @param string $linkValue The value of the link key in child table.
*
* @return array The processed array of arrays.
* @since 3.2.2
*/
private function process($items, string $indexKey, string $linkKey, string $linkValue): array
{
$items = is_array($items) ? $items : [];
if ($items !== [] && !$this->isMultipleSets($items))
{
$items = [$items];
}
foreach ($items as $n => &$item)
{
$value = $item[$indexKey] ?? '';
switch ($indexKey) {
case 'guid':
if (empty($value))
{
// set INDEX
$item[$indexKey] = $this->getGuid($indexKey);
}
break;
case 'id':
if (empty($value))
{
$item[$indexKey] = 0;
}
break;
default:
// No action for other keys if empty
break;
}
// set LINK
$item[$linkKey] = $linkValue;
// create/update user
$item['user_id'] = $this->setUserDetails(
$item,
$this->getActiveUsers(
$linkKey,
$linkValue
)
);
// remove empty row (means no user linked)
if ($item['user_id'] == 0)
{
unset($items[$n]);
}
}
return array_values($items);
}
/**
* Get current active Users Linked to this entity
*
* @param string $linkKey The link key on which the items where linked in the child table.
* @param string $linkValue The value of the link key in child table.
*
* @return array The IDs of all active users.
* @since 5.0.2
*/
private function getActiveUsers(string $linkKey, string $linkValue): array
{
if (isset($this->activeUsers[$linkKey . $linkValue]))
{
return $this->activeUsers[$linkKey . $linkValue];
}
if (($users = $this->items->table($this->getTable())->values([$linkValue], $linkKey, 'user_id')) !== null)
{
$this->activeUsers[$linkKey . $linkValue] = $users;
return $users;
}
return [];
}
/**
* Handles setting user details and saving them.
*
* This function retrieves the user by ID, sets the user details,
* and adds appropriate user groups before saving the user.
*
* @param array $item The user details passed by reference.
* @param array $activeUsers The current active user linked to this entity.
*
* @return int The ID of the saved user, or 0 on failure.
* @since 5.0.2
*/
private function setUserDetails(array &$item, array $activeUsers): int
{
$user = $this->loadUser($item, $activeUsers);
$details = $this->extractUserDetails($item, $user);
if ($this->identity->id != $user->id)
{
$this->assignUserGroups($details, $user, $item);
}
return $this->saveUserDetails($details, $details['id'] ?? 0);
}
/**
* Load the user based on the user ID from the item array.
*
* @param array $item The array containing user details.
* @param array $activeUsers The current active user linked to this entity.
*
* @return User|null The user object if found, null otherwise.
* @since 5.0.2
*/
private function loadUser(array $item, array $activeUsers): ?User
{
if (!isset($item['user_id']) || !is_numeric($item['user_id']) || $item['user_id'] <= 0)
{
return null;
}
// only allow update to linked users
if (!in_array($item['user_id'], $activeUsers))
{
return null;
}
$user = UserHelper::getUserById((int) $item['user_id']);
if ($user && $user->id == $item['user_id'])
{
return $user;
}
return null;
}
/**
* Extract user details from the item array and prepare them for saving.
*
* @param array $item The array containing user details.
* @param User|null $user The user object if found, null otherwise.
*
* @return array The prepared user details array.
* @since 5.0.2
*/
private function extractUserDetails(array &$item, ?User $user): array
{
$details = [];
if ($user !== null)
{
$details['id'] = (int) $item['user_id'];
}
foreach ($this->user as $property)
{
if (isset($item[$property]))
{
$details[$property] = $item[$property];
unset($item[$property]);
}
}
return $details;
}
/**
* Assigns user groups based on existing groups and entity type.
*
* @param array &$details The array to store user details including groups.
* @param User|null $user The user object if found, null otherwise.
* @param array $item The array containing additional user details.
*
* @return void
* @since 5.0.2
*/
private function assignUserGroups(array &$details, ?User $user, array $item): void
{
$groups = $user !== null ? (array) $user->groups : [];
if (!empty($item['entity_type']))
{
$global_entity_groups = Component::getParams()->get($item['entity_type'] . '_groups', []);
foreach ($global_entity_groups as $group)
{
if (!in_array($group, $groups))
{
$groups[] = $group;
}
}
}
// Ensure $details['groups'] is an array if it exists, else default to an empty array
$detailsGroups = isset($details['groups']) ? (array) $details['groups'] : [];
// Merge the arrays and remove duplicates
$mergedGroups = array_unique(array_merge($detailsGroups, $groups));
// Only set $details['groups'] if the merged array is not empty
if (!empty($mergedGroups))
{
$details['groups'] = $mergedGroups;
}
else
{
unset($details['groups']);
}
}
/**
* Save the user details using UserHelper and handle exceptions.
*
* @param array $details The prepared user details array.
* @param int $userId The ID of the user being processed.
*
* @return int The ID of the saved user, or 0 on failure.
* @since 5.0.2
*/
private function saveUserDetails(array $details, int $userId): int
{
try {
return UserHelper::save($details, 0, ['useractivation' => 0, 'sendpassword' => 1, 'allowUserRegistration' => 1]);
} catch (NoUserIdFoundException $e) {
Factory::getApplication()->enqueueMessage($e->getMessage(), 'error');
} catch (\Exception $e) {
Factory::getApplication()->enqueueMessage($e->getMessage(), 'warning');
return $userId;
}
return 0;
}
/**
* Function to determine if the array consists of multiple data sets (arrays of arrays).
*
* @param array $array The input array to be checked.
*
* @return bool True if the array contains only arrays (multiple data sets), false otherwise.
* @since 5.0.2
*/
private function isMultipleSets(array $array): bool
{
foreach ($array as $element)
{
// As soon as we find a non-array element, return false
if (!is_array($element))
{
return false;
}
}
// If all elements are arrays, return true
return true;
}

View File

@ -1,43 +0,0 @@
{
"add_head": "1",
"add_licensing_template": "2",
"extends": "",
"guid": "46b98346-ec98-42b3-a393-96c7d1282b1c",
"implements": [
"576685fd-263c-46bb-9fdc-1f5eb234cbb6",
"34959721-415b-4b5e-8002-3d1fc84b3b2b"
],
"load_selection": null,
"name": "UsersSubform",
"power_version": "1.0.0",
"system_name": "VDM.Data.UsersSubform",
"type": "final class",
"use_selection": {
"use_selection0": {
"use": "7212e4db-371f-4cfd-8122-32e9bb100d83",
"as": "Items"
},
"use_selection1": {
"use": "5acded67-0e3d-4c6b-a6ea-b533b076de0c",
"as": "default"
},
"use_selection2": {
"use": "7832a726-87b6-4e95-887e-7b725d3fab8f",
"as": "default"
},
"use_selection3": {
"use": "1c10a5f1-204d-4f17-ad9f-0e0684f2030d",
"as": "default"
},
"use_selection4": {
"use": "640b5352-fb09-425f-a26e-cd44eda03f15",
"as": "Component"
}
},
"extendsinterfaces": null,
"namespace": "[[[NamespacePrefix]]]\\Joomla\\Data.UsersSubform",
"description": "CRUD the user data of any sub-form to another view (table)\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\\User\\User;",
"composer": ""
}

View File

@ -1,68 +0,0 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# 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

@ -1,89 +0,0 @@
<?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

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

@ -1,19 +0,0 @@
{
"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

@ -2,7 +2,7 @@
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2020
* @created 3rd 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.

View File

@ -13,7 +13,7 @@
"extendsinterfaces": null,
"namespace": "[[[NamespacePrefix]]]\\Joomla\\Utilities.String.ComponentCodeNameHelper",
"description": "Control the naming of a component code name\r\n\r\n@since 3.2.1",
"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",
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 3rd September, 2020\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
"head": "",
"composer": ""
}

View File

@ -1,52 +0,0 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# 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

@ -1,33 +0,0 @@
<?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

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

@ -1,19 +0,0 @@
{
"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

@ -1,54 +0,0 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# interface GuidInterface (Details)
> namespace: **VDM\Joomla\Interfaces\Data**
```uml
@startuml
interface GuidInterface #Lavender {
+ getGuid(string $key) : string
}
note right of GuidInterface::getGuid
Returns a GUIDv4 string.
This function uses the best cryptographically secure method
available on the platform with a fallback to an older, less secure version.
since: 5.0.2
return: string
end note
@enduml
```
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
To add this specific Power to your project in JCB:
> simply use this SPK
```
Super---576685fd_263c_46bb_9fdc_1f5eb234cbb6---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

@ -1,36 +0,0 @@
<?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\Interfaces\Data;
/**
* Globally Unique Identifier Interface
*
* @since 5.0.2
*/
interface GuidInterface
{
/**
* Returns a GUIDv4 string.
*
* This function uses the best cryptographically secure method
* available on the platform with a fallback to an older, less secure version.
*
* @param string $key The key to check and modify values.
*
* @return string A GUIDv4 string.
*
* @since 5.0.2
*/
public function getGuid(string $key): string;
}

View File

@ -1,13 +0,0 @@
/**
* Returns a GUIDv4 string.
*
* This function uses the best cryptographically secure method
* available on the platform with a fallback to an older, less secure version.
*
* @param string $key The key to check and modify values.
*
* @return string A GUIDv4 string.
*
* @since 5.0.2
*/
public function getGuid(string $key): string;

View File

@ -1,19 +0,0 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "",
"guid": "576685fd-263c-46bb-9fdc-1f5eb234cbb6",
"implements": null,
"load_selection": null,
"name": "GuidInterface",
"power_version": "1.0.0",
"system_name": "VDM.Interfaces.Data.GuidInterface",
"type": "interface",
"use_selection": null,
"extendsinterfaces": null,
"namespace": "[[[NamespacePrefix]]]\\Joomla\\Interfaces.Data.GuidInterface",
"description": "Globally Unique Identifier Interface\r\n\r\n@since 5.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

@ -1,57 +0,0 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# 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

@ -1,34 +0,0 @@
<?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

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

@ -1,19 +0,0 @@
{
"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

@ -19,7 +19,7 @@ abstract Model #Orange {
+ __construct(Table $table, ?string $tableName = null, ...)
+ table(string $table) : self
+ {abstract} value(mixed $value, string $field, ...) : mixed
+ values(?array $items, string $field, ...) : ?array
+ values(?array $items = null, string $field, ...) : ?array
+ item(?object $item, ?string $table = null) : ?object
+ items(?array $items = null, ?string $table = null) : ?array
+ row(?array $item, ?string $table = null) : ?array
@ -73,7 +73,7 @@ Example: $this->items(Array, 'value_key', 'table_name');
return: ?array
arguments:
?array $items
?array $items = null
string $field
?string $table = null
end note

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;
@ -118,7 +118,7 @@ abstract class Model implements ModelInterface
* @return array|null
* @since 3.2.2
*/
public function values(?array $items, string $field, ?string $table = null): ?array
public function values(?array $items = null, string $field, ?string $table = null): ?array
{
// check if this is a valid table
if (ArrayHelper::check($items))

View File

@ -91,7 +91,7 @@
* @return array|null
* @since 3.2.2
*/
public function values(?array $items, string $field, ?string $table = null): ?array
public function values(?array $items = null, string $field, ?string $table = null): ?array
{
// check if this is a valid table
if (ArrayHelper::check($items))

View File

@ -1,70 +0,0 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# trait Guid (Details)
> namespace: **VDM\Joomla\Data**
```uml
@startuml
class Guid << (T,Orange) >> #Turquoise {
+ getGuid(string $key) : string
- fallbackGuid(string $key) : string
- checkGuid(string $guid, string $key) : string
}
note right of Guid::getGuid
Returns a GUIDv4 string.
This function uses the best cryptographically secure method
available on the platform with a fallback to an older, less secure version.
since: 5.0.2
return: string
end note
note right of Guid::fallbackGuid
Generates a fallback GUIDv4 using less secure methods.
since: 5.0.2
return: string
end note
note right of Guid::checkGuid
Checks if the GUID value is unique and does not already exist.
since: 5.0.2
return: string
end note
@enduml
```
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
To add this specific Power to your project in JCB:
> simply use this SPK
```
Super---5acded67_0e3d_4c6b_a6ea_b533b076de0c---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

@ -1,110 +0,0 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 4th September, 2020
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Data;
/**
* Globally Unique Identifier
*
* @since 5.0.2
*/
trait Guid
{
/**
* Returns a GUIDv4 string.
*
* This function uses the best cryptographically secure method
* available on the platform with a fallback to an older, less secure version.
*
* @param string $key The key to check and modify values.
*
* @return string A GUIDv4 string.
*
* @since 5.0.2
*/
public function getGuid(string $key): string
{
// Windows: Use com_create_guid if available
if (function_exists('com_create_guid'))
{
$guid = trim(\com_create_guid(), '{}');
return $this->checkGuid($guid, $key);
}
// Unix-based systems: Use openssl_random_pseudo_bytes if available
if (function_exists('random_bytes'))
{
try {
$data = random_bytes(16);
} catch (Exception $e) {
// Handle the error appropriately (logging, throwing, etc.)
return $this->fallbackGuid($key);
}
// Set the version to 0100 and the bits 6-7 to 10 as per RFC 4122
$data[6] = chr(ord($data[6]) & 0x0f | 0x40);
$data[8] = chr(ord($data[8]) & 0x3f | 0x80);
$guid = vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
return $this->checkGuid($guid, $key);
}
// Fallback to older methods if secure methods are not available
return $this->fallbackGuid($key);
}
/**
* Generates a fallback GUIDv4 using less secure methods.
*
* @param string $key The key to check and modify values.
*
* @return string A GUIDv4 string.
*
* @since 5.0.2
*/
private function fallbackGuid(string $key): string
{
$charid = strtolower(md5(uniqid(random_int(0, PHP_INT_MAX), true)));
$guidv4 = sprintf(
'%s-%s-%s-%s-%s',
substr($charid, 0, 8),
substr($charid, 8, 4),
substr($charid, 12, 4),
substr($charid, 16, 4),
substr($charid, 20, 12)
);
return $this->checkGuid($guidv4, $key);
}
/**
* Checks if the GUID value is unique and does not already exist.
*
* @param string $guid The GUID value to check.
* @param string $key The key to check and modify values.
*
* @return string The unique GUID value.
*
* @since 5.0.2
*/
private function checkGuid(string $guid, string $key): string
{
// Check that the GUID does not already exist
if ($this->items->table($this->getTable())->values([$guid], $key))
{
return $this->getGuid($key);
}
return $guid;
}
}

View File

@ -1,87 +0,0 @@
/**
* Returns a GUIDv4 string.
*
* This function uses the best cryptographically secure method
* available on the platform with a fallback to an older, less secure version.
*
* @param string $key The key to check and modify values.
*
* @return string A GUIDv4 string.
*
* @since 5.0.2
*/
public function getGuid(string $key): string
{
// Windows: Use com_create_guid if available
if (function_exists('com_create_guid'))
{
$guid = trim(\com_create_guid(), '{}');
return $this->checkGuid($guid, $key);
}
// Unix-based systems: Use openssl_random_pseudo_bytes if available
if (function_exists('random_bytes'))
{
try {
$data = random_bytes(16);
} catch (Exception $e) {
// Handle the error appropriately (logging, throwing, etc.)
return $this->fallbackGuid($key);
}
// Set the version to 0100 and the bits 6-7 to 10 as per RFC 4122
$data[6] = chr(ord($data[6]) & 0x0f | 0x40);
$data[8] = chr(ord($data[8]) & 0x3f | 0x80);
$guid = vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4));
return $this->checkGuid($guid, $key);
}
// Fallback to older methods if secure methods are not available
return $this->fallbackGuid($key);
}
/**
* Generates a fallback GUIDv4 using less secure methods.
*
* @param string $key The key to check and modify values.
*
* @return string A GUIDv4 string.
*
* @since 5.0.2
*/
private function fallbackGuid(string $key): string
{
$charid = strtolower(md5(uniqid(random_int(0, PHP_INT_MAX), true)));
$guidv4 = sprintf(
'%s-%s-%s-%s-%s',
substr($charid, 0, 8),
substr($charid, 8, 4),
substr($charid, 12, 4),
substr($charid, 16, 4),
substr($charid, 20, 12)
);
return $this->checkGuid($guidv4, $key);
}
/**
* Checks if the GUID value is unique and does not already exist.
*
* @param string $guid The GUID value to check.
* @param string $key The key to check and modify values.
*
* @return string The unique GUID value.
*
* @since 5.0.2
*/
private function checkGuid(string $guid, string $key): string
{
// Check that the GUID does not already exist
if ($this->items->table($this->getTable())->values([$guid], $key))
{
return $this->getGuid($key);
}
return $guid;
}

View File

@ -1,19 +0,0 @@
{
"add_head": "0",
"add_licensing_template": "2",
"extends": "",
"guid": "5acded67-0e3d-4c6b-a6ea-b533b076de0c",
"implements": null,
"load_selection": null,
"name": "Guid",
"power_version": "1.0.0",
"system_name": "VDM.Data.Guid",
"type": "trait",
"use_selection": null,
"extendsinterfaces": null,
"namespace": "[[[NamespacePrefix]]]\\Joomla\\Data.Guid",
"description": "Globally Unique Identifier\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": "",
"composer": ""
}

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

@ -1,57 +0,0 @@
```
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
```
# 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

@ -1,34 +0,0 @@
<?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

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

@ -1,19 +0,0 @@
{
"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

@ -12,7 +12,6 @@
```uml
@startuml
abstract Helper #Orange {
+ {static} setParams(string $target, mixed $value, ...) : mixed
+ {static} getParams(?string $option = null) : Registry
+ {static} setOption(?string $option) : void
+ {static} getOption(?string $default = 'empty') : ?string
@ -22,82 +21,65 @@ abstract Helper #Orange {
+ {static} getManifest(?string $option = null) : ?object
+ {static} methodExists(string $method, ?string $option = null) : bool
+ {static} _(string $method, array $arguments = [], ...) : mixed
+ {static} getModel(string $type, string $prefix = 'Administrator', ...) : BaseDatabaseModel
- {static} getPrefixFromModelPath(string $path) : string
}
note right of Helper::setParams
Sets a parameter value for the given target in the specified option's params.
If no option is provided, it falls back to the default option.
This method updates the parameters for a given extension in the database,
only if the new value differs from the existing one.
since: 5.0.3
return: mixed
arguments:
string $target
mixed $value
?string $option = null
end note
note left of Helper::getParams
note right of Helper::getParams
Gets the parameter object for the component
since: 3.0.11
return: Registry
end note
note right of Helper::setOption
note left of Helper::setOption
Set the component option
since: 3.2.0
return: void
end note
note left of Helper::getOption
note right of Helper::getOption
Get the component option
since: 3.0.11
return: ?string
end note
note right of Helper::getCode
note left of Helper::getCode
Gets the component code name
since: 3.0.11
return: ?string
end note
note left of Helper::get
note right of Helper::get
Gets the component abstract helper class
since: 3.0.11
return: ?string
end note
note right of Helper::getNamespace
note left of Helper::getNamespace
Gets the component namespace if set
since: 3.0.11
return: ?string
end note
note left of Helper::getManifest
note right of Helper::getManifest
Gets the component abstract helper class
since: 3.0.11
return: ?object
end note
note right of Helper::methodExists
note left of Helper::methodExists
Check if the helper class of this component has a method
since: 3.0.11
return: bool
end note
note left of Helper::_
note right of Helper::_
Check if the helper class of this component has a method, and call it with the arguments
since: 3.2.0
@ -108,26 +90,6 @@ note left of Helper::_
array $arguments = []
?string $option = null
end note
note right of Helper::getModel
Returns a Model object based on the specified type, prefix, and configuration.
since: 5.0.3
return: BaseDatabaseModel
arguments:
string $type
string $prefix = 'Administrator'
?string $option = null
array $config = []
end note
note left of Helper::getPrefixFromModelPath
Get the prefix from the model path
since: 5.0.3
return: string
end note
@enduml
```

View File

@ -14,11 +14,9 @@ namespace VDM\Joomla\Utilities\Component;
use Joomla\CMS\Factory;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\MVC\Model\BaseDatabaseModel;
use Joomla\Input\Input;
use Joomla\Registry\Registry;
use VDM\Joomla\Utilities\String\NamespaceHelper;
use VDM\Joomla\Utilities\StringHelper;
/**
@ -52,57 +50,6 @@ abstract class Helper
*/
protected static array $params = [];
/**
* Sets a parameter value for the given target in the specified option's params.
* If no option is provided, it falls back to the default option.
*
* This method updates the parameters for a given extension in the database,
* only if the new value differs from the existing one.
*
* @param string $target The parameter name to be updated.
* @param mixed $value The value to set for the parameter.
* @param string|null $option The optional extension element name. Defaults to null, which will use the default option.
*
* @return mixed The previous value of the parameter before it was updated.
* @since 5.0.3
*/
public static function setParams(string $target, $value, ?string $option = null)
{
// Ensure that an option is specified, defaulting to the system's option if not provided.
if (empty($option))
{
$option = static::getOption();
}
// Retrieve current parameters for the specified option.
$params = static::getParams($option);
// Get the current value of the target parameter.
$was = $params->get($target, null);
// Only proceed if the new value differs from the current value.
if ($was !== $value)
{
// Update the parameter value.
$params->set($target, $value);
// Obtain a database connection instance.
$db = Factory::getDBO();
$query = $db->getQuery(true);
// Build and execute the query to update the parameters in the database.
$query->update('#__extensions AS a')
->set('a.params = ' . $db->quote((string) $params))
->where('a.element = ' . $db->quote((string) $option));
$db->setQuery($query);
$db->execute();
}
// Return the previous value of the parameter.
return $was;
}
/**
* Gets the parameter object for the component
*
@ -117,16 +64,16 @@ abstract class Helper
// check that we have an option
if (empty($option))
{
$option = static::getOption();
$option = self::getOption();
}
// get global value
if (!isset(static::$params[$option]) || !static::$params[$option] instanceof Registry)
if (!isset(self::$params[$option]) || !self::$params[$option] instanceof Registry)
{
static::$params[$option] = ComponentHelper::getParams($option);
self::$params[$option] = ComponentHelper::getParams($option);
}
return static::$params[$option];
return self::$params[$option];
}
/**
@ -139,7 +86,7 @@ abstract class Helper
*/
public static function setOption(?string $option): void
{
static::$option = $option;
self::$option = $option;
}
/**
@ -152,13 +99,13 @@ abstract class Helper
*/
public static function getOption(?string $default = 'empty'): ?string
{
if (empty(static::$option))
if (empty(self::$option))
{
// get the option from the url input
static::$option = (new Input)->getString('option', null);
self::$option = (new Input)->getString('option', null);
}
if (empty(static::$option))
if (empty(self::$option))
{
$app = Factory::getApplication();
@ -166,16 +113,16 @@ abstract class Helper
if (method_exists($app, 'getInput'))
{
// get the option from the application
static::$option = $app->getInput()->getCmd('option', $default);
self::$option = $app->getInput()->getCmd('option', $default);
}
else
{
// Use the default value if getInput method does not exist
static::$option = $default;
self::$option = $default;
}
}
return static::$option;
return self::$option;
}
/**
@ -192,7 +139,7 @@ abstract class Helper
// check that we have an option
if (empty($option))
{
$option = static::getOption();
$option = self::getOption();
}
// option with com_
if (is_string($option) && strpos($option, 'com_') === 0)
@ -217,7 +164,7 @@ abstract class Helper
{
// check that we have an option
// and get the code name from it
if (($code_name = static::getCode($option, null)) !== null)
if (($code_name = self::getCode($option, null)) !== null)
{
// we build the helper class name
$helper_name = '\\' . \ucfirst($code_name) . 'Helper';
@ -229,7 +176,7 @@ abstract class Helper
}
// try loading namespace
if (($namespace = static::getNamespace($option)) !== null)
if (($namespace = self::getNamespace($option)) !== null)
{
$name = \ucfirst($code_name) . 'Helper';
$namespace_helper = '\\' . $namespace . '\Administrator\Helper\\' . NamespaceHelper::safeSegment($name); // TODO target site or admin locations not just admin...
@ -255,7 +202,7 @@ abstract class Helper
*/
public static function getNamespace(?string $option = null): ?string
{
$manifest = static::getManifest($option);
$manifest = self::getManifest($option);
return $manifest->namespace ?? null;
}
@ -273,13 +220,13 @@ abstract class Helper
public static function getManifest(?string $option = null): ?object
{
if ($option === null
&& ($option = static::getOption($option)) === null)
&& ($option = self::getOption($option)) === null)
{
return null;
}
// get global manifest_cache values
if (!isset(static::$manifest[$option]))
if (!isset(self::$manifest[$option]))
{
$db = Factory::getDbo();
$query = $db->getQuery(true);
@ -293,14 +240,14 @@ abstract class Helper
try {
$manifest = $db->loadResult();
static::$manifest[$option] = json_decode($manifest);
self::$manifest[$option] = json_decode($manifest);
} catch (\Exception $e) {
// Handle the database error appropriately.
static::$manifest[$option] = null;
self::$manifest[$option] = null;
}
}
return static::$manifest[$option];
return self::$manifest[$option];
}
/**
@ -316,7 +263,7 @@ abstract class Helper
public static function methodExists(string $method, ?string $option = null): bool
{
// get the helper class
return ($helper = static::get($option, null)) !== null &&
return ($helper = self::get($option, null)) !== null &&
method_exists($helper, $method);
}
@ -333,7 +280,7 @@ abstract class Helper
public static function _(string $method, array $arguments = [], ?string $option = null)
{
// get the helper class
if (($helper = static::get($option, null)) !== null &&
if (($helper = self::get($option, null)) !== null &&
method_exists($helper, $method))
{
// we know this is not ideal...
@ -344,77 +291,6 @@ abstract class Helper
return null;
}
/**
* Returns a Model object based on the specified type, prefix, and configuration.
*
* @param string $type The model type to instantiate. Must not be empty.
* @param string $prefix Prefix for the model class name. Optional, defaults to 'Administrator'.
* @param string|null $option The component option. Optional, defaults to the component's option.
* @param array $config Configuration array for the model. Optional, defaults to an empty array.
*
* @return BaseDatabaseModel The instantiated model object.
*
* @throws \InvalidArgumentException If the $type parameter is empty.
* @throws \Exception For other errors that may occur during model creation.
*
* @since 5.0.3
*/
public static function getModel(string $type, string $prefix = 'Administrator',
?string $option = null, array $config = []): BaseDatabaseModel
{
// Ensure the $type parameter is not empty
if (empty($type))
{
throw new \InvalidArgumentException('The $type parameter cannot be empty when calling Component Helper getModel method.');
}
// Ensure the $option parameter is set, defaulting to the component's option if not provided
if (empty($option))
{
$option = static::getOption();
}
// Normalize the model type name if the first character is not uppercase
if (!ctype_upper($type[0]))
{
$type = StringHelper::safe($type, 'F');
}
// Normalize the prefix if it's not 'Site' or 'Administrator'
if ($prefix !== 'Site' && $prefix !== 'Administrator')
{
$prefix = static::getPrefixFromModelPath($prefix);
}
// Instantiate and return the model using the MVCFactory
return Factory::getApplication()
->bootComponent($option)
->getMVCFactory()
->createModel($type, $prefix, $config);
}
/**
* Get the prefix from the model path
*
* @param string $path The model path
*
* @return string The prefix value
* @since 5.0.3
*/
private static function getPrefixFromModelPath(string $path): string
{
// Check if $path starts with JPATH_ADMINISTRATOR path
if (str_starts_with($path, JPATH_ADMINISTRATOR . '/components/'))
{
return 'Administrator';
}
// Check if $path starts with JPATH_SITE path
elseif (str_starts_with($path, JPATH_SITE . '/components/'))
{
return 'Site';
}
return 'Administrator';
}
}

View File

@ -22,57 +22,6 @@
*/
protected static array $params = [];
/**
* Sets a parameter value for the given target in the specified option's params.
* If no option is provided, it falls back to the default option.
*
* This method updates the parameters for a given extension in the database,
* only if the new value differs from the existing one.
*
* @param string $target The parameter name to be updated.
* @param mixed $value The value to set for the parameter.
* @param string|null $option The optional extension element name. Defaults to null, which will use the default option.
*
* @return mixed The previous value of the parameter before it was updated.
* @since 5.0.3
*/
public static function setParams(string $target, $value, ?string $option = null)
{
// Ensure that an option is specified, defaulting to the system's option if not provided.
if (empty($option))
{
$option = static::getOption();
}
// Retrieve current parameters for the specified option.
$params = static::getParams($option);
// Get the current value of the target parameter.
$was = $params->get($target, null);
// Only proceed if the new value differs from the current value.
if ($was !== $value)
{
// Update the parameter value.
$params->set($target, $value);
// Obtain a database connection instance.
$db = Factory::getDBO();
$query = $db->getQuery(true);
// Build and execute the query to update the parameters in the database.
$query->update('#__extensions AS a')
->set('a.params = ' . $db->quote((string) $params))
->where('a.element = ' . $db->quote((string) $option));
$db->setQuery($query);
$db->execute();
}
// Return the previous value of the parameter.
return $was;
}
/**
* Gets the parameter object for the component
*
@ -87,16 +36,16 @@
// check that we have an option
if (empty($option))
{
$option = static::getOption();
$option = self::getOption();
}
// get global value
if (!isset(static::$params[$option]) || !static::$params[$option] instanceof Registry)
if (!isset(self::$params[$option]) || !self::$params[$option] instanceof Registry)
{
static::$params[$option] = ComponentHelper::getParams($option);
self::$params[$option] = ComponentHelper::getParams($option);
}
return static::$params[$option];
return self::$params[$option];
}
/**
@ -109,7 +58,7 @@
*/
public static function setOption(?string $option): void
{
static::$option = $option;
self::$option = $option;
}
/**
@ -122,13 +71,13 @@
*/
public static function getOption(?string $default = 'empty'): ?string
{
if (empty(static::$option))
if (empty(self::$option))
{
// get the option from the url input
static::$option = (new Input)->getString('option', null);
self::$option = (new Input)->getString('option', null);
}
if (empty(static::$option))
if (empty(self::$option))
{
$app = Factory::getApplication();
@ -136,16 +85,16 @@
if (method_exists($app, 'getInput'))
{
// get the option from the application
static::$option = $app->getInput()->getCmd('option', $default);
self::$option = $app->getInput()->getCmd('option', $default);
}
else
{
// Use the default value if getInput method does not exist
static::$option = $default;
self::$option = $default;
}
}
return static::$option;
return self::$option;
}
/**
@ -162,7 +111,7 @@
// check that we have an option
if (empty($option))
{
$option = static::getOption();
$option = self::getOption();
}
// option with com_
if (is_string($option) && strpos($option, 'com_') === 0)
@ -187,7 +136,7 @@
{
// check that we have an option
// and get the code name from it
if (($code_name = static::getCode($option, null)) !== null)
if (($code_name = self::getCode($option, null)) !== null)
{
// we build the helper class name
$helper_name = '\\' . \ucfirst($code_name) . 'Helper';
@ -199,7 +148,7 @@
}
// try loading namespace
if (($namespace = static::getNamespace($option)) !== null)
if (($namespace = self::getNamespace($option)) !== null)
{
$name = \ucfirst($code_name) . 'Helper';
$namespace_helper = '\\' . $namespace . '\Administrator\Helper\\' . NamespaceHelper::safeSegment($name); // TODO target site or admin locations not just admin...
@ -225,7 +174,7 @@
*/
public static function getNamespace(?string $option = null): ?string
{
$manifest = static::getManifest($option);
$manifest = self::getManifest($option);
return $manifest->namespace ?? null;
}
@ -243,13 +192,13 @@
public static function getManifest(?string $option = null): ?object
{
if ($option === null
&& ($option = static::getOption($option)) === null)
&& ($option = self::getOption($option)) === null)
{
return null;
}
// get global manifest_cache values
if (!isset(static::$manifest[$option]))
if (!isset(self::$manifest[$option]))
{
$db = Factory::getDbo();
$query = $db->getQuery(true);
@ -263,14 +212,14 @@
try {
$manifest = $db->loadResult();
static::$manifest[$option] = json_decode($manifest);
self::$manifest[$option] = json_decode($manifest);
} catch (\Exception $e) {
// Handle the database error appropriately.
static::$manifest[$option] = null;
self::$manifest[$option] = null;
}
}
return static::$manifest[$option];
return self::$manifest[$option];
}
/**
@ -286,7 +235,7 @@
public static function methodExists(string $method, ?string $option = null): bool
{
// get the helper class
return ($helper = static::get($option, null)) !== null &&
return ($helper = self::get($option, null)) !== null &&
method_exists($helper, $method);
}
@ -303,7 +252,7 @@
public static function _(string $method, array $arguments = [], ?string $option = null)
{
// get the helper class
if (($helper = static::get($option, null)) !== null &&
if (($helper = self::get($option, null)) !== null &&
method_exists($helper, $method))
{
// we know this is not ideal...
@ -314,75 +263,3 @@
return null;
}
/**
* Returns a Model object based on the specified type, prefix, and configuration.
*
* @param string $type The model type to instantiate. Must not be empty.
* @param string $prefix Prefix for the model class name. Optional, defaults to 'Administrator'.
* @param string|null $option The component option. Optional, defaults to the component's option.
* @param array $config Configuration array for the model. Optional, defaults to an empty array.
*
* @return BaseDatabaseModel The instantiated model object.
*
* @throws \InvalidArgumentException If the $type parameter is empty.
* @throws \Exception For other errors that may occur during model creation.
*
* @since 5.0.3
*/
public static function getModel(string $type, string $prefix = 'Administrator',
?string $option = null, array $config = []): BaseDatabaseModel
{
// Ensure the $type parameter is not empty
if (empty($type))
{
throw new \InvalidArgumentException('The $type parameter cannot be empty when calling Component Helper getModel method.');
}
// Ensure the $option parameter is set, defaulting to the component's option if not provided
if (empty($option))
{
$option = static::getOption();
}
// Normalize the model type name if the first character is not uppercase
if (!ctype_upper($type[0]))
{
$type = StringHelper::safe($type, 'F');
}
// Normalize the prefix if it's not 'Site' or 'Administrator'
if ($prefix !== 'Site' && $prefix !== 'Administrator')
{
$prefix = static::getPrefixFromModelPath($prefix);
}
// Instantiate and return the model using the MVCFactory
return Factory::getApplication()
->bootComponent($option)
->getMVCFactory()
->createModel($type, $prefix, $config);
}
/**
* Get the prefix from the model path
*
* @param string $path The model path
*
* @return string The prefix value
* @since 5.0.3
*/
private static function getPrefixFromModelPath(string $path): string
{
// Check if $path starts with JPATH_ADMINISTRATOR path
if (str_starts_with($path, JPATH_ADMINISTRATOR . '/components/'))
{
return 'Administrator';
}
// Check if $path starts with JPATH_SITE path
elseif (str_starts_with($path, JPATH_SITE . '/components/'))
{
return 'Site';
}
return 'Administrator';
}

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