forked from joomla/super-powers
Compare commits
17 Commits
Author | SHA1 | Date | |
---|---|---|---|
44d1649eb0 | |||
e3096c796e | |||
98710c7fbd | |||
9eba4b338f | |||
ab9fb353ba | |||
1a74439a89 | |||
7effb3035a | |||
972f531ed3 | |||
7096370b60 | |||
7ce368db75 | |||
43edf4dee7 | |||
492bab1f36 | |||
8c8f4a0b58 | |||
25b4ae4215 | |||
a980aa9f81 | |||
d2d0222c5a | |||
bfba10e61e |
45
README.md
45
README.md
@ -68,7 +68,8 @@ This repository contains an index (see below) of all the approved powers within
|
||||
- **interface Registryinterface** | [Details](src/64e291c2-11f1-423d-a44d-837cc12cc017) | [Code](src/64e291c2-11f1-423d-a44d-837cc12cc017/code.php) | [Settings](src/64e291c2-11f1-423d-a44d-837cc12cc017/settings.json) | SPK: `Super---64e291c2_11f1_423d_a44d_837cc12cc017---Power`
|
||||
- **interface SchemaCheckerInterface** | [Details](src/b6e9854c-3672-42ec-8843-26c24b4635bd) | [Code](src/b6e9854c-3672-42ec-8843-26c24b4635bd/code.php) | [Settings](src/b6e9854c-3672-42ec-8843-26c24b4635bd/settings.json) | SPK: `Super---b6e9854c_3672_42ec_8843_26c24b4635bd---Power`
|
||||
- **interface SchemaInterface** | [Details](src/4dd11b9b-3c64-460b-aaa6-62ba467db7aa) | [Code](src/4dd11b9b-3c64-460b-aaa6-62ba467db7aa/code.php) | [Settings](src/4dd11b9b-3c64-460b-aaa6-62ba467db7aa/settings.json) | SPK: `Super---4dd11b9b_3c64_460b_aaa6_62ba467db7aa---Power`
|
||||
- **interface Tableinterface** | [Details](src/2da6d6c4-eb29-4d69-8bc2-36d96e916adf) | [Code](src/2da6d6c4-eb29-4d69-8bc2-36d96e916adf/code.php) | [Settings](src/2da6d6c4-eb29-4d69-8bc2-36d96e916adf/settings.json) | SPK: `Super---2da6d6c4_eb29_4d69_8bc2_36d96e916adf---Power`
|
||||
- **interface TableInterface** | [Details](src/2da6d6c4-eb29-4d69-8bc2-36d96e916adf) | [Code](src/2da6d6c4-eb29-4d69-8bc2-36d96e916adf/code.php) | [Settings](src/2da6d6c4-eb29-4d69-8bc2-36d96e916adf/settings.json) | SPK: `Super---2da6d6c4_eb29_4d69_8bc2_36d96e916adf---Power`
|
||||
- **interface TableValidatorInterface** | [Details](src/feb3affa-5102-4307-93db-04525f4c66f0) | [Code](src/feb3affa-5102-4307-93db-04525f4c66f0/code.php) | [Settings](src/feb3affa-5102-4307-93db-04525f4c66f0/settings.json) | SPK: `Super---feb3affa_5102_4307_93db_04525f4c66f0---Power`
|
||||
- **interface UpdateInterface** | [Details](src/7179fde6-1e51-4b51-8545-7ca18f74a0f4) | [Code](src/7179fde6-1e51-4b51-8545-7ca18f74a0f4/code.php) | [Settings](src/7179fde6-1e51-4b51-8545-7ca18f74a0f4/settings.json) | SPK: `Super---7179fde6_1e51_4b51_8545_7ca18f74a0f4---Power`
|
||||
- **Namespace**: [VDM\Joomla\Model](#vdm-joomla-model)
|
||||
|
||||
@ -85,6 +86,7 @@ This repository contains an index (see below) of all the approved powers within
|
||||
- **abstract class ArrayHelper** | [Details](src/0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a) | [Code](src/0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a/code.php) | [Settings](src/0a59c65c-9daf-4bc9-baf4-e063ff9e6a8a/settings.json) | SPK: `Super---0a59c65c_9daf_4bc9_baf4_e063ff9e6a8a---Power`
|
||||
- **abstract class Base64Helper** | [Details](src/64a6ff6c-069c-4a11-a76b-db5e36c27690) | [Code](src/64a6ff6c-069c-4a11-a76b-db5e36c27690/code.php) | [Settings](src/64a6ff6c-069c-4a11-a76b-db5e36c27690/settings.json) | SPK: `Super---64a6ff6c_069c_4a11_a76b_db5e36c27690---Power`
|
||||
- **abstract class ClassHelper** | [Details](src/13c2cac1-a70d-42d7-99fc-eb7ac3443069) | [Code](src/13c2cac1-a70d-42d7-99fc-eb7ac3443069/code.php) | [Settings](src/13c2cac1-a70d-42d7-99fc-eb7ac3443069/settings.json) | SPK: `Super---13c2cac1_a70d_42d7_99fc_eb7ac3443069---Power`
|
||||
- **abstract class DateHelper** | [Details](src/993fe913-8e36-4800-a5f7-544aa728ee48) | [Code](src/993fe913-8e36-4800-a5f7-544aa728ee48/code.php) | [Settings](src/993fe913-8e36-4800-a5f7-544aa728ee48/settings.json) | SPK: `Super---993fe913_8e36_4800_a5f7_544aa728ee48---Power`
|
||||
- **abstract class FileHelper** | [Details](src/a223b31e-ea1d-4cdf-92ae-5f9becffaff0) | [Code](src/a223b31e-ea1d-4cdf-92ae-5f9becffaff0/code.php) | [Settings](src/a223b31e-ea1d-4cdf-92ae-5f9becffaff0/settings.json) | SPK: `Super---a223b31e_ea1d_4cdf_92ae_5f9becffaff0---Power`
|
||||
- **abstract class FormHelper** | [Details](src/1198aecf-84c6-45d2-aea8-d531aa4afdfa) | [Code](src/1198aecf-84c6-45d2-aea8-d531aa4afdfa/code.php) | [Settings](src/1198aecf-84c6-45d2-aea8-d531aa4afdfa/settings.json) | SPK: `Super---1198aecf_84c6_45d2_aea8_d531aa4afdfa---Power`
|
||||
- **abstract class GetHelper** | [Details](src/db87c339-5bb6-4291-a7ef-2c48ea1b06bc) | [Code](src/db87c339-5bb6-4291-a7ef-2c48ea1b06bc/code.php) | [Settings](src/db87c339-5bb6-4291-a7ef-2c48ea1b06bc/settings.json) | SPK: `Super---db87c339_5bb6_4291_a7ef_2c48ea1b06bc---Power`
|
||||
@ -94,8 +96,12 @@ This repository contains an index (see below) of all the approved powers within
|
||||
- **abstract class MathHelper** | [Details](src/152c8793-8b75-4715-996a-257b9f65451c) | [Code](src/152c8793-8b75-4715-996a-257b9f65451c/code.php) | [Settings](src/152c8793-8b75-4715-996a-257b9f65451c/settings.json) | SPK: `Super---152c8793_8b75_4715_996a_257b9f65451c---Power`
|
||||
- **abstract class MimeHelper** | [Details](src/f11dc790-713e-4706-9a85-a318ed3ad56e) | [Code](src/f11dc790-713e-4706-9a85-a318ed3ad56e/code.php) | [Settings](src/f11dc790-713e-4706-9a85-a318ed3ad56e/settings.json) | SPK: `Super---f11dc790_713e_4706_9a85_a318ed3ad56e---Power`
|
||||
- **abstract class ObjectHelper** | [Details](src/91004529-94a9-4590-b842-e7c6b624ecf5) | [Code](src/91004529-94a9-4590-b842-e7c6b624ecf5/code.php) | [Settings](src/91004529-94a9-4590-b842-e7c6b624ecf5/settings.json) | SPK: `Super---91004529_94a9_4590_b842_e7c6b624ecf5---Power`
|
||||
- **abstract class SessionHelper** | [Details](src/47a63728-cd5d-4d53-99cf-2409bd1c744c) | [Code](src/47a63728-cd5d-4d53-99cf-2409bd1c744c/code.php) | [Settings](src/47a63728-cd5d-4d53-99cf-2409bd1c744c/settings.json) | SPK: `Super---47a63728_cd5d_4d53_99cf_2409bd1c744c---Power`
|
||||
- **abstract class StringHelper** | [Details](src/1f28cb53-60d9-4db1-b517-3c7dc6b429ef) | [Code](src/1f28cb53-60d9-4db1-b517-3c7dc6b429ef/code.php) | [Settings](src/1f28cb53-60d9-4db1-b517-3c7dc6b429ef/settings.json) | SPK: `Super---1f28cb53_60d9_4db1_b517_3c7dc6b429ef---Power`
|
||||
- **abstract class UploadHelper** | [Details](src/d7600b43-771a-4747-9f5d-952765721799) | [Code](src/d7600b43-771a-4747-9f5d-952765721799/code.php) | [Settings](src/d7600b43-771a-4747-9f5d-952765721799/settings.json) | SPK: `Super---d7600b43_771a_4747_9f5d_952765721799---Power`
|
||||
- **Namespace**: [VDM\Joomla\Abstraction\Console](#vdm-joomla-abstraction-console)
|
||||
|
||||
- **abstract class Import** | [Details](src/85321deb-5c3a-401b-9ce1-039a746add51) | [Code](src/85321deb-5c3a-401b-9ce1-039a746add51/code.php) | [Settings](src/85321deb-5c3a-401b-9ce1-039a746add51/settings.json) | SPK: `Super---85321deb_5c3a_401b_9ce1_039a746add51---Power`
|
||||
- **Namespace**: [VDM\Joomla\Abstraction\Remote](#vdm-joomla-abstraction-remote)
|
||||
|
||||
- **abstract class Get** | [Details](src/728ee726-3f0f-4762-899d-f8c9430cee58) | [Code](src/728ee726-3f0f-4762-899d-f8c9430cee58/code.php) | [Settings](src/728ee726-3f0f-4762-899d-f8c9430cee58/settings.json) | SPK: `Super---728ee726_3f0f_4762_899d_f8c9430cee58---Power`
|
||||
@ -110,10 +116,39 @@ This repository contains an index (see below) of all the approved powers within
|
||||
- **final class Handler** | [Details](src/4144ad3b-2ad5-401f-af0c-a3d856c1e688) | [Code](src/4144ad3b-2ad5-401f-af0c-a3d856c1e688/code.php) | [Settings](src/4144ad3b-2ad5-401f-af0c-a3d856c1e688/settings.json) | SPK: `Super---4144ad3b_2ad5_401f_af0c_a3d856c1e688---Power`
|
||||
- **final class Manager** | [Details](src/67a5e0ca-0ff0-4979-9b41-da0b09988016) | [Code](src/67a5e0ca-0ff0-4979-9b41-da0b09988016/code.php) | [Settings](src/67a5e0ca-0ff0-4979-9b41-da0b09988016/settings.json) | SPK: `Super---67a5e0ca_0ff0_4979_9b41_da0b09988016---Power`
|
||||
- **final class Type** | [Details](src/12a2a8de-a893-4dbb-a53d-b52de4f6cb0e) | [Code](src/12a2a8de-a893-4dbb-a53d-b52de4f6cb0e/code.php) | [Settings](src/12a2a8de-a893-4dbb-a53d-b52de4f6cb0e/settings.json) | SPK: `Super---12a2a8de_a893_4dbb_a53d_b52de4f6cb0e---Power`
|
||||
- **Namespace**: [VDM\Joomla\Componentbuilder\Import](#vdm-joomla-componentbuilder-import)
|
||||
|
||||
- **abstract class Factory** | [Details](src/ff8d5fdb-2d1f-4178-bd18-a43b8efd1068) | [Code](src/ff8d5fdb-2d1f-4178-bd18-a43b8efd1068/code.php) | [Settings](src/ff8d5fdb-2d1f-4178-bd18-a43b8efd1068/settings.json) | SPK: `Super---ff8d5fdb_2d1f_4178_bd18_a43b8efd1068---Power`
|
||||
- **final class Assessor** | [Details](src/19a66b48-620c-439b-ab8a-3c0d43e040c3) | [Code](src/19a66b48-620c-439b-ab8a-3c0d43e040c3/code.php) | [Settings](src/19a66b48-620c-439b-ab8a-3c0d43e040c3/settings.json) | SPK: `Super---19a66b48_620c_439b_ab8a_3c0d43e040c3---Power`
|
||||
- **final class Item** | [Details](src/68a0f9af-265a-4db1-bae9-a4e4531f94d7) | [Code](src/68a0f9af-265a-4db1-bae9-a4e4531f94d7/code.php) | [Settings](src/68a0f9af-265a-4db1-bae9-a4e4531f94d7/settings.json) | SPK: `Super---68a0f9af_265a_4db1_bae9_a4e4531f94d7---Power`
|
||||
- **final class Mapper** | [Details](src/90b48ea8-0930-48d1-869a-bce9c901589c) | [Code](src/90b48ea8-0930-48d1-869a-bce9c901589c/code.php) | [Settings](src/90b48ea8-0930-48d1-869a-bce9c901589c/settings.json) | SPK: `Super---90b48ea8_0930_48d1_869a_bce9c901589c---Power`
|
||||
- **final class Message** | [Details](src/eef6ffc2-2af0-4336-958f-e0b9cf7c4ad0) | [Code](src/eef6ffc2-2af0-4336-958f-e0b9cf7c4ad0/code.php) | [Settings](src/eef6ffc2-2af0-4336-958f-e0b9cf7c4ad0/settings.json) | SPK: `Super---eef6ffc2_2af0_4336_958f_e0b9cf7c4ad0---Power`
|
||||
- **final class Row** | [Details](src/afb5b891-7130-422a-b389-1934b0e4fc48) | [Code](src/afb5b891-7130-422a-b389-1934b0e4fc48/code.php) | [Settings](src/afb5b891-7130-422a-b389-1934b0e4fc48/settings.json) | SPK: `Super---afb5b891_7130_422a_b389_1934b0e4fc48---Power`
|
||||
- **final class Status** | [Details](src/d2a859ac-3f2a-4f69-a77f-f118b2e0a459) | [Code](src/d2a859ac-3f2a-4f69-a77f-f118b2e0a459/code.php) | [Settings](src/d2a859ac-3f2a-4f69-a77f-f118b2e0a459/settings.json) | SPK: `Super---d2a859ac_3f2a_4f69_a77f_f118b2e0a459---Power`
|
||||
- **class Data** | [Details](src/05f23281-58e3-482e-be42-2dc1355ef4ea) | [Code](src/05f23281-58e3-482e-be42-2dc1355ef4ea/code.php) | [Settings](src/05f23281-58e3-482e-be42-2dc1355ef4ea/settings.json) | SPK: `Super---05f23281_58e3_482e_be42_2dc1355ef4ea---Power`
|
||||
- **Namespace**: [VDM\Joomla\Componentbuilder\Interfaces](#vdm-joomla-componentbuilder-interfaces)
|
||||
|
||||
- **interface ImportAssessorInterface** | [Details](src/57c00d53-5581-4fd1-b3ea-080422710243) | [Code](src/57c00d53-5581-4fd1-b3ea-080422710243/code.php) | [Settings](src/57c00d53-5581-4fd1-b3ea-080422710243/settings.json) | SPK: `Super---57c00d53_5581_4fd1_b3ea_080422710243---Power`
|
||||
- **interface ImportItemInterface** | [Details](src/53f55e5b-63cb-49e7-b1e6-33e7a9f97856) | [Code](src/53f55e5b-63cb-49e7-b1e6-33e7a9f97856/code.php) | [Settings](src/53f55e5b-63cb-49e7-b1e6-33e7a9f97856/settings.json) | SPK: `Super---53f55e5b_63cb_49e7_b1e6_33e7a9f97856---Power`
|
||||
- **interface ImportMapperInterface** | [Details](src/250a7272-9ae1-4c63-a058-26bad9ad6f70) | [Code](src/250a7272-9ae1-4c63-a058-26bad9ad6f70/code.php) | [Settings](src/250a7272-9ae1-4c63-a058-26bad9ad6f70/settings.json) | SPK: `Super---250a7272_9ae1_4c63_a058_26bad9ad6f70---Power`
|
||||
- **interface ImportMessageInterface** | [Details](src/23ad6e72-1b82-40fb-836c-50da690bb174) | [Code](src/23ad6e72-1b82-40fb-836c-50da690bb174/code.php) | [Settings](src/23ad6e72-1b82-40fb-836c-50da690bb174/settings.json) | SPK: `Super---23ad6e72_1b82_40fb_836c_50da690bb174---Power`
|
||||
- **interface ImportRowInterface** | [Details](src/3d3ec064-9867-41e6-a48a-964c15d753aa) | [Code](src/3d3ec064-9867-41e6-a48a-964c15d753aa/code.php) | [Settings](src/3d3ec064-9867-41e6-a48a-964c15d753aa/settings.json) | SPK: `Super---3d3ec064_9867_41e6_a48a_964c15d753aa---Power`
|
||||
- **interface ImportStatusInterface** | [Details](src/0e44d149-4863-47ec-8f0f-6a821ab3e77f) | [Code](src/0e44d149-4863-47ec-8f0f-6a821ab3e77f/code.php) | [Settings](src/0e44d149-4863-47ec-8f0f-6a821ab3e77f/settings.json) | SPK: `Super---0e44d149_4863_47ec_8f0f_6a821ab3e77f---Power`
|
||||
- **Namespace**: [VDM\Joomla\Componentbuilder\Service](#vdm-joomla-componentbuilder-service)
|
||||
|
||||
- **class Spreadsheet** | [Details](src/c4a188de-ad78-4a6d-9d5b-01866846d701) | [Code](src/c4a188de-ad78-4a6d-9d5b-01866846d701/code.php) | [Settings](src/c4a188de-ad78-4a6d-9d5b-01866846d701/settings.json) | SPK: `Super---c4a188de_ad78_4a6d_9d5b_01866846d701---Power`
|
||||
- **Namespace**: [VDM\Joomla\Componentbuilder\Spreadsheet](#vdm-joomla-componentbuilder-spreadsheet)
|
||||
|
||||
- **final class ChunkReadFilter** | [Details](src/9ae018a5-9064-40ed-ad69-9c1ed2a459f5) | [Code](src/9ae018a5-9064-40ed-ad69-9c1ed2a459f5/code.php) | [Settings](src/9ae018a5-9064-40ed-ad69-9c1ed2a459f5/settings.json) | SPK: `Super---9ae018a5_9064_40ed_ad69_9c1ed2a459f5---Power`
|
||||
- **final class Exporter** | [Details](src/e250638e-4a50-41f9-9172-db3e7f174d26) | [Code](src/e250638e-4a50-41f9-9172-db3e7f174d26/code.php) | [Settings](src/e250638e-4a50-41f9-9172-db3e7f174d26/settings.json) | SPK: `Super---e250638e_4a50_41f9_9172_db3e7f174d26---Power`
|
||||
- **final class FileReader** | [Details](src/dcb0e061-f337-44f7-87f2-f5c5fb9ce917) | [Code](src/dcb0e061-f337-44f7-87f2-f5c5fb9ce917/code.php) | [Settings](src/dcb0e061-f337-44f7-87f2-f5c5fb9ce917/settings.json) | SPK: `Super---dcb0e061_f337_44f7_87f2_f5c5fb9ce917---Power`
|
||||
- **final class Header** | [Details](src/fd3f322a-082d-4579-93ad-3352c5adfc71) | [Code](src/fd3f322a-082d-4579-93ad-3352c5adfc71/code.php) | [Settings](src/fd3f322a-082d-4579-93ad-3352c5adfc71/settings.json) | SPK: `Super---fd3f322a_082d_4579_93ad_3352c5adfc71---Power`
|
||||
- **final class Importer** | [Details](src/c4169332-3914-400e-b861-972b2d465963) | [Code](src/c4169332-3914-400e-b861-972b2d465963/code.php) | [Settings](src/c4169332-3914-400e-b861-972b2d465963/settings.json) | SPK: `Super---c4169332_3914_400e_b861_972b2d465963---Power`
|
||||
- **Namespace**: [VDM\Joomla\Componentbuilder\Table](#vdm-joomla-componentbuilder-table)
|
||||
|
||||
- **final class Schema** | [Details](src/b3d2ec33-76d4-4c3b-bb2c-86ac14a221ce) | [Code](src/b3d2ec33-76d4-4c3b-bb2c-86ac14a221ce/code.php) | [Settings](src/b3d2ec33-76d4-4c3b-bb2c-86ac14a221ce/settings.json) | SPK: `Super---b3d2ec33_76d4_4c3b_bb2c_86ac14a221ce---Power`
|
||||
- **final class SchemaChecker** | [Details](src/709d7294-9a43-46e2-b64e-d16a16f0eab1) | [Code](src/709d7294-9a43-46e2-b64e-d16a16f0eab1/code.php) | [Settings](src/709d7294-9a43-46e2-b64e-d16a16f0eab1/settings.json) | SPK: `Super---709d7294_9a43_46e2_b64e_d16a16f0eab1---Power`
|
||||
- **final class Validator** | [Details](src/79fd4f39-824d-4ab6-936d-959705ff24ec) | [Code](src/79fd4f39-824d-4ab6-936d-959705ff24ec/code.php) | [Settings](src/79fd4f39-824d-4ab6-936d-959705ff24ec/settings.json) | SPK: `Super---79fd4f39_824d_4ab6_936d_959705ff24ec---Power`
|
||||
- **Namespace**: [VDM\Joomla\Componentbuilder\Utilities](#vdm-joomla-componentbuilder-utilities)
|
||||
|
||||
- **abstract class UserHelper** | [Details](src/7832a726-87b6-4e95-887e-7b725d3fab8f) | [Code](src/7832a726-87b6-4e95-887e-7b725d3fab8f/code.php) | [Settings](src/7832a726-87b6-4e95-887e-7b725d3fab8f/settings.json) | SPK: `Super---7832a726_87b6_4e95_887e_7b725d3fab8f---Power`
|
||||
@ -168,6 +203,14 @@ This repository contains an index (see below) of all the approved powers within
|
||||
- **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`
|
||||
|
45
src/05f23281-58e3-482e-be42-2dc1355ef4ea/README.md
Normal file
45
src/05f23281-58e3-482e-be42-2dc1355ef4ea/README.md
Normal file
@ -0,0 +1,45 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class Data (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Import**
|
||||
> extends: **Registry**
|
||||
|
||||
```uml
|
||||
@startuml
|
||||
class Data #Gold {
|
||||
}
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
|
||||
|
||||
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
|
||||
|
||||
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
|
||||
|
||||
To add this specific Power to your project in JCB:
|
||||
|
||||
> simply use this SPK
|
||||
```
|
||||
Super---05f23281_58e3_482e_be42_2dc1355ef4ea---Power
|
||||
```
|
||||
> remember to replace the `---` with `___` to activate this Power in your code
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
26
src/05f23281-58e3-482e-be42-2dc1355ef4ea/code.php
Normal file
26
src/05f23281-58e3-482e-be42-2dc1355ef4ea/code.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Import;
|
||||
|
||||
|
||||
use VDM\Joomla\Abstraction\Registry;
|
||||
|
||||
|
||||
/**
|
||||
* Import Data Registry
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Data extends Registry
|
||||
{
|
||||
}
|
||||
|
1
src/05f23281-58e3-482e-be42-2dc1355ef4ea/code.power
Normal file
1
src/05f23281-58e3-482e-be42-2dc1355ef4ea/code.power
Normal file
@ -0,0 +1 @@
|
||||
###CODEPOWER###
|
19
src/05f23281-58e3-482e-be42-2dc1355ef4ea/settings.json
Normal file
19
src/05f23281-58e3-482e-be42-2dc1355ef4ea/settings.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "7e822c03-1b20-41d1-9427-f5b8d5836af7",
|
||||
"guid": "05f23281-58e3-482e-be42-2dc1355ef4ea",
|
||||
"implements": null,
|
||||
"load_selection": null,
|
||||
"name": "Data",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Import.Data",
|
||||
"type": "class",
|
||||
"use_selection": null,
|
||||
"extendsinterfaces": null,
|
||||
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Import.Data",
|
||||
"description": "Import Data Registry\r\n\r\n@since 3.2.0",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "",
|
||||
"composer": ""
|
||||
}
|
89
src/0e44d149-4863-47ec-8f0f-6a821ab3e77f/README.md
Normal file
89
src/0e44d149-4863-47ec-8f0f-6a821ab3e77f/README.md
Normal file
@ -0,0 +1,89 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# interface ImportStatusInterface (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Interfaces**
|
||||
|
||||
```uml
|
||||
@startuml
|
||||
interface ImportStatusInterface #Lavender {
|
||||
+ set(int $status, string $guid) : void
|
||||
+ table(string $table) : self
|
||||
+ field(string $fieldName) : self
|
||||
+ getTable() : string
|
||||
+ getField() : string
|
||||
}
|
||||
|
||||
note right of ImportStatusInterface::set
|
||||
Updates the status in the database.
|
||||
This method updates the import status in the database based on the result of the import process.
|
||||
Status codes:
|
||||
- 2: Being Processed.
|
||||
- 3: Import completed successfully.
|
||||
- 4: Import completed with errors.
|
||||
|
||||
since: 3.2.2
|
||||
return: void
|
||||
end note
|
||||
|
||||
note right of ImportStatusInterface::table
|
||||
Set the current active table
|
||||
|
||||
since: 3.2.2
|
||||
return: self
|
||||
end note
|
||||
|
||||
note right of ImportStatusInterface::field
|
||||
Set the current target status field name
|
||||
|
||||
since: 3.2.2
|
||||
return: self
|
||||
end note
|
||||
|
||||
note right of ImportStatusInterface::getTable
|
||||
Get the current active table
|
||||
|
||||
since: 3.2.2
|
||||
return: string
|
||||
end note
|
||||
|
||||
note right of ImportStatusInterface::getField
|
||||
Get the current target status field name
|
||||
|
||||
since: 3.2.2
|
||||
return: string
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
|
||||
|
||||
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
|
||||
|
||||
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
|
||||
|
||||
To add this specific Power to your project in JCB:
|
||||
|
||||
> simply use this SPK
|
||||
```
|
||||
Super---0e44d149_4863_47ec_8f0f_6a821ab3e77f---Power
|
||||
```
|
||||
> remember to replace the `---` with `___` to activate this Power in your code
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
75
src/0e44d149-4863-47ec-8f0f-6a821ab3e77f/code.php
Normal file
75
src/0e44d149-4863-47ec-8f0f-6a821ab3e77f/code.php
Normal file
@ -0,0 +1,75 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Interfaces;
|
||||
|
||||
|
||||
/**
|
||||
* Import Status Interface
|
||||
*
|
||||
* @since 3.2.2
|
||||
*/
|
||||
interface ImportStatusInterface
|
||||
{
|
||||
/**
|
||||
* Updates the status in the database.
|
||||
*
|
||||
* This method updates the import status in the database based on the result of the import process.
|
||||
* Status codes:
|
||||
* - 2: Being Processed.
|
||||
* - 3: Import completed successfully.
|
||||
* - 4: Import completed with errors.
|
||||
*
|
||||
* @param int $status The status code to set for the import (2 => processing, 3 => success, 4 => errors).
|
||||
* @param string $guid The target import GUID
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.2
|
||||
*/
|
||||
public function set(int $status, string $guid): void;
|
||||
|
||||
/**
|
||||
* Set the current active table
|
||||
*
|
||||
* @param string $table The table that should be active
|
||||
*
|
||||
* @return self
|
||||
* @since 3.2.2
|
||||
*/
|
||||
public function table(string $table): self;
|
||||
|
||||
/**
|
||||
* Set the current target status field name
|
||||
*
|
||||
* @param string $fieldName The field name where the status is set
|
||||
*
|
||||
* @return self
|
||||
* @since 3.2.2
|
||||
*/
|
||||
public function field(string $fieldName): self;
|
||||
|
||||
/**
|
||||
* Get the current active table
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.2
|
||||
*/
|
||||
public function getTable(): string;
|
||||
|
||||
/**
|
||||
* Get the current target status field name
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.2
|
||||
*/
|
||||
public function getField(): string;
|
||||
}
|
||||
|
52
src/0e44d149-4863-47ec-8f0f-6a821ab3e77f/code.power
Normal file
52
src/0e44d149-4863-47ec-8f0f-6a821ab3e77f/code.power
Normal file
@ -0,0 +1,52 @@
|
||||
/**
|
||||
* Updates the status in the database.
|
||||
*
|
||||
* This method updates the import status in the database based on the result of the import process.
|
||||
* Status codes:
|
||||
* - 2: Being Processed.
|
||||
* - 3: Import completed successfully.
|
||||
* - 4: Import completed with errors.
|
||||
*
|
||||
* @param int $status The status code to set for the import (2 => processing, 3 => success, 4 => errors).
|
||||
* @param string $guid The target import GUID
|
||||
*
|
||||
* @return void
|
||||
* @since 3.2.2
|
||||
*/
|
||||
public function set(int $status, string $guid): void;
|
||||
|
||||
/**
|
||||
* Set the current active table
|
||||
*
|
||||
* @param string $table The table that should be active
|
||||
*
|
||||
* @return self
|
||||
* @since 3.2.2
|
||||
*/
|
||||
public function table(string $table): self;
|
||||
|
||||
/**
|
||||
* Set the current target status field name
|
||||
*
|
||||
* @param string $fieldName The field name where the status is set
|
||||
*
|
||||
* @return self
|
||||
* @since 3.2.2
|
||||
*/
|
||||
public function field(string $fieldName): self;
|
||||
|
||||
/**
|
||||
* Get the current active table
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.2
|
||||
*/
|
||||
public function getTable(): string;
|
||||
|
||||
/**
|
||||
* Get the current target status field name
|
||||
*
|
||||
* @return string
|
||||
* @since 3.2.2
|
||||
*/
|
||||
public function getField(): string;
|
19
src/0e44d149-4863-47ec-8f0f-6a821ab3e77f/settings.json
Normal file
19
src/0e44d149-4863-47ec-8f0f-6a821ab3e77f/settings.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "",
|
||||
"guid": "0e44d149-4863-47ec-8f0f-6a821ab3e77f",
|
||||
"implements": null,
|
||||
"load_selection": null,
|
||||
"name": "ImportStatusInterface",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "VDM.ImportStatusInterface",
|
||||
"type": "interface",
|
||||
"use_selection": null,
|
||||
"extendsinterfaces": null,
|
||||
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Interfaces.ImportStatusInterface",
|
||||
"description": "Import Status Interface\r\n\r\n@since 3.2.2",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "",
|
||||
"composer": ""
|
||||
}
|
60
src/0f3f7188-3e0d-4d1a-8dee-7f8026cb65a9/README.md
Normal file
60
src/0f3f7188-3e0d-4d1a-8dee-7f8026cb65a9/README.md
Normal file
@ -0,0 +1,60 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# interface ImportCliInterface (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Interfaces\Spreadsheet**
|
||||
|
||||
```uml
|
||||
@startuml
|
||||
interface ImportCliInterface #Lavender {
|
||||
+ data(object $import) : void
|
||||
+ message() : object
|
||||
}
|
||||
|
||||
note right of ImportCliInterface::data
|
||||
The trigger function called from the CLI to start the import on a spreadsheet
|
||||
|
||||
since: 5.0.2
|
||||
return: void
|
||||
end note
|
||||
|
||||
note right of ImportCliInterface::message
|
||||
The message of the last import event
|
||||
|
||||
since: 5.0.2
|
||||
return: object
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
|
||||
|
||||
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
|
||||
|
||||
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
|
||||
|
||||
To add this specific Power to your project in JCB:
|
||||
|
||||
> simply use this SPK
|
||||
```
|
||||
Super---0f3f7188_3e0d_4d1a_8dee_7f8026cb65a9---Power
|
||||
```
|
||||
> remember to replace the `---` with `___` to activate this Power in your code
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
40
src/0f3f7188-3e0d-4d1a-8dee-7f8026cb65a9/code.php
Normal file
40
src/0f3f7188-3e0d-4d1a-8dee-7f8026cb65a9/code.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Interfaces\Spreadsheet;
|
||||
|
||||
|
||||
/**
|
||||
* Spreadsheet Import Cli Interface
|
||||
*
|
||||
* @since 3.2.2
|
||||
*/
|
||||
interface ImportCliInterface
|
||||
{
|
||||
/**
|
||||
* The trigger function called from the CLI to start the import on a spreadsheet
|
||||
*
|
||||
* @param object $import The spreadsheet data to import.
|
||||
*
|
||||
* @return void
|
||||
* @since 5.0.2
|
||||
*/
|
||||
public function data(object $import): void;
|
||||
|
||||
/**
|
||||
* The message of the last import event
|
||||
*
|
||||
* @return object
|
||||
* @since 5.0.2
|
||||
*/
|
||||
public function message(): object;
|
||||
}
|
||||
|
17
src/0f3f7188-3e0d-4d1a-8dee-7f8026cb65a9/code.power
Normal file
17
src/0f3f7188-3e0d-4d1a-8dee-7f8026cb65a9/code.power
Normal file
@ -0,0 +1,17 @@
|
||||
/**
|
||||
* The trigger function called from the CLI to start the import on a spreadsheet
|
||||
*
|
||||
* @param object $import The spreadsheet data to import.
|
||||
*
|
||||
* @return void
|
||||
* @since 5.0.2
|
||||
*/
|
||||
public function data(object $import): void;
|
||||
|
||||
/**
|
||||
* The message of the last import event
|
||||
*
|
||||
* @return object
|
||||
* @since 5.0.2
|
||||
*/
|
||||
public function message(): object;
|
19
src/0f3f7188-3e0d-4d1a-8dee-7f8026cb65a9/settings.json
Normal file
19
src/0f3f7188-3e0d-4d1a-8dee-7f8026cb65a9/settings.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "",
|
||||
"guid": "0f3f7188-3e0d-4d1a-8dee-7f8026cb65a9",
|
||||
"implements": null,
|
||||
"load_selection": null,
|
||||
"name": "ImportCliInterface",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Interfaces.Spreadsheet.ImportCliInterface",
|
||||
"type": "interface",
|
||||
"use_selection": null,
|
||||
"extendsinterfaces": null,
|
||||
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Interfaces.Spreadsheet.ImportCliInterface",
|
||||
"description": "Spreadsheet Import Cli Interface\r\n\r\n@since 3.2.2",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "",
|
||||
"composer": ""
|
||||
}
|
72
src/19a66b48-620c-439b-ab8a-3c0d43e040c3/README.md
Normal file
72
src/19a66b48-620c-439b-ab8a-3c0d43e040c3/README.md
Normal file
@ -0,0 +1,72 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# final class Assessor (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Import**
|
||||
|
||||
```uml
|
||||
@startuml
|
||||
class Assessor << (F,LightGreen) >> #RoyalBlue {
|
||||
# Data $data
|
||||
# Status $status
|
||||
# Message $message
|
||||
+ __construct(Data $data, Status $status, ...)
|
||||
+ evaluate(int $rowCounter, int $successCounter, ...) : void
|
||||
}
|
||||
|
||||
note right of Assessor::__construct
|
||||
Constructor.
|
||||
|
||||
since: 4.0.3
|
||||
|
||||
arguments:
|
||||
Data $data
|
||||
Status $status
|
||||
Message $message
|
||||
end note
|
||||
|
||||
note right of Assessor::evaluate
|
||||
Evaluates the import process and sets the success/error message based on the success rate.
|
||||
|
||||
since: 4.0.3
|
||||
return: void
|
||||
|
||||
arguments:
|
||||
int $rowCounter
|
||||
int $successCounter
|
||||
int $errorCounter
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
|
||||
|
||||
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
|
||||
|
||||
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
|
||||
|
||||
To add this specific Power to your project in JCB:
|
||||
|
||||
> simply use this SPK
|
||||
```
|
||||
Super---19a66b48_620c_439b_ab8a_3c0d43e040c3---Power
|
||||
```
|
||||
> remember to replace the `---` with `___` to activate this Power in your code
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
129
src/19a66b48-620c-439b-ab8a-3c0d43e040c3/code.php
Normal file
129
src/19a66b48-620c-439b-ab8a-3c0d43e040c3/code.php
Normal file
@ -0,0 +1,129 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
100
src/19a66b48-620c-439b-ab8a-3c0d43e040c3/code.power
Normal file
100
src/19a66b48-620c-439b-ab8a-3c0d43e040c3/code.power
Normal file
@ -0,0 +1,100 @@
|
||||
/**
|
||||
* The Data Class.
|
||||
*
|
||||
* @var Data
|
||||
* @since 4.0.3
|
||||
*/
|
||||
protected Data $data;
|
||||
|
||||
/**
|
||||
* The Import Status Class.
|
||||
*
|
||||
* @var Status
|
||||
* @since 4.0.3
|
||||
*/
|
||||
protected Status $status;
|
||||
|
||||
/**
|
||||
* The Import Message Class.
|
||||
*
|
||||
* @var Message
|
||||
* @since 4.0.3
|
||||
*/
|
||||
protected Message $message;
|
||||
|
||||
/**
|
||||
* Constants for defining the success threshold
|
||||
* Minimum success rate to consider the import successful
|
||||
*
|
||||
* @since 4.0.3
|
||||
*/
|
||||
private const SUCCESS_THRESHOLD = 0.80;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Data $data The Data Class.
|
||||
* @param Status $status The Import Status Class.
|
||||
* @param Message $message The Import Message Class.
|
||||
*
|
||||
* @since 4.0.3
|
||||
*/
|
||||
public function __construct(Data $data, Status $status, Message $message)
|
||||
{
|
||||
$this->data = $data;
|
||||
$this->status = $status;
|
||||
$this->message = $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Evaluates the import process and sets the success/error message based on the success rate.
|
||||
*
|
||||
* @param int $rowCounter Total number of rows processed.
|
||||
* @param int $successCounter Number of successfully processed rows.
|
||||
* @param int $errorCounter Number of rows that failed to process.
|
||||
*
|
||||
* @return void
|
||||
* @since 4.0.3
|
||||
*/
|
||||
public function evaluate(int $rowCounter, int $successCounter, int $errorCounter): void
|
||||
{
|
||||
// No rows processed case
|
||||
if ($rowCounter === 0)
|
||||
{
|
||||
$this->message->addError(Text::_('No rows were processed.'));
|
||||
|
||||
if (($guid = $this->data->get('import.guid')) !== null)
|
||||
{
|
||||
$this->status->set(4, $guid); // Status 4 => completed with errors
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
$successRate = $successCounter / $rowCounter;
|
||||
$errorRate = (1 - $successRate) * 100;
|
||||
$successPercentage = $successRate * 100;
|
||||
|
||||
// Determine appropriate message based on success rate
|
||||
if ($successRate >= self::SUCCESS_THRESHOLD)
|
||||
{
|
||||
$this->message->addSuccess(Text::sprintf('%d rows processed. Success rate: %.2f%%. Import successful!',
|
||||
$rowCounter,
|
||||
$successPercentage
|
||||
));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->message->addError(Text::sprintf('Import failed. %d rows processed with only %d successes. Error rate: %.2f%%.',
|
||||
$rowCounter,
|
||||
$successCounter,
|
||||
$errorRate
|
||||
));
|
||||
}
|
||||
|
||||
if (($guid = $this->data->get('import.guid')) !== null)
|
||||
{
|
||||
// Update import status based on success rate
|
||||
$importStatus = ($successPercentage == 100) ? 3 : 4; // 3 => completed, 4 => completed with errors
|
||||
$this->status->set($importStatus, $guid);
|
||||
}
|
||||
}
|
34
src/19a66b48-620c-439b-ab8a-3c0d43e040c3/settings.json
Normal file
34
src/19a66b48-620c-439b-ab8a-3c0d43e040c3/settings.json
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"add_head": "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": ""
|
||||
}
|
@ -15,6 +15,7 @@ class Table #Gold {
|
||||
+ register(Container $container) : void
|
||||
+ getTable(Container $container) : DataTable
|
||||
+ getSchema(Container $container) : Schema
|
||||
+ getValidator(Container $container) : Validator
|
||||
}
|
||||
|
||||
note right of Table::register
|
||||
@ -37,6 +38,13 @@ note right of Table::getSchema
|
||||
since: 3.2.2
|
||||
return: Schema
|
||||
end note
|
||||
|
||||
note right of Table::getValidator
|
||||
Get The Validator Class.
|
||||
|
||||
since: 3.2.2
|
||||
return: Validator
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
@ -16,6 +16,7 @@ use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
use VDM\Joomla\Componentbuilder\Table as DataTable;
|
||||
use VDM\Joomla\Componentbuilder\Table\Schema;
|
||||
use VDM\Joomla\Componentbuilder\Table\Validator;
|
||||
|
||||
|
||||
/**
|
||||
@ -40,6 +41,9 @@ class Table implements ServiceProviderInterface
|
||||
|
||||
$container->alias(Schema::class, 'Table.Schema')
|
||||
->share('Table.Schema', [$this, 'getSchema'], true);
|
||||
|
||||
$container->alias(Validator::class, 'Table.Validator')
|
||||
->share('Table.Validator', [$this, 'getValidator'], true);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -68,6 +72,21 @@ class Table implements ServiceProviderInterface
|
||||
return new Schema(
|
||||
$container->get('Table')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get The Validator Class.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Validator
|
||||
* @since 3.2.2
|
||||
*/
|
||||
public function getValidator(Container $container): Validator
|
||||
{
|
||||
return new Validator(
|
||||
$container->get('Table')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,9 @@
|
||||
|
||||
$container->alias(Schema::class, 'Table.Schema')
|
||||
->share('Table.Schema', [$this, 'getSchema'], true);
|
||||
|
||||
$container->alias(Validator::class, 'Table.Validator')
|
||||
->share('Table.Validator', [$this, 'getValidator'], true);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -41,4 +44,19 @@
|
||||
return new Schema(
|
||||
$container->get('Table')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get The Validator Class.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Validator
|
||||
* @since 3.2.2
|
||||
*/
|
||||
public function getValidator(Container $container): Validator
|
||||
{
|
||||
return new Validator(
|
||||
$container->get('Table')
|
||||
);
|
||||
}
|
@ -19,6 +19,10 @@
|
||||
"use_selection1": {
|
||||
"use": "b3d2ec33-76d4-4c3b-bb2c-86ac14a221ce",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection2": {
|
||||
"use": "79fd4f39-824d-4ab6-936d-959705ff24ec",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"extendsinterfaces": null,
|
||||
|
108
src/21754a8b-2323-4a77-8459-378a74c1ec97/README.md
Normal file
108
src/21754a8b-2323-4a77-8459-378a74c1ec97/README.md
Normal file
@ -0,0 +1,108 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# class Import (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Import\Service**
|
||||
|
||||
```uml
|
||||
@startuml
|
||||
class Import #Gold {
|
||||
+ register(Container $container) : void
|
||||
+ getData(Container $container) : Data
|
||||
+ getMapper(Container $container) : Mapper
|
||||
+ getRow(Container $container) : Row
|
||||
+ getItem(Container $container) : Item
|
||||
+ getMessage(Container $container) : Message
|
||||
+ getStatus(Container $container) : Status
|
||||
+ getAssessor(Container $container) : Assessor
|
||||
}
|
||||
|
||||
note right of Import::register
|
||||
Registers the service provider with a DI container.
|
||||
|
||||
since: 5.0.3
|
||||
return: void
|
||||
end note
|
||||
|
||||
note left of Import::getData
|
||||
Get The Data Class.
|
||||
|
||||
since: 5.0.3
|
||||
return: Data
|
||||
end note
|
||||
|
||||
note right of Import::getMapper
|
||||
Get The Mapper Class.
|
||||
|
||||
since: 5.0.3
|
||||
return: Mapper
|
||||
end note
|
||||
|
||||
note left of Import::getRow
|
||||
Get The Row Class.
|
||||
|
||||
since: 5.0.3
|
||||
return: Row
|
||||
end note
|
||||
|
||||
note right of Import::getItem
|
||||
Get The Item Class.
|
||||
|
||||
since: 5.0.3
|
||||
return: Item
|
||||
end note
|
||||
|
||||
note left of Import::getMessage
|
||||
Get The Message Class.
|
||||
|
||||
since: 5.0.3
|
||||
return: Message
|
||||
end note
|
||||
|
||||
note right of Import::getStatus
|
||||
Get The Status Class.
|
||||
|
||||
since: 5.0.3
|
||||
return: Status
|
||||
end note
|
||||
|
||||
note left of Import::getAssessor
|
||||
Get The Assessor Class.
|
||||
|
||||
since: 5.0.3
|
||||
return: Assessor
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
|
||||
|
||||
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
|
||||
|
||||
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
|
||||
|
||||
To add this specific Power to your project in JCB:
|
||||
|
||||
> simply use this SPK
|
||||
```
|
||||
Super---21754a8b_2323_4a77_8459_378a74c1ec97---Power
|
||||
```
|
||||
> remember to replace the `---` with `___` to activate this Power in your code
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
171
src/21754a8b-2323-4a77-8459-378a74c1ec97/code.php
Normal file
171
src/21754a8b-2323-4a77-8459-378a74c1ec97/code.php
Normal file
@ -0,0 +1,171 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Import\Service;
|
||||
|
||||
|
||||
use Joomla\DI\Container;
|
||||
use Joomla\DI\ServiceProviderInterface;
|
||||
use VDM\Joomla\Componentbuilder\Import\Data;
|
||||
use VDM\Joomla\Componentbuilder\Import\Mapper;
|
||||
use VDM\Joomla\Componentbuilder\Import\Row;
|
||||
use VDM\Joomla\Componentbuilder\Import\Item;
|
||||
use VDM\Joomla\Componentbuilder\Import\Message;
|
||||
use VDM\Joomla\Componentbuilder\Import\Status;
|
||||
use VDM\Joomla\Componentbuilder\Import\Assessor;
|
||||
|
||||
|
||||
/**
|
||||
* Import Service Provider
|
||||
*
|
||||
* @since 5.0.3
|
||||
*/
|
||||
class Import implements ServiceProviderInterface
|
||||
{
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
* @since 5.0.3
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container->alias(Data::class, 'Import.Data')
|
||||
->share('Import.Data', [$this, 'getData'], true);
|
||||
|
||||
$container->alias(Mapper::class, 'Import.Mapper')
|
||||
->share('Import.Mapper', [$this, 'getMapper'], true);
|
||||
|
||||
$container->alias(Row::class, 'Import.Row')
|
||||
->share('Import.Row', [$this, 'getRow'], true);
|
||||
|
||||
$container->alias(Item::class, 'Import.Item')
|
||||
->share('Import.Item', [$this, 'getItem'], true);
|
||||
|
||||
$container->alias(Message::class, 'Import.Message')
|
||||
->share('Import.Message', [$this, 'getMessage'], true);
|
||||
|
||||
$container->alias(Status::class, 'Import.Status')
|
||||
->share('Import.Status', [$this, 'getStatus'], true);
|
||||
|
||||
$container->alias(Assessor::class, 'Import.Assessor')
|
||||
->share('Import.Assessor', [$this, 'getAssessor'], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get The Data Class.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Data
|
||||
* @since 5.0.3
|
||||
*/
|
||||
public function getData(Container $container): Data
|
||||
{
|
||||
return new Data();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get The Mapper Class.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Mapper
|
||||
* @since 5.0.3
|
||||
*/
|
||||
public function getMapper(Container $container): Mapper
|
||||
{
|
||||
return new Mapper(
|
||||
$container->get('Table')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get The Row Class.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Row
|
||||
* @since 5.0.3
|
||||
*/
|
||||
public function getRow(Container $container): Row
|
||||
{
|
||||
return new Row();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get The Item Class.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Item
|
||||
* @since 5.0.3
|
||||
*/
|
||||
public function getItem(Container $container): Item
|
||||
{
|
||||
return new Item(
|
||||
$container->get('Table.Validator'),
|
||||
$container->get('Data.Item'),
|
||||
$container->get('Import.Row')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get The Message Class.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Message
|
||||
* @since 5.0.3
|
||||
*/
|
||||
public function getMessage(Container $container): Message
|
||||
{
|
||||
return new Message(
|
||||
$container->get('Data.Update'),
|
||||
$container->get('Data.Insert')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get The Status Class.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Status
|
||||
* @since 5.0.3
|
||||
*/
|
||||
public function getStatus(Container $container): Status
|
||||
{
|
||||
return new Status(
|
||||
$container->get('Data.Item')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get The Assessor Class.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Assessor
|
||||
* @since 5.0.3
|
||||
*/
|
||||
public function getAssessor(Container $container): Assessor
|
||||
{
|
||||
return new Assessor(
|
||||
$container->get('Import.Data'),
|
||||
$container->get('Import.Status'),
|
||||
$container->get('Import.Message')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
137
src/21754a8b-2323-4a77-8459-378a74c1ec97/code.power
Normal file
137
src/21754a8b-2323-4a77-8459-378a74c1ec97/code.power
Normal file
@ -0,0 +1,137 @@
|
||||
/**
|
||||
* Registers the service provider with a DI container.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return void
|
||||
* @since 5.0.3
|
||||
*/
|
||||
public function register(Container $container)
|
||||
{
|
||||
$container->alias(Data::class, 'Import.Data')
|
||||
->share('Import.Data', [$this, 'getData'], true);
|
||||
|
||||
$container->alias(Mapper::class, 'Import.Mapper')
|
||||
->share('Import.Mapper', [$this, 'getMapper'], true);
|
||||
|
||||
$container->alias(Row::class, 'Import.Row')
|
||||
->share('Import.Row', [$this, 'getRow'], true);
|
||||
|
||||
$container->alias(Item::class, 'Import.Item')
|
||||
->share('Import.Item', [$this, 'getItem'], true);
|
||||
|
||||
$container->alias(Message::class, 'Import.Message')
|
||||
->share('Import.Message', [$this, 'getMessage'], true);
|
||||
|
||||
$container->alias(Status::class, 'Import.Status')
|
||||
->share('Import.Status', [$this, 'getStatus'], true);
|
||||
|
||||
$container->alias(Assessor::class, 'Import.Assessor')
|
||||
->share('Import.Assessor', [$this, 'getAssessor'], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get The Data Class.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Data
|
||||
* @since 5.0.3
|
||||
*/
|
||||
public function getData(Container $container): Data
|
||||
{
|
||||
return new Data();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get The Mapper Class.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Mapper
|
||||
* @since 5.0.3
|
||||
*/
|
||||
public function getMapper(Container $container): Mapper
|
||||
{
|
||||
return new Mapper(
|
||||
$container->get('Table')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get The Row Class.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Row
|
||||
* @since 5.0.3
|
||||
*/
|
||||
public function getRow(Container $container): Row
|
||||
{
|
||||
return new Row();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get The Item Class.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Item
|
||||
* @since 5.0.3
|
||||
*/
|
||||
public function getItem(Container $container): Item
|
||||
{
|
||||
return new Item(
|
||||
$container->get('Table.Validator'),
|
||||
$container->get('Data.Item'),
|
||||
$container->get('Import.Row')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get The Message Class.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Message
|
||||
* @since 5.0.3
|
||||
*/
|
||||
public function getMessage(Container $container): Message
|
||||
{
|
||||
return new Message(
|
||||
$container->get('Data.Update'),
|
||||
$container->get('Data.Insert')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get The Status Class.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Status
|
||||
* @since 5.0.3
|
||||
*/
|
||||
public function getStatus(Container $container): Status
|
||||
{
|
||||
return new Status(
|
||||
$container->get('Data.Item')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get The Assessor Class.
|
||||
*
|
||||
* @param Container $container The DI container.
|
||||
*
|
||||
* @return Assessor
|
||||
* @since 5.0.3
|
||||
*/
|
||||
public function getAssessor(Container $container): Assessor
|
||||
{
|
||||
return new Assessor(
|
||||
$container->get('Import.Data'),
|
||||
$container->get('Import.Status'),
|
||||
$container->get('Import.Message')
|
||||
);
|
||||
}
|
51
src/21754a8b-2323-4a77-8459-378a74c1ec97/settings.json
Normal file
51
src/21754a8b-2323-4a77-8459-378a74c1ec97/settings.json
Normal file
@ -0,0 +1,51 @@
|
||||
{
|
||||
"add_head": "1",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "",
|
||||
"guid": "21754a8b-2323-4a77-8459-378a74c1ec97",
|
||||
"implements": [
|
||||
"-1"
|
||||
],
|
||||
"load_selection": null,
|
||||
"name": "Import",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Import.Service.Import",
|
||||
"type": "class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "05f23281-58e3-482e-be42-2dc1355ef4ea",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection1": {
|
||||
"use": "90b48ea8-0930-48d1-869a-bce9c901589c",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection2": {
|
||||
"use": "afb5b891-7130-422a-b389-1934b0e4fc48",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection3": {
|
||||
"use": "68a0f9af-265a-4db1-bae9-a4e4531f94d7",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection4": {
|
||||
"use": "eef6ffc2-2af0-4336-958f-e0b9cf7c4ad0",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection5": {
|
||||
"use": "d2a859ac-3f2a-4f69-a77f-f118b2e0a459",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection6": {
|
||||
"use": "19a66b48-620c-439b-ab8a-3c0d43e040c3",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"extendsinterfaces": null,
|
||||
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Import.Service.Import",
|
||||
"description": "Import Service Provider\r\n\r\n@since 5.0.3",
|
||||
"implements_custom": "ServiceProviderInterface",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "use Joomla\\DI\\Container;\r\nuse Joomla\\DI\\ServiceProviderInterface;",
|
||||
"composer": ""
|
||||
}
|
120
src/23ad6e72-1b82-40fb-836c-50da690bb174/README.md
Normal file
120
src/23ad6e72-1b82-40fb-836c-50da690bb174/README.md
Normal file
@ -0,0 +1,120 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# interface ImportMessageInterface (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Interfaces**
|
||||
|
||||
```uml
|
||||
@startuml
|
||||
interface ImportMessageInterface #Lavender {
|
||||
+ load(string $guid, string $entity, ...) : self
|
||||
+ get() : object
|
||||
+ reset() : void
|
||||
+ archive() : self
|
||||
+ set() : self
|
||||
+ addSuccess(string $message) : self
|
||||
+ addInfo(string $message) : self
|
||||
+ addError(string $message) : self
|
||||
}
|
||||
|
||||
note right of ImportMessageInterface::load
|
||||
Load an entity that these message belong to
|
||||
|
||||
since: 3.0.2
|
||||
return: self
|
||||
|
||||
arguments:
|
||||
string $guid
|
||||
string $entity
|
||||
string $table
|
||||
end note
|
||||
|
||||
note left of ImportMessageInterface::get
|
||||
Get the messages of the last import event
|
||||
|
||||
since: 3.0.2
|
||||
return: object
|
||||
end note
|
||||
|
||||
note right of ImportMessageInterface::reset
|
||||
Reset the messages of the last import event
|
||||
|
||||
since: 3.0.2
|
||||
return: void
|
||||
end note
|
||||
|
||||
note left of ImportMessageInterface::archive
|
||||
Archive the messages in the DB of the last import event
|
||||
|
||||
since: 3.0.2
|
||||
return: self
|
||||
end note
|
||||
|
||||
note right of ImportMessageInterface::set
|
||||
Set the messages in the DB of the last import event
|
||||
|
||||
since: 3.0.2
|
||||
return: self
|
||||
end note
|
||||
|
||||
note left of ImportMessageInterface::addSuccess
|
||||
Adds a success message to the log.
|
||||
This method records a success message for the import process. The message provides
|
||||
relevant information, such as the number of rows processed and the success rate.
|
||||
|
||||
since: 3.0.2
|
||||
return: self
|
||||
end note
|
||||
|
||||
note right of ImportMessageInterface::addInfo
|
||||
Adds a info message to the log.
|
||||
This method records a info message for the import process. The message provides
|
||||
relevant information, such as the number of rows processed and the info rate.
|
||||
|
||||
since: 3.0.2
|
||||
return: self
|
||||
end note
|
||||
|
||||
note left of ImportMessageInterface::addError
|
||||
Adds an error message to the log.
|
||||
This method records an error message when the import process encounters issues.
|
||||
The message includes details about the failures, such as the number of failed rows
|
||||
and the corresponding error rate.
|
||||
|
||||
since: 3.0.2
|
||||
return: self
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
|
||||
|
||||
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
|
||||
|
||||
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
|
||||
|
||||
To add this specific Power to your project in JCB:
|
||||
|
||||
> simply use this SPK
|
||||
```
|
||||
Super---23ad6e72_1b82_40fb_836c_50da690bb174---Power
|
||||
```
|
||||
> remember to replace the `---` with `___` to activate this Power in your code
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
109
src/23ad6e72-1b82-40fb-836c-50da690bb174/code.php
Normal file
109
src/23ad6e72-1b82-40fb-836c-50da690bb174/code.php
Normal file
@ -0,0 +1,109 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Interfaces;
|
||||
|
||||
|
||||
/**
|
||||
* Import Message Interface
|
||||
*
|
||||
* @since 3.0.2
|
||||
*/
|
||||
interface ImportMessageInterface
|
||||
{
|
||||
/**
|
||||
* Load an entity that these message belong to
|
||||
*
|
||||
* @param string $guid The entity guid these messages must be linked to.
|
||||
* @param string $entity The entity type these messages must be linked to.
|
||||
* @param string $table The messages table where these message must be stored.
|
||||
*
|
||||
* @return self
|
||||
* @throws \InvalidArgumentException if any of the parameters are null or empty.
|
||||
* @since 3.0.2
|
||||
*/
|
||||
public function load(string $guid, string $entity, string $table): self;
|
||||
|
||||
/**
|
||||
* Get the messages of the last import event
|
||||
*
|
||||
* @return object
|
||||
* @since 3.0.2
|
||||
*/
|
||||
public function get(): object;
|
||||
|
||||
/**
|
||||
* Reset the messages of the last import event
|
||||
*
|
||||
* @return void
|
||||
* @since 3.0.2
|
||||
*/
|
||||
public function reset(): void;
|
||||
|
||||
/**
|
||||
* Archive the messages in the DB of the last import event
|
||||
*
|
||||
* @return self
|
||||
* @throws \InvalidArgumentException if GUID, entity, or table is null.
|
||||
* @since 3.0.2
|
||||
*/
|
||||
public function archive(): self;
|
||||
|
||||
/**
|
||||
* Set the messages in the DB of the last import event
|
||||
*
|
||||
* @return self
|
||||
* @throws \InvalidArgumentException if GUID, entity, or table is null.
|
||||
* @since 3.0.2
|
||||
*/
|
||||
public function set(): self;
|
||||
|
||||
/**
|
||||
* Adds a success message to the log.
|
||||
*
|
||||
* This method records a success message for the import process. The message provides
|
||||
* relevant information, such as the number of rows processed and the success rate.
|
||||
*
|
||||
* @param string $message The success message to log.
|
||||
*
|
||||
* @return self
|
||||
* @since 3.0.2
|
||||
*/
|
||||
public function addSuccess(string $message): self;
|
||||
|
||||
/**
|
||||
* Adds a info message to the log.
|
||||
*
|
||||
* This method records a info message for the import process. The message provides
|
||||
* relevant information, such as the number of rows processed and the info rate.
|
||||
*
|
||||
* @param string $message The info message to log.
|
||||
*
|
||||
* @return self
|
||||
* @since 3.0.2
|
||||
*/
|
||||
public function addInfo(string $message): self;
|
||||
|
||||
/**
|
||||
* Adds an error message to the log.
|
||||
*
|
||||
* This method records an error message when the import process encounters issues.
|
||||
* The message includes details about the failures, such as the number of failed rows
|
||||
* and the corresponding error rate.
|
||||
*
|
||||
* @param string $message The error message to log.
|
||||
*
|
||||
* @return self
|
||||
* @since 3.0.2
|
||||
*/
|
||||
public function addError(string $message): self;
|
||||
}
|
||||
|
86
src/23ad6e72-1b82-40fb-836c-50da690bb174/code.power
Normal file
86
src/23ad6e72-1b82-40fb-836c-50da690bb174/code.power
Normal file
@ -0,0 +1,86 @@
|
||||
/**
|
||||
* Load an entity that these message belong to
|
||||
*
|
||||
* @param string $guid The entity guid these messages must be linked to.
|
||||
* @param string $entity The entity type these messages must be linked to.
|
||||
* @param string $table The messages table where these message must be stored.
|
||||
*
|
||||
* @return self
|
||||
* @throws \InvalidArgumentException if any of the parameters are null or empty.
|
||||
* @since 3.0.2
|
||||
*/
|
||||
public function load(string $guid, string $entity, string $table): self;
|
||||
|
||||
/**
|
||||
* Get the messages of the last import event
|
||||
*
|
||||
* @return object
|
||||
* @since 3.0.2
|
||||
*/
|
||||
public function get(): object;
|
||||
|
||||
/**
|
||||
* Reset the messages of the last import event
|
||||
*
|
||||
* @return void
|
||||
* @since 3.0.2
|
||||
*/
|
||||
public function reset(): void;
|
||||
|
||||
/**
|
||||
* Archive the messages in the DB of the last import event
|
||||
*
|
||||
* @return self
|
||||
* @throws \InvalidArgumentException if GUID, entity, or table is null.
|
||||
* @since 3.0.2
|
||||
*/
|
||||
public function archive(): self;
|
||||
|
||||
/**
|
||||
* Set the messages in the DB of the last import event
|
||||
*
|
||||
* @return self
|
||||
* @throws \InvalidArgumentException if GUID, entity, or table is null.
|
||||
* @since 3.0.2
|
||||
*/
|
||||
public function set(): self;
|
||||
|
||||
/**
|
||||
* Adds a success message to the log.
|
||||
*
|
||||
* This method records a success message for the import process. The message provides
|
||||
* relevant information, such as the number of rows processed and the success rate.
|
||||
*
|
||||
* @param string $message The success message to log.
|
||||
*
|
||||
* @return self
|
||||
* @since 3.0.2
|
||||
*/
|
||||
public function addSuccess(string $message): self;
|
||||
|
||||
/**
|
||||
* Adds a info message to the log.
|
||||
*
|
||||
* This method records a info message for the import process. The message provides
|
||||
* relevant information, such as the number of rows processed and the info rate.
|
||||
*
|
||||
* @param string $message The info message to log.
|
||||
*
|
||||
* @return self
|
||||
* @since 3.0.2
|
||||
*/
|
||||
public function addInfo(string $message): self;
|
||||
|
||||
/**
|
||||
* Adds an error message to the log.
|
||||
*
|
||||
* This method records an error message when the import process encounters issues.
|
||||
* The message includes details about the failures, such as the number of failed rows
|
||||
* and the corresponding error rate.
|
||||
*
|
||||
* @param string $message The error message to log.
|
||||
*
|
||||
* @return self
|
||||
* @since 3.0.2
|
||||
*/
|
||||
public function addError(string $message): self;
|
19
src/23ad6e72-1b82-40fb-836c-50da690bb174/settings.json
Normal file
19
src/23ad6e72-1b82-40fb-836c-50da690bb174/settings.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "",
|
||||
"guid": "23ad6e72-1b82-40fb-836c-50da690bb174",
|
||||
"implements": null,
|
||||
"load_selection": null,
|
||||
"name": "ImportMessageInterface",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "VDM.ImportMessageInterface",
|
||||
"type": "interface",
|
||||
"use_selection": null,
|
||||
"extendsinterfaces": null,
|
||||
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Interfaces.ImportMessageInterface",
|
||||
"description": "Import Message Interface\r\n\r\n@since 3.0.2",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "",
|
||||
"composer": ""
|
||||
}
|
68
src/250a7272-9ae1-4c63-a058-26bad9ad6f70/README.md
Normal file
68
src/250a7272-9ae1-4c63-a058-26bad9ad6f70/README.md
Normal file
@ -0,0 +1,68 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# interface ImportMapperInterface (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Interfaces**
|
||||
|
||||
```uml
|
||||
@startuml
|
||||
interface ImportMapperInterface #Lavender {
|
||||
+ set(object $map, string $parentTable) : void
|
||||
+ getParent() : array
|
||||
+ getJoin() : array
|
||||
}
|
||||
|
||||
note right of ImportMapperInterface::set
|
||||
Set the tables mapper
|
||||
|
||||
since: 4.0.3
|
||||
return: void
|
||||
end note
|
||||
|
||||
note right of ImportMapperInterface::getParent
|
||||
Get the parent table keys
|
||||
|
||||
since: 4.0.3
|
||||
return: array
|
||||
end note
|
||||
|
||||
note right of ImportMapperInterface::getJoin
|
||||
Get the join tables keys
|
||||
|
||||
since: 4.0.3
|
||||
return: array
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
|
||||
|
||||
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
|
||||
|
||||
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
|
||||
|
||||
To add this specific Power to your project in JCB:
|
||||
|
||||
> simply use this SPK
|
||||
```
|
||||
Super---250a7272_9ae1_4c63_a058_26bad9ad6f70---Power
|
||||
```
|
||||
> remember to replace the `---` with `___` to activate this Power in your code
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
49
src/250a7272-9ae1-4c63-a058-26bad9ad6f70/code.php
Normal file
49
src/250a7272-9ae1-4c63-a058-26bad9ad6f70/code.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Interfaces;
|
||||
|
||||
|
||||
/**
|
||||
* Import Mapper Interface
|
||||
*
|
||||
* @since 3.0.3
|
||||
*/
|
||||
interface ImportMapperInterface
|
||||
{
|
||||
/**
|
||||
* Set the tables mapper
|
||||
*
|
||||
* @param object $map The import file map.
|
||||
* @param string $parentTable The parent table name.
|
||||
*
|
||||
* @return void
|
||||
* @since 4.0.3
|
||||
*/
|
||||
public function set(object $map, string $parentTable): void;
|
||||
|
||||
/**
|
||||
* Get the parent table keys
|
||||
*
|
||||
* @return array
|
||||
* @since 4.0.3
|
||||
*/
|
||||
public function getParent(): array;
|
||||
|
||||
/**
|
||||
* Get the join tables keys
|
||||
*
|
||||
* @return array
|
||||
* @since 4.0.3
|
||||
*/
|
||||
public function getJoin(): array;
|
||||
}
|
||||
|
26
src/250a7272-9ae1-4c63-a058-26bad9ad6f70/code.power
Normal file
26
src/250a7272-9ae1-4c63-a058-26bad9ad6f70/code.power
Normal file
@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Set the tables mapper
|
||||
*
|
||||
* @param object $map The import file map.
|
||||
* @param string $parentTable The parent table name.
|
||||
*
|
||||
* @return void
|
||||
* @since 4.0.3
|
||||
*/
|
||||
public function set(object $map, string $parentTable): void;
|
||||
|
||||
/**
|
||||
* Get the parent table keys
|
||||
*
|
||||
* @return array
|
||||
* @since 4.0.3
|
||||
*/
|
||||
public function getParent(): array;
|
||||
|
||||
/**
|
||||
* Get the join tables keys
|
||||
*
|
||||
* @return array
|
||||
* @since 4.0.3
|
||||
*/
|
||||
public function getJoin(): array;
|
19
src/250a7272-9ae1-4c63-a058-26bad9ad6f70/settings.json
Normal file
19
src/250a7272-9ae1-4c63-a058-26bad9ad6f70/settings.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "",
|
||||
"guid": "250a7272-9ae1-4c63-a058-26bad9ad6f70",
|
||||
"implements": null,
|
||||
"load_selection": null,
|
||||
"name": "ImportMapperInterface",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "VDM.ImportMapperInterface",
|
||||
"type": "interface",
|
||||
"use_selection": null,
|
||||
"extendsinterfaces": null,
|
||||
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Interfaces.ImportMapperInterface",
|
||||
"description": "Import Mapper Interface\r\n\r\n@since 3.0.3",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "",
|
||||
"composer": ""
|
||||
}
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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": "",
|
||||
|
@ -35,14 +35,6 @@ use VDM\Joomla\Interfaces\FactoryInterface;
|
||||
**/
|
||||
abstract class Factory implements FactoryInterface
|
||||
{
|
||||
/**
|
||||
* Global Package Container
|
||||
*
|
||||
* @var Container|null
|
||||
* @since 0.0.0
|
||||
**/
|
||||
protected static ?Container $container = null;
|
||||
|
||||
/**
|
||||
* Get any class from the package container
|
||||
*
|
||||
|
@ -1,11 +1,3 @@
|
||||
/**
|
||||
* Global Package Container
|
||||
*
|
||||
* @var Container|null
|
||||
* @since 0.0.0
|
||||
**/
|
||||
protected static ?Container $container = null;
|
||||
|
||||
/**
|
||||
* Get any class from the package container
|
||||
*
|
||||
|
84
src/3d3ec064-9867-41e6-a48a-964c15d753aa/README.md
Normal file
84
src/3d3ec064-9867-41e6-a48a-964c15d753aa/README.md
Normal file
@ -0,0 +1,84 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# interface ImportRowInterface (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Interfaces**
|
||||
|
||||
```uml
|
||||
@startuml
|
||||
interface ImportRowInterface #Lavender {
|
||||
+ set(int $index, array $values) : void
|
||||
+ clear() : self
|
||||
+ getIndex() : int
|
||||
+ getValue(string $key) : mixed
|
||||
+ unsetValue(string $key) : void
|
||||
}
|
||||
|
||||
note right of ImportRowInterface::set
|
||||
Set the row details
|
||||
|
||||
since: 3.0.3
|
||||
return: void
|
||||
end note
|
||||
|
||||
note right of ImportRowInterface::clear
|
||||
Clear the row details
|
||||
|
||||
since: 3.0.3
|
||||
return: self
|
||||
end note
|
||||
|
||||
note right of ImportRowInterface::getIndex
|
||||
Get Index
|
||||
|
||||
since: 3.0.3
|
||||
return: int
|
||||
end note
|
||||
|
||||
note right of ImportRowInterface::getValue
|
||||
Get Value
|
||||
|
||||
since: 3.0.3
|
||||
return: mixed
|
||||
end note
|
||||
|
||||
note right of ImportRowInterface::unsetValue
|
||||
Unset Value
|
||||
|
||||
since: 3.0.3
|
||||
return: void
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
|
||||
|
||||
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
|
||||
|
||||
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
|
||||
|
||||
To add this specific Power to your project in JCB:
|
||||
|
||||
> simply use this SPK
|
||||
```
|
||||
Super---3d3ec064_9867_41e6_a48a_964c15d753aa---Power
|
||||
```
|
||||
> remember to replace the `---` with `___` to activate this Power in your code
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
68
src/3d3ec064-9867-41e6-a48a-964c15d753aa/code.php
Normal file
68
src/3d3ec064-9867-41e6-a48a-964c15d753aa/code.php
Normal file
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Interfaces;
|
||||
|
||||
|
||||
/**
|
||||
* Import Row Interface
|
||||
*
|
||||
* @since 3.0.3
|
||||
*/
|
||||
interface ImportRowInterface
|
||||
{
|
||||
/**
|
||||
* Set the row details
|
||||
*
|
||||
* @param int $index The row index
|
||||
* @param array $values The values
|
||||
*
|
||||
* @return void
|
||||
* @since 3.0.3
|
||||
*/
|
||||
public function set(int $index, array $values): void;
|
||||
|
||||
/**
|
||||
* Clear the row details
|
||||
*
|
||||
* @return self
|
||||
* @since 3.0.3
|
||||
*/
|
||||
public function clear(): self;
|
||||
|
||||
/**
|
||||
* Get Index
|
||||
*
|
||||
* @return int
|
||||
* @throws \InvalidArgumentException if any of the parameters are null or empty.
|
||||
* @since 3.0.3
|
||||
*/
|
||||
public function getIndex(): int;
|
||||
|
||||
/**
|
||||
* Get Value
|
||||
*
|
||||
* @return mixed
|
||||
* @throws \InvalidArgumentException if any of the parameters are null or empty.
|
||||
* @since 3.0.3
|
||||
*/
|
||||
public function getValue(string $key);
|
||||
|
||||
/**
|
||||
* Unset Value
|
||||
*
|
||||
* @return void
|
||||
* @throws \InvalidArgumentException if any of the parameters are null or empty.
|
||||
* @since 3.0.3
|
||||
*/
|
||||
public function unsetValue(string $key): void;
|
||||
}
|
||||
|
45
src/3d3ec064-9867-41e6-a48a-964c15d753aa/code.power
Normal file
45
src/3d3ec064-9867-41e6-a48a-964c15d753aa/code.power
Normal file
@ -0,0 +1,45 @@
|
||||
/**
|
||||
* Set the row details
|
||||
*
|
||||
* @param int $index The row index
|
||||
* @param array $values The values
|
||||
*
|
||||
* @return void
|
||||
* @since 3.0.3
|
||||
*/
|
||||
public function set(int $index, array $values): void;
|
||||
|
||||
/**
|
||||
* Clear the row details
|
||||
*
|
||||
* @return self
|
||||
* @since 3.0.3
|
||||
*/
|
||||
public function clear(): self;
|
||||
|
||||
/**
|
||||
* Get Index
|
||||
*
|
||||
* @return int
|
||||
* @throws \InvalidArgumentException if any of the parameters are null or empty.
|
||||
* @since 3.0.3
|
||||
*/
|
||||
public function getIndex(): int;
|
||||
|
||||
/**
|
||||
* Get Value
|
||||
*
|
||||
* @return mixed
|
||||
* @throws \InvalidArgumentException if any of the parameters are null or empty.
|
||||
* @since 3.0.3
|
||||
*/
|
||||
public function getValue(string $key);
|
||||
|
||||
/**
|
||||
* Unset Value
|
||||
*
|
||||
* @return void
|
||||
* @throws \InvalidArgumentException if any of the parameters are null or empty.
|
||||
* @since 3.0.3
|
||||
*/
|
||||
public function unsetValue(string $key): void;
|
19
src/3d3ec064-9867-41e6-a48a-964c15d753aa/settings.json
Normal file
19
src/3d3ec064-9867-41e6-a48a-964c15d753aa/settings.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "",
|
||||
"guid": "3d3ec064-9867-41e6-a48a-964c15d753aa",
|
||||
"implements": null,
|
||||
"load_selection": null,
|
||||
"name": "ImportRowInterface",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "VDM.ImportRowInterface",
|
||||
"type": "interface",
|
||||
"use_selection": null,
|
||||
"extendsinterfaces": null,
|
||||
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Interfaces.ImportRowInterface",
|
||||
"description": "Import Row Interface\r\n\r\n@since 3.0.3",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "",
|
||||
"composer": ""
|
||||
}
|
68
src/47a63728-cd5d-4d53-99cf-2409bd1c744c/README.md
Normal file
68
src/47a63728-cd5d-4d53-99cf-2409bd1c744c/README.md
Normal file
@ -0,0 +1,68 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# abstract class SessionHelper (Details)
|
||||
> namespace: **VDM\Joomla\Utilities**
|
||||
|
||||
```uml
|
||||
@startuml
|
||||
abstract SessionHelper #Orange {
|
||||
+ {static} session() : Session
|
||||
+ {static} get(string $name, mixed $default = null) : mixed
|
||||
+ {static} set(string $name, mixed $value = null) : mixed
|
||||
}
|
||||
|
||||
note right of SessionHelper::session
|
||||
Get the active session
|
||||
|
||||
since: 5.0.2
|
||||
return: Session
|
||||
end note
|
||||
|
||||
note right of SessionHelper::get
|
||||
Get data from the session store
|
||||
|
||||
since: 5.0.2
|
||||
return: mixed
|
||||
end note
|
||||
|
||||
note right of SessionHelper::set
|
||||
Set data into the session store
|
||||
|
||||
since: 5.0.2
|
||||
return: mixed
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
|
||||
|
||||
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
|
||||
|
||||
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
|
||||
|
||||
To add this specific Power to your project in JCB:
|
||||
|
||||
> simply use this SPK
|
||||
```
|
||||
Super---47a63728_cd5d_4d53_99cf_2409bd1c744c---Power
|
||||
```
|
||||
> remember to replace the `---` with `___` to activate this Power in your code
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
89
src/47a63728-cd5d-4d53-99cf-2409bd1c744c/code.php
Normal file
89
src/47a63728-cd5d-4d53-99cf-2409bd1c744c/code.php
Normal file
@ -0,0 +1,89 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2020
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Utilities;
|
||||
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Session\Session;
|
||||
|
||||
|
||||
/**
|
||||
* Simple Session
|
||||
*
|
||||
* @since 5.0.2
|
||||
*/
|
||||
abstract class SessionHelper
|
||||
{
|
||||
/**
|
||||
* The active session
|
||||
*
|
||||
* @var Session|null
|
||||
* @since 5.0.2
|
||||
*/
|
||||
private static ?Session $session = null;
|
||||
|
||||
/**
|
||||
* Get the active session
|
||||
*
|
||||
* @return Session
|
||||
* @throws \RuntimeException if the session cannot be loaded
|
||||
* @since 5.0.2
|
||||
*/
|
||||
public static function session(): Session
|
||||
{
|
||||
if (static::$session === null)
|
||||
{
|
||||
try {
|
||||
static::$session = Factory::getApplication()->getSession();
|
||||
} catch (\Exception $e) {
|
||||
// Rethrow the exception as a RuntimeException to propagate it downstream
|
||||
throw new \RuntimeException('Unable to load the session.', 0, $e);
|
||||
}
|
||||
}
|
||||
|
||||
return static::$session;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get data from the session store
|
||||
*
|
||||
* @param string $name Name of a variable
|
||||
* @param mixed $default Default value of a variable if not set
|
||||
*
|
||||
* @return mixed Value of the variable from the session
|
||||
* @since 5.0.2
|
||||
*/
|
||||
public static function get(string $name, $default = null)
|
||||
{
|
||||
$value = static::session()->get($name, $default);
|
||||
|
||||
// Ensure the value is set in the session even if it was default
|
||||
static::set($name, $value);
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set data into the session store
|
||||
*
|
||||
* @param string $name Name of a variable
|
||||
* @param mixed $value Value of a variable
|
||||
*
|
||||
* @return mixed Old value of the variable
|
||||
* @since 5.0.2
|
||||
*/
|
||||
public static function set(string $name, $value = null)
|
||||
{
|
||||
return static::session()->set($name, $value);
|
||||
}
|
||||
}
|
||||
|
62
src/47a63728-cd5d-4d53-99cf-2409bd1c744c/code.power
Normal file
62
src/47a63728-cd5d-4d53-99cf-2409bd1c744c/code.power
Normal file
@ -0,0 +1,62 @@
|
||||
/**
|
||||
* The active session
|
||||
*
|
||||
* @var Session|null
|
||||
* @since 5.0.2
|
||||
*/
|
||||
private static ?Session $session = null;
|
||||
|
||||
/**
|
||||
* Get the active session
|
||||
*
|
||||
* @return Session
|
||||
* @throws \RuntimeException if the session cannot be loaded
|
||||
* @since 5.0.2
|
||||
*/
|
||||
public static function session(): Session
|
||||
{
|
||||
if (static::$session === null)
|
||||
{
|
||||
try {
|
||||
static::$session = Factory::getApplication()->getSession();
|
||||
} catch (\Exception $e) {
|
||||
// Rethrow the exception as a RuntimeException to propagate it downstream
|
||||
throw new \RuntimeException('Unable to load the session.', 0, $e);
|
||||
}
|
||||
}
|
||||
|
||||
return static::$session;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get data from the session store
|
||||
*
|
||||
* @param string $name Name of a variable
|
||||
* @param mixed $default Default value of a variable if not set
|
||||
*
|
||||
* @return mixed Value of the variable from the session
|
||||
* @since 5.0.2
|
||||
*/
|
||||
public static function get(string $name, $default = null)
|
||||
{
|
||||
$value = static::session()->get($name, $default);
|
||||
|
||||
// Ensure the value is set in the session even if it was default
|
||||
static::set($name, $value);
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set data into the session store
|
||||
*
|
||||
* @param string $name Name of a variable
|
||||
* @param mixed $value Value of a variable
|
||||
*
|
||||
* @return mixed Old value of the variable
|
||||
* @since 5.0.2
|
||||
*/
|
||||
public static function set(string $name, $value = null)
|
||||
{
|
||||
return static::session()->set($name, $value);
|
||||
}
|
19
src/47a63728-cd5d-4d53-99cf-2409bd1c744c/settings.json
Normal file
19
src/47a63728-cd5d-4d53-99cf-2409bd1c744c/settings.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"add_head": "1",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "",
|
||||
"guid": "47a63728-cd5d-4d53-99cf-2409bd1c744c",
|
||||
"implements": null,
|
||||
"load_selection": null,
|
||||
"name": "SessionHelper",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "Joomla.Utilities.SessionHelper",
|
||||
"type": "abstract class",
|
||||
"use_selection": null,
|
||||
"extendsinterfaces": null,
|
||||
"namespace": "[[[NamespacePrefix]]]\\Joomla\\Utilities.SessionHelper",
|
||||
"description": "Simple Session\r\n\r\n@since 5.0.2",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2020\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "use Joomla\\CMS\\Factory;\r\nuse Joomla\\CMS\\Session\\Session;",
|
||||
"composer": ""
|
||||
}
|
52
src/53f55e5b-63cb-49e7-b1e6-33e7a9f97856/README.md
Normal file
52
src/53f55e5b-63cb-49e7-b1e6-33e7a9f97856/README.md
Normal file
@ -0,0 +1,52 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# interface ImportItemInterface (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Interfaces**
|
||||
|
||||
```uml
|
||||
@startuml
|
||||
interface ImportItemInterface #Lavender {
|
||||
+ get(string $table, array $columns) : ?array
|
||||
}
|
||||
|
||||
note right of ImportItemInterface::get
|
||||
Get the item from the import row values and ensure it is valid
|
||||
|
||||
since: 4.0.3
|
||||
return: ?array
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
|
||||
|
||||
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
|
||||
|
||||
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
|
||||
|
||||
To add this specific Power to your project in JCB:
|
||||
|
||||
> simply use this SPK
|
||||
```
|
||||
Super---53f55e5b_63cb_49e7_b1e6_33e7a9f97856---Power
|
||||
```
|
||||
> remember to replace the `---` with `___` to activate this Power in your code
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
33
src/53f55e5b-63cb-49e7-b1e6-33e7a9f97856/code.php
Normal file
33
src/53f55e5b-63cb-49e7-b1e6-33e7a9f97856/code.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Interfaces;
|
||||
|
||||
|
||||
/**
|
||||
* Import Item Interface
|
||||
*
|
||||
* @since 3.0.3
|
||||
*/
|
||||
interface ImportItemInterface
|
||||
{
|
||||
/**
|
||||
* Get the item from the import row values and ensure it is valid
|
||||
*
|
||||
* @param string $table The table these columns belongs to.
|
||||
* @param array $columns The columns to extract.
|
||||
*
|
||||
* @return array|null
|
||||
* @since 4.0.3
|
||||
*/
|
||||
public function get(string $table, array $columns): ?array;
|
||||
}
|
||||
|
10
src/53f55e5b-63cb-49e7-b1e6-33e7a9f97856/code.power
Normal file
10
src/53f55e5b-63cb-49e7-b1e6-33e7a9f97856/code.power
Normal file
@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Get the item from the import row values and ensure it is valid
|
||||
*
|
||||
* @param string $table The table these columns belongs to.
|
||||
* @param array $columns The columns to extract.
|
||||
*
|
||||
* @return array|null
|
||||
* @since 4.0.3
|
||||
*/
|
||||
public function get(string $table, array $columns): ?array;
|
19
src/53f55e5b-63cb-49e7-b1e6-33e7a9f97856/settings.json
Normal file
19
src/53f55e5b-63cb-49e7-b1e6-33e7a9f97856/settings.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "",
|
||||
"guid": "53f55e5b-63cb-49e7-b1e6-33e7a9f97856",
|
||||
"implements": null,
|
||||
"load_selection": null,
|
||||
"name": "ImportItemInterface",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "VDM.ImportItemInterface",
|
||||
"type": "interface",
|
||||
"use_selection": null,
|
||||
"extendsinterfaces": null,
|
||||
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Interfaces.ImportItemInterface",
|
||||
"description": "Import Item Interface\r\n\r\n@since 3.0.3",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "",
|
||||
"composer": ""
|
||||
}
|
57
src/57c00d53-5581-4fd1-b3ea-080422710243/README.md
Normal file
57
src/57c00d53-5581-4fd1-b3ea-080422710243/README.md
Normal file
@ -0,0 +1,57 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# interface ImportAssessorInterface (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Interfaces**
|
||||
|
||||
```uml
|
||||
@startuml
|
||||
interface ImportAssessorInterface #Lavender {
|
||||
+ evaluate(int $rowCounter, int $successCounter, ...) : void
|
||||
}
|
||||
|
||||
note right of ImportAssessorInterface::evaluate
|
||||
Evaluates the import process and sets the success/error message based on the success rate.
|
||||
|
||||
since: 4.0.3
|
||||
return: void
|
||||
|
||||
arguments:
|
||||
int $rowCounter
|
||||
int $successCounter
|
||||
int $errorCounter
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
|
||||
|
||||
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
|
||||
|
||||
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
|
||||
|
||||
To add this specific Power to your project in JCB:
|
||||
|
||||
> simply use this SPK
|
||||
```
|
||||
Super---57c00d53_5581_4fd1_b3ea_080422710243---Power
|
||||
```
|
||||
> remember to replace the `---` with `___` to activate this Power in your code
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
34
src/57c00d53-5581-4fd1-b3ea-080422710243/code.php
Normal file
34
src/57c00d53-5581-4fd1-b3ea-080422710243/code.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Interfaces;
|
||||
|
||||
|
||||
/**
|
||||
* Import Assessor Interface
|
||||
*
|
||||
* @since 3.0.3
|
||||
*/
|
||||
interface ImportAssessorInterface
|
||||
{
|
||||
/**
|
||||
* Evaluates the import process and sets the success/error message based on the success rate.
|
||||
*
|
||||
* @param int $rowCounter Total number of rows processed.
|
||||
* @param int $successCounter Number of successfully processed rows.
|
||||
* @param int $errorCounter Number of rows that failed to process.
|
||||
*
|
||||
* @return void
|
||||
* @since 4.0.3
|
||||
*/
|
||||
public function evaluate(int $rowCounter, int $successCounter, int $errorCounter): void;
|
||||
}
|
||||
|
11
src/57c00d53-5581-4fd1-b3ea-080422710243/code.power
Normal file
11
src/57c00d53-5581-4fd1-b3ea-080422710243/code.power
Normal file
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* Evaluates the import process and sets the success/error message based on the success rate.
|
||||
*
|
||||
* @param int $rowCounter Total number of rows processed.
|
||||
* @param int $successCounter Number of successfully processed rows.
|
||||
* @param int $errorCounter Number of rows that failed to process.
|
||||
*
|
||||
* @return void
|
||||
* @since 4.0.3
|
||||
*/
|
||||
public function evaluate(int $rowCounter, int $successCounter, int $errorCounter): void;
|
19
src/57c00d53-5581-4fd1-b3ea-080422710243/settings.json
Normal file
19
src/57c00d53-5581-4fd1-b3ea-080422710243/settings.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "",
|
||||
"guid": "57c00d53-5581-4fd1-b3ea-080422710243",
|
||||
"implements": null,
|
||||
"load_selection": null,
|
||||
"name": "ImportAssessorInterface",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "VDM.ImportAssessorInterface",
|
||||
"type": "interface",
|
||||
"use_selection": null,
|
||||
"extendsinterfaces": null,
|
||||
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Interfaces.ImportAssessorInterface",
|
||||
"description": "Import Assessor Interface\r\n\r\n@since 3.0.3",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "",
|
||||
"composer": ""
|
||||
}
|
@ -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;
|
||||
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
57
src/61d1146f-2c2e-4e42-8492-d076f945cf35/README.md
Normal file
57
src/61d1146f-2c2e-4e42-8492-d076f945cf35/README.md
Normal file
@ -0,0 +1,57 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# interface FileReaderInterface (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Interfaces\Spreadsheet**
|
||||
|
||||
```uml
|
||||
@startuml
|
||||
interface FileReaderInterface #Lavender {
|
||||
+ read(string $filePath, int $startRow, ...) : \Generator
|
||||
}
|
||||
|
||||
note right of FileReaderInterface::read
|
||||
Stream rows from a CSV or Excel file one by one using yield.
|
||||
|
||||
since: 3.2.0
|
||||
return: \Generator
|
||||
|
||||
arguments:
|
||||
string $filePath
|
||||
int $startRow
|
||||
int $chunkSize
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
|
||||
|
||||
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
|
||||
|
||||
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
|
||||
|
||||
To add this specific Power to your project in JCB:
|
||||
|
||||
> simply use this SPK
|
||||
```
|
||||
Super---61d1146f_2c2e_4e42_8492_d076f945cf35---Power
|
||||
```
|
||||
> remember to replace the `---` with `___` to activate this Power in your code
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
34
src/61d1146f-2c2e-4e42-8492-d076f945cf35/code.php
Normal file
34
src/61d1146f-2c2e-4e42-8492-d076f945cf35/code.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Interfaces\Spreadsheet;
|
||||
|
||||
|
||||
/**
|
||||
* Spreadsheet File Reader Interface
|
||||
*
|
||||
* @since 3.2.2
|
||||
*/
|
||||
interface FileReaderInterface
|
||||
{
|
||||
/**
|
||||
* Stream rows from a CSV or Excel file one by one using yield.
|
||||
*
|
||||
* @param string $filePath The path to the file.
|
||||
* @param int $startRow The starting row index.
|
||||
* @param int $chunkSize The number of rows to read per chunk.
|
||||
*
|
||||
* @return \Generator A generator that yields each row as an array.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function read(string $filePath, int $startRow, int $chunkSize): \Generator;
|
||||
}
|
||||
|
11
src/61d1146f-2c2e-4e42-8492-d076f945cf35/code.power
Normal file
11
src/61d1146f-2c2e-4e42-8492-d076f945cf35/code.power
Normal file
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* Stream rows from a CSV or Excel file one by one using yield.
|
||||
*
|
||||
* @param string $filePath The path to the file.
|
||||
* @param int $startRow The starting row index.
|
||||
* @param int $chunkSize The number of rows to read per chunk.
|
||||
*
|
||||
* @return \Generator A generator that yields each row as an array.
|
||||
* @since 3.2.0
|
||||
*/
|
||||
public function read(string $filePath, int $startRow, int $chunkSize): \Generator;
|
19
src/61d1146f-2c2e-4e42-8492-d076f945cf35/settings.json
Normal file
19
src/61d1146f-2c2e-4e42-8492-d076f945cf35/settings.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "",
|
||||
"guid": "61d1146f-2c2e-4e42-8492-d076f945cf35",
|
||||
"implements": null,
|
||||
"load_selection": null,
|
||||
"name": "FileReaderInterface",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Interfaces.Spreadsheet.FileReaderInterface",
|
||||
"type": "interface",
|
||||
"use_selection": null,
|
||||
"extendsinterfaces": null,
|
||||
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Interfaces.Spreadsheet.FileReaderInterface",
|
||||
"description": "Spreadsheet File Reader Interface\r\n\r\n@since 3.2.2",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "",
|
||||
"composer": ""
|
||||
}
|
@ -250,6 +250,7 @@ final class Manager
|
||||
'entity' => $entity,
|
||||
'access' => $fileType['download_access'] ?? 1,
|
||||
'guid' => $this->getGuid('guid'),
|
||||
'created_by' => $this->user->id
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -217,5 +217,6 @@
|
||||
'entity' => $entity,
|
||||
'access' => $fileType['download_access'] ?? 1,
|
||||
'guid' => $this->getGuid('guid'),
|
||||
'created_by' => $this->user->id
|
||||
];
|
||||
}
|
134
src/68a0f9af-265a-4db1-bae9-a4e4531f94d7/README.md
Normal file
134
src/68a0f9af-265a-4db1-bae9-a4e4531f94d7/README.md
Normal file
@ -0,0 +1,134 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# final class Item (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Import**
|
||||
|
||||
```uml
|
||||
@startuml
|
||||
class Item << (F,LightGreen) >> #RoyalBlue {
|
||||
# Validator $validator
|
||||
# Item $item
|
||||
# Row $row
|
||||
+ __construct(Validator $validator, Item $item, ...)
|
||||
+ get(string $table, array $columns) : ?array
|
||||
- getImportValue(mixed $value, string $field, ...) : mixed
|
||||
- validImportValue(mixed $value, string $field, ...) : mixed
|
||||
- getLocalValue(mixed $value, array $link) : mixed|null
|
||||
- isValueExists(mixed $value, array $link) : bool
|
||||
- setLocalValue(mixed $value, array $link) : mixed|null
|
||||
- insertItemWithGuid(mixed $value, array $link) : ?string
|
||||
- insertItemWithId(mixed $value, array $link) : mixed|null
|
||||
}
|
||||
|
||||
note right of Item::__construct
|
||||
Constructor.
|
||||
|
||||
since: 4.0.3
|
||||
|
||||
arguments:
|
||||
Validator $validator
|
||||
Item $item
|
||||
Row $row
|
||||
end note
|
||||
|
||||
note left of Item::get
|
||||
Get the item from the import row values and ensure it is valid
|
||||
|
||||
since: 4.0.3
|
||||
return: ?array
|
||||
end note
|
||||
|
||||
note right of Item::getImportValue
|
||||
Get the correct value needed for the import of the related row (item).
|
||||
|
||||
since: 4.0.3
|
||||
return: mixed
|
||||
|
||||
arguments:
|
||||
mixed $value
|
||||
string $field
|
||||
string $table
|
||||
?array $link
|
||||
end note
|
||||
|
||||
note left of Item::validImportValue
|
||||
Make sure we have a valid import value
|
||||
|
||||
since: 4.0.3
|
||||
return: mixed
|
||||
|
||||
arguments:
|
||||
mixed $value
|
||||
string $field
|
||||
string $table
|
||||
end note
|
||||
|
||||
note right of Item::getLocalValue
|
||||
Helper function to get the local value from the database table.
|
||||
|
||||
since: 4.0.3
|
||||
return: mixed|null
|
||||
end note
|
||||
|
||||
note left of Item::isValueExists
|
||||
Check if the value exists in the table for the given link.
|
||||
|
||||
since: 4.0.3
|
||||
return: bool
|
||||
end note
|
||||
|
||||
note right of Item::setLocalValue
|
||||
Create a new value in the database table if it doesn't already exist.
|
||||
|
||||
since: 4.0.3
|
||||
return: mixed|null
|
||||
end note
|
||||
|
||||
note left of Item::insertItemWithGuid
|
||||
Insert a new item with a GUID.
|
||||
|
||||
since: 4.0.3
|
||||
return: ?string
|
||||
end note
|
||||
|
||||
note right of Item::insertItemWithId
|
||||
Insert a new item with a non-numeric ID.
|
||||
|
||||
since: 4.0.3
|
||||
return: mixed|null
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
|
||||
|
||||
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
|
||||
|
||||
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
|
||||
|
||||
To add this specific Power to your project in JCB:
|
||||
|
||||
> simply use this SPK
|
||||
```
|
||||
Super---68a0f9af_265a_4db1_bae9_a4e4531f94d7---Power
|
||||
```
|
||||
> remember to replace the `---` with `___` to activate this Power in your code
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
269
src/68a0f9af-265a-4db1-bae9-a4e4531f94d7/code.php
Normal file
269
src/68a0f9af-265a-4db1-bae9-a4e4531f94d7/code.php
Normal file
@ -0,0 +1,269 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Import;
|
||||
|
||||
|
||||
use VDM\Joomla\Interfaces\TableValidatorInterface as Validator;
|
||||
use VDM\Joomla\Interfaces\Data\ItemInterface as Item;
|
||||
use VDM\Joomla\Componentbuilder\Interfaces\ImportRowInterface as Row;
|
||||
use VDM\Joomla\Componentbuilder\Interfaces\ImportItemInterface;
|
||||
|
||||
|
||||
/**
|
||||
* Import Item Class
|
||||
*
|
||||
* @since 4.0.3
|
||||
*/
|
||||
final class Item implements ImportItemInterface
|
||||
{
|
||||
/**
|
||||
* The Table Validator Class.
|
||||
*
|
||||
* @var Validator
|
||||
* @since 4.0.3
|
||||
*/
|
||||
protected Validator $validator;
|
||||
|
||||
/**
|
||||
* The Item Class.
|
||||
*
|
||||
* @var Item
|
||||
* @since 4.0.3
|
||||
*/
|
||||
protected Item $item;
|
||||
|
||||
/**
|
||||
* The Import Row Class.
|
||||
*
|
||||
* @var Row
|
||||
* @since 4.0.3
|
||||
*/
|
||||
protected Row $row;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Validator $validator The Table ValidatorI Class.
|
||||
* @param Item $item The Item Class.
|
||||
* @param Row $row The Import Row Class.
|
||||
*
|
||||
* @since 4.0.3
|
||||
*/
|
||||
public function __construct(Validator $validator, Item $item, Row $row)
|
||||
{
|
||||
$this->validator = $validator;
|
||||
$this->item = $item;
|
||||
$this->row = $row;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the item from the import row values and ensure it is valid
|
||||
*
|
||||
* @param string $table The table these columns belongs to.
|
||||
* @param array $columns The columns to extract.
|
||||
*
|
||||
* @return array|null
|
||||
* @since 4.0.3
|
||||
*/
|
||||
public function get(string $table, array $columns): ?array
|
||||
{
|
||||
$item = [];
|
||||
foreach ($columns as $column => $map)
|
||||
{
|
||||
if (($value = $this->row->getValue($column)) !== null && !isset($item[$map['name']]))
|
||||
{
|
||||
// get the valid importable value
|
||||
$item[$map['name']] = $this->getImportValue($value, $map['name'], $table, $map['link'] ?? null);
|
||||
|
||||
// remove value from global row values set
|
||||
$this->row->unsetValue($column);
|
||||
}
|
||||
}
|
||||
|
||||
return $item ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the correct value needed for the import of the related row (item).
|
||||
*
|
||||
* @param mixed $value The value from the row.
|
||||
* @param string $field The field name where the value is being stored.
|
||||
* @param string $table The table this field belongs to.
|
||||
* @param array $link The field link values.
|
||||
*
|
||||
* @return mixed
|
||||
* @since 4.0.3
|
||||
*/
|
||||
private function getImportValue($value, string $field, string $table, ?array $link)
|
||||
{
|
||||
// Validate the link array and return the original value if invalid
|
||||
if (empty($link) || $link['type'] !== 1 || empty($link['table']) || empty($link['key']) || empty($link['value']))
|
||||
{
|
||||
return $this->validImportValue($value, $field, $table);
|
||||
}
|
||||
|
||||
// Handle GUID key with validation via GuidHelper
|
||||
if ($link['key'] === 'guid' && GuidHelper::item($value, $link['table']))
|
||||
{
|
||||
return $value;
|
||||
}
|
||||
|
||||
// Handle numeric ID with validation
|
||||
if ($link['key'] === 'id' && is_numeric($value) && $this->isValueExists($value, $link))
|
||||
{
|
||||
return (int) $value;
|
||||
}
|
||||
|
||||
// Attempt to retrieve the local value
|
||||
$local_value = $this->getLocalValue($value, $link);
|
||||
|
||||
// If no local value exists, create it if necessary
|
||||
if ($local_value === null)
|
||||
{
|
||||
$local_value = $this->setLocalValue($value, $link);
|
||||
}
|
||||
|
||||
return $this->validImportValue($local_value, $field, $table);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make sure we have a valid import value
|
||||
*
|
||||
* @param mixed $value The value.
|
||||
* @param string $field The field name where the value is being stored.
|
||||
* @param string $table The table this field belongs to.
|
||||
*
|
||||
* @return mixed
|
||||
* @since 4.0.3
|
||||
*/
|
||||
private function validImportValue($value, string $field, string $table)
|
||||
{
|
||||
// make sure our value will fit in the database table datatype
|
||||
return $this->validator->getValid($value, $field, $table);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to get the local value from the database table.
|
||||
*
|
||||
* @param mixed $value The value to search for.
|
||||
* @param array $link The field link details.
|
||||
*
|
||||
* @return mixed|null The local value or null if not found.
|
||||
* @since 4.0.3
|
||||
*/
|
||||
private function getLocalValue($value, array $link)
|
||||
{
|
||||
// Attempt to retrieve the value based on the link['value'] and link['key']
|
||||
$local_value = $this->item->table($link['table'])->value($value, $link['value'], $link['key']);
|
||||
|
||||
// If not found, try retrieving by link['key'] and link['key']
|
||||
if ($local_value === null && $this->isValueExists($value, $link))
|
||||
{
|
||||
return $value;
|
||||
}
|
||||
|
||||
return $local_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the value exists in the table for the given link.
|
||||
*
|
||||
* @param mixed $value The value to check.
|
||||
* @param array $link The field link details.
|
||||
*
|
||||
* @return bool True if the value exists, false otherwise.
|
||||
* @since 4.0.3
|
||||
*/
|
||||
private function isValueExists($value, array $link): bool
|
||||
{
|
||||
return $this->item->table($link['table'])->value($value, $link['key'], $link['key']) !== null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new value in the database table if it doesn't already exist.
|
||||
*
|
||||
* @param mixed $value The value to create.
|
||||
* @param array $link The field link details.
|
||||
*
|
||||
* @return mixed|null The newly created value or null if creation failed.
|
||||
* @since 4.0.3
|
||||
*/
|
||||
private function setLocalValue($value, array $link)
|
||||
{
|
||||
// Handle GUID creation if the provided value is not valid
|
||||
if ($link['key'] === 'guid')
|
||||
{
|
||||
if (!GuidHelper::valid($value))
|
||||
{
|
||||
return $this->insertItemWithGuid($value, $link);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Handle ID creation
|
||||
if ($link['key'] === 'id')
|
||||
{
|
||||
if (!is_numeric($value))
|
||||
{
|
||||
return $this->insertItemWithId($value, $link);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// could not create local item (we don't have enough details)
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert a new item with a GUID.
|
||||
*
|
||||
* @param mixed $value The value to insert.
|
||||
* @param array $link The field link details.
|
||||
*
|
||||
* @return string|null The new GUID or null if insertion failed.
|
||||
* @since 4.0.3
|
||||
*/
|
||||
private function insertItemWithGuid($value, array $link): ?string
|
||||
{
|
||||
$guid = GuidHelper::get();
|
||||
$item = (object) [$link['value'] => $value, $link['key'] => $guid];
|
||||
|
||||
if ($this->item->table($link['table'])->set($item, $link['key'], 'insert'))
|
||||
{
|
||||
return $guid;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert a new item with a non-numeric ID.
|
||||
*
|
||||
* @param mixed $value The value to insert.
|
||||
* @param array $link The field link details.
|
||||
*
|
||||
* @return mixed|null The new ID or null if insertion failed.
|
||||
* @since 4.0.3
|
||||
*/
|
||||
private function insertItemWithId($value, array $link)
|
||||
{
|
||||
$item = (object) [$link['key'] => 0, $link['value'] => $value];
|
||||
|
||||
if ($this->item->table($link['table'])->set($item, $link['key'], 'insert'))
|
||||
{
|
||||
return $this->item->table($link['table'])->value($value, $link['value'], $link['key']);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
240
src/68a0f9af-265a-4db1-bae9-a4e4531f94d7/code.power
Normal file
240
src/68a0f9af-265a-4db1-bae9-a4e4531f94d7/code.power
Normal file
@ -0,0 +1,240 @@
|
||||
/**
|
||||
* The Table Validator Class.
|
||||
*
|
||||
* @var Validator
|
||||
* @since 4.0.3
|
||||
*/
|
||||
protected Validator $validator;
|
||||
|
||||
/**
|
||||
* The Item Class.
|
||||
*
|
||||
* @var Item
|
||||
* @since 4.0.3
|
||||
*/
|
||||
protected Item $item;
|
||||
|
||||
/**
|
||||
* The Import Row Class.
|
||||
*
|
||||
* @var Row
|
||||
* @since 4.0.3
|
||||
*/
|
||||
protected Row $row;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Validator $validator The Table ValidatorI Class.
|
||||
* @param Item $item The Item Class.
|
||||
* @param Row $row The Import Row Class.
|
||||
*
|
||||
* @since 4.0.3
|
||||
*/
|
||||
public function __construct(Validator $validator, Item $item, Row $row)
|
||||
{
|
||||
$this->validator = $validator;
|
||||
$this->item = $item;
|
||||
$this->row = $row;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the item from the import row values and ensure it is valid
|
||||
*
|
||||
* @param string $table The table these columns belongs to.
|
||||
* @param array $columns The columns to extract.
|
||||
*
|
||||
* @return array|null
|
||||
* @since 4.0.3
|
||||
*/
|
||||
public function get(string $table, array $columns): ?array
|
||||
{
|
||||
$item = [];
|
||||
foreach ($columns as $column => $map)
|
||||
{
|
||||
if (($value = $this->row->getValue($column)) !== null && !isset($item[$map['name']]))
|
||||
{
|
||||
// get the valid importable value
|
||||
$item[$map['name']] = $this->getImportValue($value, $map['name'], $table, $map['link'] ?? null);
|
||||
|
||||
// remove value from global row values set
|
||||
$this->row->unsetValue($column);
|
||||
}
|
||||
}
|
||||
|
||||
return $item ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the correct value needed for the import of the related row (item).
|
||||
*
|
||||
* @param mixed $value The value from the row.
|
||||
* @param string $field The field name where the value is being stored.
|
||||
* @param string $table The table this field belongs to.
|
||||
* @param array $link The field link values.
|
||||
*
|
||||
* @return mixed
|
||||
* @since 4.0.3
|
||||
*/
|
||||
private function getImportValue($value, string $field, string $table, ?array $link)
|
||||
{
|
||||
// Validate the link array and return the original value if invalid
|
||||
if (empty($link) || $link['type'] !== 1 || empty($link['table']) || empty($link['key']) || empty($link['value']))
|
||||
{
|
||||
return $this->validImportValue($value, $field, $table);
|
||||
}
|
||||
|
||||
// Handle GUID key with validation via GuidHelper
|
||||
if ($link['key'] === 'guid' && GuidHelper::item($value, $link['table']))
|
||||
{
|
||||
return $value;
|
||||
}
|
||||
|
||||
// Handle numeric ID with validation
|
||||
if ($link['key'] === 'id' && is_numeric($value) && $this->isValueExists($value, $link))
|
||||
{
|
||||
return (int) $value;
|
||||
}
|
||||
|
||||
// Attempt to retrieve the local value
|
||||
$local_value = $this->getLocalValue($value, $link);
|
||||
|
||||
// If no local value exists, create it if necessary
|
||||
if ($local_value === null)
|
||||
{
|
||||
$local_value = $this->setLocalValue($value, $link);
|
||||
}
|
||||
|
||||
return $this->validImportValue($local_value, $field, $table);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make sure we have a valid import value
|
||||
*
|
||||
* @param mixed $value The value.
|
||||
* @param string $field The field name where the value is being stored.
|
||||
* @param string $table The table this field belongs to.
|
||||
*
|
||||
* @return mixed
|
||||
* @since 4.0.3
|
||||
*/
|
||||
private function validImportValue($value, string $field, string $table)
|
||||
{
|
||||
// make sure our value will fit in the database table datatype
|
||||
return $this->validator->getValid($value, $field, $table);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to get the local value from the database table.
|
||||
*
|
||||
* @param mixed $value The value to search for.
|
||||
* @param array $link The field link details.
|
||||
*
|
||||
* @return mixed|null The local value or null if not found.
|
||||
* @since 4.0.3
|
||||
*/
|
||||
private function getLocalValue($value, array $link)
|
||||
{
|
||||
// Attempt to retrieve the value based on the link['value'] and link['key']
|
||||
$local_value = $this->item->table($link['table'])->value($value, $link['value'], $link['key']);
|
||||
|
||||
// If not found, try retrieving by link['key'] and link['key']
|
||||
if ($local_value === null && $this->isValueExists($value, $link))
|
||||
{
|
||||
return $value;
|
||||
}
|
||||
|
||||
return $local_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the value exists in the table for the given link.
|
||||
*
|
||||
* @param mixed $value The value to check.
|
||||
* @param array $link The field link details.
|
||||
*
|
||||
* @return bool True if the value exists, false otherwise.
|
||||
* @since 4.0.3
|
||||
*/
|
||||
private function isValueExists($value, array $link): bool
|
||||
{
|
||||
return $this->item->table($link['table'])->value($value, $link['key'], $link['key']) !== null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new value in the database table if it doesn't already exist.
|
||||
*
|
||||
* @param mixed $value The value to create.
|
||||
* @param array $link The field link details.
|
||||
*
|
||||
* @return mixed|null The newly created value or null if creation failed.
|
||||
* @since 4.0.3
|
||||
*/
|
||||
private function setLocalValue($value, array $link)
|
||||
{
|
||||
// Handle GUID creation if the provided value is not valid
|
||||
if ($link['key'] === 'guid')
|
||||
{
|
||||
if (!GuidHelper::valid($value))
|
||||
{
|
||||
return $this->insertItemWithGuid($value, $link);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Handle ID creation
|
||||
if ($link['key'] === 'id')
|
||||
{
|
||||
if (!is_numeric($value))
|
||||
{
|
||||
return $this->insertItemWithId($value, $link);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// could not create local item (we don't have enough details)
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert a new item with a GUID.
|
||||
*
|
||||
* @param mixed $value The value to insert.
|
||||
* @param array $link The field link details.
|
||||
*
|
||||
* @return string|null The new GUID or null if insertion failed.
|
||||
* @since 4.0.3
|
||||
*/
|
||||
private function insertItemWithGuid($value, array $link): ?string
|
||||
{
|
||||
$guid = GuidHelper::get();
|
||||
$item = (object) [$link['value'] => $value, $link['key'] => $guid];
|
||||
|
||||
if ($this->item->table($link['table'])->set($item, $link['key'], 'insert'))
|
||||
{
|
||||
return $guid;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert a new item with a non-numeric ID.
|
||||
*
|
||||
* @param mixed $value The value to insert.
|
||||
* @param array $link The field link details.
|
||||
*
|
||||
* @return mixed|null The new ID or null if insertion failed.
|
||||
* @since 4.0.3
|
||||
*/
|
||||
private function insertItemWithId($value, array $link)
|
||||
{
|
||||
$item = (object) [$link['key'] => 0, $link['value'] => $value];
|
||||
|
||||
if ($this->item->table($link['table'])->set($item, $link['key'], 'insert'))
|
||||
{
|
||||
return $this->item->table($link['table'])->value($value, $link['value'], $link['key']);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
34
src/68a0f9af-265a-4db1-bae9-a4e4531f94d7/settings.json
Normal file
34
src/68a0f9af-265a-4db1-bae9-a4e4531f94d7/settings.json
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "",
|
||||
"guid": "68a0f9af-265a-4db1-bae9-a4e4531f94d7",
|
||||
"implements": [
|
||||
"53f55e5b-63cb-49e7-b1e6-33e7a9f97856"
|
||||
],
|
||||
"load_selection": null,
|
||||
"name": "Item",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Import.Item",
|
||||
"type": "final class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "feb3affa-5102-4307-93db-04525f4c66f0",
|
||||
"as": "Validator"
|
||||
},
|
||||
"use_selection1": {
|
||||
"use": "05744dd3-4030-4cf8-8dda-a93ab809b473",
|
||||
"as": "Item"
|
||||
},
|
||||
"use_selection2": {
|
||||
"use": "3d3ec064-9867-41e6-a48a-964c15d753aa",
|
||||
"as": "Row"
|
||||
}
|
||||
},
|
||||
"extendsinterfaces": null,
|
||||
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Import.Item",
|
||||
"description": "Import Item Class\r\n\r\n@since 4.0.3",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "",
|
||||
"composer": ""
|
||||
}
|
@ -14,9 +14,11 @@
|
||||
abstract Database #Orange {
|
||||
# $db
|
||||
# string $table
|
||||
# string $dateFormat
|
||||
+ __construct()
|
||||
# quote(mixed $value) : mixed
|
||||
# getTable(string $table) : string
|
||||
# getDateFormat() : string
|
||||
}
|
||||
|
||||
note right of Database::__construct
|
||||
@ -39,6 +41,13 @@ core component as needed
|
||||
since: 3.2.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
note right of Database::getDateFormat
|
||||
Get the date format to return in the quote
|
||||
|
||||
since: 5.0.2
|
||||
return: string
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
@ -38,6 +38,14 @@ abstract class Database
|
||||
*/
|
||||
protected string $table;
|
||||
|
||||
/**
|
||||
* Date format to return
|
||||
*
|
||||
* @var string
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected string $dateFormat = 'Y-m-d H:i:s';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -62,23 +70,32 @@ abstract class Database
|
||||
**/
|
||||
protected function quote($value)
|
||||
{
|
||||
if ($value === null) // hmm the null does pose an issue (will keep an eye on this)
|
||||
if ($value === null)
|
||||
{
|
||||
return 'NULL';
|
||||
}
|
||||
|
||||
if (is_numeric($value))
|
||||
{
|
||||
// If the value is a numeric string (e.g., "0123"), treat it as a string to preserve the format
|
||||
if (is_string($value) && ltrim($value, '0') !== $value)
|
||||
{
|
||||
return $this->db->quote($value);
|
||||
}
|
||||
|
||||
if (filter_var($value, FILTER_VALIDATE_INT))
|
||||
{
|
||||
return (int) $value;
|
||||
}
|
||||
elseif (filter_var($value, FILTER_VALIDATE_FLOAT))
|
||||
|
||||
if (filter_var($value, FILTER_VALIDATE_FLOAT))
|
||||
{
|
||||
return (float) $value;
|
||||
}
|
||||
}
|
||||
elseif (is_bool($value)) // not sure if this will work well (but its correct)
|
||||
|
||||
// Handle boolean values
|
||||
if (is_bool($value))
|
||||
{
|
||||
return $value ? 'TRUE' : 'FALSE';
|
||||
}
|
||||
@ -86,10 +103,10 @@ abstract class Database
|
||||
// For date and datetime values
|
||||
if ($value instanceof \DateTime)
|
||||
{
|
||||
return $this->db->quote($value->format('Y-m-d H:i:s'));
|
||||
return $this->db->quote($value->format($this->getDateFormat()));
|
||||
}
|
||||
|
||||
// For other data types, just escape it
|
||||
// For other types of values, quote as string
|
||||
return $this->db->quote($value);
|
||||
}
|
||||
|
||||
@ -110,6 +127,17 @@ abstract class Database
|
||||
}
|
||||
|
||||
return $table;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the date format to return in the quote
|
||||
*
|
||||
* @return string
|
||||
* @since 5.0.2
|
||||
**/
|
||||
protected function getDateFormat(): string
|
||||
{
|
||||
return $this->dateFormat;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,14 @@
|
||||
*/
|
||||
protected string $table;
|
||||
|
||||
/**
|
||||
* Date format to return
|
||||
*
|
||||
* @var string
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected string $dateFormat = 'Y-m-d H:i:s';
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -37,23 +45,32 @@
|
||||
**/
|
||||
protected function quote($value)
|
||||
{
|
||||
if ($value === null) // hmm the null does pose an issue (will keep an eye on this)
|
||||
if ($value === null)
|
||||
{
|
||||
return 'NULL';
|
||||
}
|
||||
|
||||
if (is_numeric($value))
|
||||
{
|
||||
// If the value is a numeric string (e.g., "0123"), treat it as a string to preserve the format
|
||||
if (is_string($value) && ltrim($value, '0') !== $value)
|
||||
{
|
||||
return $this->db->quote($value);
|
||||
}
|
||||
|
||||
if (filter_var($value, FILTER_VALIDATE_INT))
|
||||
{
|
||||
return (int) $value;
|
||||
}
|
||||
elseif (filter_var($value, FILTER_VALIDATE_FLOAT))
|
||||
|
||||
if (filter_var($value, FILTER_VALIDATE_FLOAT))
|
||||
{
|
||||
return (float) $value;
|
||||
}
|
||||
}
|
||||
elseif (is_bool($value)) // not sure if this will work well (but its correct)
|
||||
|
||||
// Handle boolean values
|
||||
if (is_bool($value))
|
||||
{
|
||||
return $value ? 'TRUE' : 'FALSE';
|
||||
}
|
||||
@ -61,10 +78,10 @@
|
||||
// For date and datetime values
|
||||
if ($value instanceof \DateTime)
|
||||
{
|
||||
return $this->db->quote($value->format('Y-m-d H:i:s'));
|
||||
return $this->db->quote($value->format($this->getDateFormat()));
|
||||
}
|
||||
|
||||
// For other data types, just escape it
|
||||
// For other types of values, quote as string
|
||||
return $this->db->quote($value);
|
||||
}
|
||||
|
||||
@ -85,4 +102,15 @@
|
||||
}
|
||||
|
||||
return $table;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the date format to return in the quote
|
||||
*
|
||||
* @return string
|
||||
* @since 5.0.2
|
||||
**/
|
||||
protected function getDateFormat(): string
|
||||
{
|
||||
return $this->dateFormat;
|
||||
}
|
183
src/79fd4f39-824d-4ab6-936d-959705ff24ec/README.md
Normal file
183
src/79fd4f39-824d-4ab6-936d-959705ff24ec/README.md
Normal file
@ -0,0 +1,183 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# final class Validator (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Table**
|
||||
|
||||
```uml
|
||||
@startuml
|
||||
class Validator << (F,LightGreen) >> #RoyalBlue {
|
||||
# Table $table
|
||||
# array $validators
|
||||
# array $defaults
|
||||
+ __construct(Table $table)
|
||||
+ getValid(mixed $value, string $field, ...) : mixed
|
||||
- validate(mixed $value, array $dbField) : bool
|
||||
- getDefault(array $dbField, mixed $value) : mixed
|
||||
- parseDataType(string $datatype) : array
|
||||
- getDatabaseField(string $field, string $table) : array
|
||||
- registerValidators() : void
|
||||
- registerDefaults() : void
|
||||
- validateInteger(mixed $value, array $typeInfo) : bool
|
||||
- validateString(mixed $value, array $typeInfo) : bool
|
||||
- validateText(mixed $value, array $typeInfo) : bool
|
||||
- validateFloat(mixed $value, array $typeInfo) : bool
|
||||
- validateDecimal(mixed $value, array $typeInfo) : bool
|
||||
- validateDate(mixed $value, array $typeInfo) : bool
|
||||
- validateJson(mixed $value, array $typeInfo) : bool
|
||||
- validateBlob(mixed $value, array $typeInfo) : bool
|
||||
}
|
||||
|
||||
note right of Validator::__construct
|
||||
Constructor.
|
||||
|
||||
since: 5.3.0
|
||||
end note
|
||||
|
||||
note left of Validator::getValid
|
||||
Returns the valid value based on datatype definition.
|
||||
If the value is valid, return it. If not, return the default value,
|
||||
NULL (if allowed), or an empty string if 'EMPTY' is set.
|
||||
|
||||
since: 5.3.0
|
||||
return: mixed
|
||||
|
||||
arguments:
|
||||
mixed $value
|
||||
string $field
|
||||
string $table
|
||||
end note
|
||||
|
||||
note right of Validator::validate
|
||||
Validate if the given value is valid for the provided database field.
|
||||
This is a private method as `getValid()` will handle the actual logic.
|
||||
|
||||
since: 5.3.0
|
||||
return: bool
|
||||
end note
|
||||
|
||||
note left of Validator::getDefault
|
||||
Handle returning the default value, null, or empty string if validation fails.
|
||||
|
||||
since: 5.3.0
|
||||
return: mixed
|
||||
end note
|
||||
|
||||
note right of Validator::parseDataType
|
||||
Parse the data type from the database field and extract details like type, size, and precision.
|
||||
|
||||
since: 5.3.0
|
||||
return: array
|
||||
end note
|
||||
|
||||
note left of Validator::getDatabaseField
|
||||
Retrieve the database field structure for the specified field and table.
|
||||
In your case, you use `$db = $this->table->get($table, $field, 'db')`.
|
||||
|
||||
since: 5.3.0
|
||||
return: array
|
||||
end note
|
||||
|
||||
note right of Validator::registerValidators
|
||||
Register validators for MySQL data types.
|
||||
|
||||
since: 5.3.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
note left of Validator::registerDefaults
|
||||
Register default values for MySQL data types.
|
||||
|
||||
since: 5.3.0
|
||||
return: void
|
||||
end note
|
||||
|
||||
note right of Validator::validateInteger
|
||||
Validate integer types (including tinyint, smallint, mediumint, etc.).
|
||||
|
||||
since: 5.3.0
|
||||
return: bool
|
||||
end note
|
||||
|
||||
note left of Validator::validateString
|
||||
Validate string types like VARCHAR and CHAR.
|
||||
|
||||
since: 5.3.0
|
||||
return: bool
|
||||
end note
|
||||
|
||||
note right of Validator::validateText
|
||||
Validate text types like TEXT, TINYTEXT, MEDIUMTEXT, LONGTEXT.
|
||||
|
||||
since: 5.3.0
|
||||
return: bool
|
||||
end note
|
||||
|
||||
note left of Validator::validateFloat
|
||||
Validate float, double, and decimal types.
|
||||
|
||||
since: 5.3.0
|
||||
return: bool
|
||||
end note
|
||||
|
||||
note right of Validator::validateDecimal
|
||||
Validate decimal types (numeric precision and scale).
|
||||
|
||||
since: 5.3.0
|
||||
return: bool
|
||||
end note
|
||||
|
||||
note left of Validator::validateDate
|
||||
Validate date, datetime, timestamp, and time types.
|
||||
|
||||
since: 5.3.0
|
||||
return: bool
|
||||
end note
|
||||
|
||||
note right of Validator::validateJson
|
||||
Validate JSON types.
|
||||
|
||||
since: 5.3.0
|
||||
return: bool
|
||||
end note
|
||||
|
||||
note left of Validator::validateBlob
|
||||
Validate BLOB types (including TINYBLOB, MEDIUMBLOB, LONGBLOB).
|
||||
|
||||
since: 5.3.0
|
||||
return: bool
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
|
||||
|
||||
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
|
||||
|
||||
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
|
||||
|
||||
To add this specific Power to your project in JCB:
|
||||
|
||||
> simply use this SPK
|
||||
```
|
||||
Super---79fd4f39_824d_4ab6_936d_959705ff24ec---Power
|
||||
```
|
||||
> remember to replace the `---` with `___` to activate this Power in your code
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
411
src/79fd4f39-824d-4ab6-936d-959705ff24ec/code.php
Normal file
411
src/79fd4f39-824d-4ab6-936d-959705ff24ec/code.php
Normal file
@ -0,0 +1,411 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Table;
|
||||
|
||||
|
||||
use VDM\Joomla\Componentbuilder\Table;
|
||||
use VDM\Joomla\Interfaces\TableValidatorInterface;
|
||||
|
||||
|
||||
/**
|
||||
* Table Value Validator
|
||||
*
|
||||
* @since 5.3.0
|
||||
*/
|
||||
final class Validator implements TableValidatorInterface
|
||||
{
|
||||
/**
|
||||
* The Table Class.
|
||||
*
|
||||
* @var Table
|
||||
* @since 5.3.0
|
||||
*/
|
||||
protected Table $table;
|
||||
|
||||
/**
|
||||
* A map of MySQL base types to their respective validation methods.
|
||||
*
|
||||
* @var array
|
||||
* @since 5.3.0
|
||||
*/
|
||||
protected array $validators = [];
|
||||
|
||||
/**
|
||||
* A map of defauts for the respective datatypes.
|
||||
*
|
||||
* @var array
|
||||
* @since 5.3.0
|
||||
*/
|
||||
protected array $defaults = [];
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Table $table The Table Class.
|
||||
*
|
||||
* @since 5.3.0
|
||||
*/
|
||||
public function __construct(Table $table)
|
||||
{
|
||||
$this->table = $table;
|
||||
|
||||
// Register datatype validators (mapping MySQL types to handlers)
|
||||
$this->registerValidators();
|
||||
|
||||
// Register datatype defaults
|
||||
$this->registerDefaults();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the valid value based on datatype definition.
|
||||
* If the value is valid, return it. If not, return the default value,
|
||||
* NULL (if allowed), or an empty string if 'EMPTY' is set.
|
||||
*
|
||||
* @param mixed $value The value to validate.
|
||||
* @param string $field The field name.
|
||||
* @param string $table The table name.
|
||||
*
|
||||
* @return mixed Returns the valid value, or the default, NULL, or empty string based on validation.
|
||||
* @since 5.3.0
|
||||
*/
|
||||
public function getValid($value, string $field, string $table)
|
||||
{
|
||||
// Get the database field definition
|
||||
if (($dbField = $this->getDatabaseField($field, $table)) === null)
|
||||
{
|
||||
return null; // not legal field or table
|
||||
}
|
||||
|
||||
// Check if the value is valid for the field
|
||||
if ($this->validate($value, $dbField))
|
||||
{
|
||||
return $value;
|
||||
}
|
||||
|
||||
// If invalid, return default, NULL (if allowed), or empty string
|
||||
return $this->getDefault($dbField, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate if the given value is valid for the provided database field.
|
||||
* This is a private method as `getValid()` will handle the actual logic.
|
||||
*
|
||||
* @param mixed $value The value to validate.
|
||||
* @param array $dbField The database field details (type, default, null_switch, etc.).
|
||||
*
|
||||
* @return bool Returns true if the value is valid, false otherwise.
|
||||
* @since 5.3.0
|
||||
*/
|
||||
private function validate($value, array $dbField): bool
|
||||
{
|
||||
// Extract datatype and handle the validation
|
||||
$typeInfo = $this->parseDataType($dbField['type']);
|
||||
$baseType = $typeInfo['type'];
|
||||
|
||||
// Use the appropriate validator if it exists
|
||||
if (isset($this->validators[$baseType]))
|
||||
{
|
||||
return call_user_func($this->validators[$baseType], $value, $typeInfo);
|
||||
}
|
||||
|
||||
// If no validator exists, assume invalid
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle returning the default value, null, or empty string if validation fails.
|
||||
*
|
||||
* @param array $dbField The database field details.
|
||||
* @param mixed $value The value to validate.
|
||||
*
|
||||
* @return mixed The default value, null, or empty string based on field settings.
|
||||
* @since 5.3.0
|
||||
*/
|
||||
private function getDefault(array $dbField, $value)
|
||||
{
|
||||
// get default value from field db
|
||||
$db_default = isset($dbField['default']) ? $dbField['default'] : null;
|
||||
|
||||
// If a default value is provided, return it
|
||||
if ($db_default !== null)
|
||||
{
|
||||
return strtoupper($db_default) === 'EMPTY' ? '' : $db_default;
|
||||
}
|
||||
|
||||
// Check if NULL is allowed
|
||||
if (isset($dbField['null_switch']) && strtoupper($dbField['null_switch']) === 'NULL')
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Fallback to datatype default
|
||||
$typeInfo = $this->parseDataType($dbField['type']);
|
||||
return $this->defaults[$typeInfo['type']] ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the data type from the database field and extract details like type, size, and precision.
|
||||
*
|
||||
* @param string $datatype The full MySQL datatype (e.g., VARCHAR(255)).
|
||||
*
|
||||
* @return array An array containing 'type', 'size', and other relevant info.
|
||||
* @since 5.3.0
|
||||
*/
|
||||
private function parseDataType(string $datatype): array
|
||||
{
|
||||
$pattern = '/(?<type>\w+)(\((?<size>\d+)(,\s*(?<precision>\d+))?\))?/i';
|
||||
preg_match($pattern, $datatype, $matches);
|
||||
|
||||
return [
|
||||
'type' => isset($matches['type']) ? strtolower($matches['type']) : strtolower($datatype),
|
||||
'size' => $matches['size'] ?? null,
|
||||
'precision' => $matches['precision'] ?? null,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the database field structure for the specified field and table.
|
||||
* In your case, you use `$db = $this->table->get($table, $field, 'db')`.
|
||||
*
|
||||
* @param string $field The field name.
|
||||
* @param string $table The table name.
|
||||
*
|
||||
* @return array The database field details, including type, default, null_switch, etc.
|
||||
* @since 5.3.0
|
||||
*/
|
||||
private function getDatabaseField(string $field, string $table): array
|
||||
{
|
||||
// Simulated retrieval of field details. Replace with actual logic.
|
||||
return $this->table->get($table, $field, 'db');
|
||||
}
|
||||
|
||||
/**
|
||||
* Register validators for MySQL data types.
|
||||
*
|
||||
* @return void
|
||||
* @since 5.3.0
|
||||
*/
|
||||
private function registerValidators(): void
|
||||
{
|
||||
$this->validators = [
|
||||
'int' => [$this, 'validateInteger'],
|
||||
'tinyint' => [$this, 'validateInteger'],
|
||||
'smallint' => [$this, 'validateInteger'],
|
||||
'mediumint' => [$this, 'validateInteger'],
|
||||
'bigint' => [$this, 'validateInteger'],
|
||||
'varchar' => [$this, 'validateString'],
|
||||
'char' => [$this, 'validateString'],
|
||||
'text' => [$this, 'validateText'],
|
||||
'tinytext' => [$this, 'validateText'],
|
||||
'mediumtext' => [$this, 'validateText'],
|
||||
'longtext' => [$this, 'validateText'],
|
||||
'decimal' => [$this, 'validateDecimal'],
|
||||
'float' => [$this, 'validateFloat'],
|
||||
'double' => [$this, 'validateFloat'],
|
||||
'date' => [$this, 'validateDate'],
|
||||
'datetime' => [$this, 'validateDate'],
|
||||
'timestamp' => [$this, 'validateDate'],
|
||||
'time' => [$this, 'validateDate'],
|
||||
'json' => [$this, 'validateJson'],
|
||||
'blob' => [$this, 'validateBlob'],
|
||||
'tinyblob' => [$this, 'validateBlob'],
|
||||
'mediumblob' => [$this, 'validateBlob'],
|
||||
'longblob' => [$this, 'validateBlob'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Register default values for MySQL data types.
|
||||
*
|
||||
* @return void
|
||||
* @since 5.3.0
|
||||
*/
|
||||
private function registerDefaults(): void
|
||||
{
|
||||
$this->defaults = [
|
||||
'int' => 0,
|
||||
'tinyint' => 0,
|
||||
'smallint' => 0,
|
||||
'mediumint' => 0,
|
||||
'bigint' => 0,
|
||||
'varchar' => '',
|
||||
'char' => '',
|
||||
'text' => '',
|
||||
'tinytext' => '',
|
||||
'mediumtext' => '',
|
||||
'longtext' => '',
|
||||
'decimal' => 0.0,
|
||||
'float' => 0.0,
|
||||
'double' => 0.0,
|
||||
'date' => '0000-00-00',
|
||||
'datetime' => '0000-00-00 00:00:00',
|
||||
'timestamp' => '0000-00-00 00:00:00',
|
||||
'time' => '00:00:00',
|
||||
'json' => '{}',
|
||||
'blob' => '',
|
||||
'tinyblob' => '',
|
||||
'mediumblob' => '',
|
||||
'longblob' => '',
|
||||
];
|
||||
}
|
||||
|
||||
// ----------------- Validation Methods -----------------
|
||||
|
||||
/**
|
||||
* Validate integer types (including tinyint, smallint, mediumint, etc.).
|
||||
*
|
||||
* @param mixed $value The value to validate.
|
||||
* @param array $typeInfo The parsed data type information.
|
||||
*
|
||||
* @return bool True if valid, false otherwise.
|
||||
* @since 5.3.0
|
||||
*/
|
||||
private function validateInteger($value, array $typeInfo): bool
|
||||
{
|
||||
if (!is_numeric($value))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$value = (int)$value;
|
||||
if (isset($typeInfo['unsigned']) && $typeInfo['unsigned'] && $value < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate string types like VARCHAR and CHAR.
|
||||
*
|
||||
* @param mixed $value The value to validate.
|
||||
* @param array $typeInfo The parsed data type information.
|
||||
*
|
||||
* @return bool True if valid, false otherwise.
|
||||
* @since 5.3.0
|
||||
*/
|
||||
private function validateString($value, array $typeInfo): bool
|
||||
{
|
||||
if (!is_string($value))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if the length exceeds the allowed size
|
||||
if ($typeInfo['size'] !== null && strlen($value) > (int)$typeInfo['size'])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate text types like TEXT, TINYTEXT, MEDIUMTEXT, LONGTEXT.
|
||||
*
|
||||
* @param mixed $value The value to validate.
|
||||
* @param array $typeInfo The parsed data type information.
|
||||
*
|
||||
* @return bool True if valid, false otherwise.
|
||||
* @since 5.3.0
|
||||
*/
|
||||
private function validateText($value, array $typeInfo): bool
|
||||
{
|
||||
return is_string($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate float, double, and decimal types.
|
||||
*
|
||||
* @param mixed $value The value to validate.
|
||||
* @param array $typeInfo The parsed data type information.
|
||||
*
|
||||
* @return bool True if valid, false otherwise.
|
||||
* @since 5.3.0
|
||||
*/
|
||||
private function validateFloat($value, array $typeInfo): bool
|
||||
{
|
||||
return is_numeric($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate decimal types (numeric precision and scale).
|
||||
*
|
||||
* @param mixed $value The value to validate.
|
||||
* @param array $typeInfo The parsed data type information.
|
||||
*
|
||||
* @return bool True if valid, false otherwise.
|
||||
* @since 5.3.0
|
||||
*/
|
||||
private function validateDecimal($value, array $typeInfo): bool
|
||||
{
|
||||
return is_numeric($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate date, datetime, timestamp, and time types.
|
||||
*
|
||||
* @param mixed $value The value to validate.
|
||||
* @param array $typeInfo The parsed data type information.
|
||||
*
|
||||
* @return bool True if valid, false otherwise.
|
||||
* @since 5.3.0
|
||||
*/
|
||||
private function validateDate($value, array $typeInfo): bool
|
||||
{
|
||||
$formats = [
|
||||
'date' => 'Y-m-d',
|
||||
'datetime' => 'Y-m-d H:i:s',
|
||||
'timestamp' => 'Y-m-d H:i:s',
|
||||
'time' => 'H:i:s',
|
||||
];
|
||||
|
||||
if (!isset($formats[$typeInfo['type']]))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$dateTime = \DateTime::createFromFormat($formats[$typeInfo['type']], $value);
|
||||
return $dateTime && $dateTime->format($formats[$typeInfo['type']]) === $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate JSON types.
|
||||
*
|
||||
* @param mixed $value The value to validate.
|
||||
* @param array $typeInfo The parsed data type information.
|
||||
*
|
||||
* @return bool True if valid, false otherwise.
|
||||
* @since 5.3.0
|
||||
*/
|
||||
private function validateJson($value, array $typeInfo): bool
|
||||
{
|
||||
json_decode($value);
|
||||
return json_last_error() === JSON_ERROR_NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate BLOB types (including TINYBLOB, MEDIUMBLOB, LONGBLOB).
|
||||
*
|
||||
* @param mixed $value The value to validate.
|
||||
* @param array $typeInfo The parsed data type information.
|
||||
*
|
||||
* @return bool True if valid, false otherwise.
|
||||
* @since 5.3.0
|
||||
*/
|
||||
private function validateBlob($value, array $typeInfo): bool
|
||||
{
|
||||
return is_string($value) || is_resource($value);
|
||||
}
|
||||
}
|
||||
|
384
src/79fd4f39-824d-4ab6-936d-959705ff24ec/code.power
Normal file
384
src/79fd4f39-824d-4ab6-936d-959705ff24ec/code.power
Normal file
@ -0,0 +1,384 @@
|
||||
/**
|
||||
* The Table Class.
|
||||
*
|
||||
* @var Table
|
||||
* @since 5.3.0
|
||||
*/
|
||||
protected Table $table;
|
||||
|
||||
/**
|
||||
* A map of MySQL base types to their respective validation methods.
|
||||
*
|
||||
* @var array
|
||||
* @since 5.3.0
|
||||
*/
|
||||
protected array $validators = [];
|
||||
|
||||
/**
|
||||
* A map of defauts for the respective datatypes.
|
||||
*
|
||||
* @var array
|
||||
* @since 5.3.0
|
||||
*/
|
||||
protected array $defaults = [];
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Table $table The Table Class.
|
||||
*
|
||||
* @since 5.3.0
|
||||
*/
|
||||
public function __construct(Table $table)
|
||||
{
|
||||
$this->table = $table;
|
||||
|
||||
// Register datatype validators (mapping MySQL types to handlers)
|
||||
$this->registerValidators();
|
||||
|
||||
// Register datatype defaults
|
||||
$this->registerDefaults();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the valid value based on datatype definition.
|
||||
* If the value is valid, return it. If not, return the default value,
|
||||
* NULL (if allowed), or an empty string if 'EMPTY' is set.
|
||||
*
|
||||
* @param mixed $value The value to validate.
|
||||
* @param string $field The field name.
|
||||
* @param string $table The table name.
|
||||
*
|
||||
* @return mixed Returns the valid value, or the default, NULL, or empty string based on validation.
|
||||
* @since 5.3.0
|
||||
*/
|
||||
public function getValid($value, string $field, string $table)
|
||||
{
|
||||
// Get the database field definition
|
||||
if (($dbField = $this->getDatabaseField($field, $table)) === null)
|
||||
{
|
||||
return null; // not legal field or table
|
||||
}
|
||||
|
||||
// Check if the value is valid for the field
|
||||
if ($this->validate($value, $dbField))
|
||||
{
|
||||
return $value;
|
||||
}
|
||||
|
||||
// If invalid, return default, NULL (if allowed), or empty string
|
||||
return $this->getDefault($dbField, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate if the given value is valid for the provided database field.
|
||||
* This is a private method as `getValid()` will handle the actual logic.
|
||||
*
|
||||
* @param mixed $value The value to validate.
|
||||
* @param array $dbField The database field details (type, default, null_switch, etc.).
|
||||
*
|
||||
* @return bool Returns true if the value is valid, false otherwise.
|
||||
* @since 5.3.0
|
||||
*/
|
||||
private function validate($value, array $dbField): bool
|
||||
{
|
||||
// Extract datatype and handle the validation
|
||||
$typeInfo = $this->parseDataType($dbField['type']);
|
||||
$baseType = $typeInfo['type'];
|
||||
|
||||
// Use the appropriate validator if it exists
|
||||
if (isset($this->validators[$baseType]))
|
||||
{
|
||||
return call_user_func($this->validators[$baseType], $value, $typeInfo);
|
||||
}
|
||||
|
||||
// If no validator exists, assume invalid
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle returning the default value, null, or empty string if validation fails.
|
||||
*
|
||||
* @param array $dbField The database field details.
|
||||
* @param mixed $value The value to validate.
|
||||
*
|
||||
* @return mixed The default value, null, or empty string based on field settings.
|
||||
* @since 5.3.0
|
||||
*/
|
||||
private function getDefault(array $dbField, $value)
|
||||
{
|
||||
// get default value from field db
|
||||
$db_default = isset($dbField['default']) ? $dbField['default'] : null;
|
||||
|
||||
// If a default value is provided, return it
|
||||
if ($db_default !== null)
|
||||
{
|
||||
return strtoupper($db_default) === 'EMPTY' ? '' : $db_default;
|
||||
}
|
||||
|
||||
// Check if NULL is allowed
|
||||
if (isset($dbField['null_switch']) && strtoupper($dbField['null_switch']) === 'NULL')
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Fallback to datatype default
|
||||
$typeInfo = $this->parseDataType($dbField['type']);
|
||||
return $this->defaults[$typeInfo['type']] ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the data type from the database field and extract details like type, size, and precision.
|
||||
*
|
||||
* @param string $datatype The full MySQL datatype (e.g., VARCHAR(255)).
|
||||
*
|
||||
* @return array An array containing 'type', 'size', and other relevant info.
|
||||
* @since 5.3.0
|
||||
*/
|
||||
private function parseDataType(string $datatype): array
|
||||
{
|
||||
$pattern = '/(?<type>\w+)(\((?<size>\d+)(,\s*(?<precision>\d+))?\))?/i';
|
||||
preg_match($pattern, $datatype, $matches);
|
||||
|
||||
return [
|
||||
'type' => isset($matches['type']) ? strtolower($matches['type']) : strtolower($datatype),
|
||||
'size' => $matches['size'] ?? null,
|
||||
'precision' => $matches['precision'] ?? null,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the database field structure for the specified field and table.
|
||||
* In your case, you use `$db = $this->table->get($table, $field, 'db')`.
|
||||
*
|
||||
* @param string $field The field name.
|
||||
* @param string $table The table name.
|
||||
*
|
||||
* @return array The database field details, including type, default, null_switch, etc.
|
||||
* @since 5.3.0
|
||||
*/
|
||||
private function getDatabaseField(string $field, string $table): array
|
||||
{
|
||||
// Simulated retrieval of field details. Replace with actual logic.
|
||||
return $this->table->get($table, $field, 'db');
|
||||
}
|
||||
|
||||
/**
|
||||
* Register validators for MySQL data types.
|
||||
*
|
||||
* @return void
|
||||
* @since 5.3.0
|
||||
*/
|
||||
private function registerValidators(): void
|
||||
{
|
||||
$this->validators = [
|
||||
'int' => [$this, 'validateInteger'],
|
||||
'tinyint' => [$this, 'validateInteger'],
|
||||
'smallint' => [$this, 'validateInteger'],
|
||||
'mediumint' => [$this, 'validateInteger'],
|
||||
'bigint' => [$this, 'validateInteger'],
|
||||
'varchar' => [$this, 'validateString'],
|
||||
'char' => [$this, 'validateString'],
|
||||
'text' => [$this, 'validateText'],
|
||||
'tinytext' => [$this, 'validateText'],
|
||||
'mediumtext' => [$this, 'validateText'],
|
||||
'longtext' => [$this, 'validateText'],
|
||||
'decimal' => [$this, 'validateDecimal'],
|
||||
'float' => [$this, 'validateFloat'],
|
||||
'double' => [$this, 'validateFloat'],
|
||||
'date' => [$this, 'validateDate'],
|
||||
'datetime' => [$this, 'validateDate'],
|
||||
'timestamp' => [$this, 'validateDate'],
|
||||
'time' => [$this, 'validateDate'],
|
||||
'json' => [$this, 'validateJson'],
|
||||
'blob' => [$this, 'validateBlob'],
|
||||
'tinyblob' => [$this, 'validateBlob'],
|
||||
'mediumblob' => [$this, 'validateBlob'],
|
||||
'longblob' => [$this, 'validateBlob'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Register default values for MySQL data types.
|
||||
*
|
||||
* @return void
|
||||
* @since 5.3.0
|
||||
*/
|
||||
private function registerDefaults(): void
|
||||
{
|
||||
$this->defaults = [
|
||||
'int' => 0,
|
||||
'tinyint' => 0,
|
||||
'smallint' => 0,
|
||||
'mediumint' => 0,
|
||||
'bigint' => 0,
|
||||
'varchar' => '',
|
||||
'char' => '',
|
||||
'text' => '',
|
||||
'tinytext' => '',
|
||||
'mediumtext' => '',
|
||||
'longtext' => '',
|
||||
'decimal' => 0.0,
|
||||
'float' => 0.0,
|
||||
'double' => 0.0,
|
||||
'date' => '0000-00-00',
|
||||
'datetime' => '0000-00-00 00:00:00',
|
||||
'timestamp' => '0000-00-00 00:00:00',
|
||||
'time' => '00:00:00',
|
||||
'json' => '{}',
|
||||
'blob' => '',
|
||||
'tinyblob' => '',
|
||||
'mediumblob' => '',
|
||||
'longblob' => '',
|
||||
];
|
||||
}
|
||||
|
||||
// ----------------- Validation Methods -----------------
|
||||
|
||||
/**
|
||||
* Validate integer types (including tinyint, smallint, mediumint, etc.).
|
||||
*
|
||||
* @param mixed $value The value to validate.
|
||||
* @param array $typeInfo The parsed data type information.
|
||||
*
|
||||
* @return bool True if valid, false otherwise.
|
||||
* @since 5.3.0
|
||||
*/
|
||||
private function validateInteger($value, array $typeInfo): bool
|
||||
{
|
||||
if (!is_numeric($value))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$value = (int)$value;
|
||||
if (isset($typeInfo['unsigned']) && $typeInfo['unsigned'] && $value < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate string types like VARCHAR and CHAR.
|
||||
*
|
||||
* @param mixed $value The value to validate.
|
||||
* @param array $typeInfo The parsed data type information.
|
||||
*
|
||||
* @return bool True if valid, false otherwise.
|
||||
* @since 5.3.0
|
||||
*/
|
||||
private function validateString($value, array $typeInfo): bool
|
||||
{
|
||||
if (!is_string($value))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if the length exceeds the allowed size
|
||||
if ($typeInfo['size'] !== null && strlen($value) > (int)$typeInfo['size'])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate text types like TEXT, TINYTEXT, MEDIUMTEXT, LONGTEXT.
|
||||
*
|
||||
* @param mixed $value The value to validate.
|
||||
* @param array $typeInfo The parsed data type information.
|
||||
*
|
||||
* @return bool True if valid, false otherwise.
|
||||
* @since 5.3.0
|
||||
*/
|
||||
private function validateText($value, array $typeInfo): bool
|
||||
{
|
||||
return is_string($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate float, double, and decimal types.
|
||||
*
|
||||
* @param mixed $value The value to validate.
|
||||
* @param array $typeInfo The parsed data type information.
|
||||
*
|
||||
* @return bool True if valid, false otherwise.
|
||||
* @since 5.3.0
|
||||
*/
|
||||
private function validateFloat($value, array $typeInfo): bool
|
||||
{
|
||||
return is_numeric($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate decimal types (numeric precision and scale).
|
||||
*
|
||||
* @param mixed $value The value to validate.
|
||||
* @param array $typeInfo The parsed data type information.
|
||||
*
|
||||
* @return bool True if valid, false otherwise.
|
||||
* @since 5.3.0
|
||||
*/
|
||||
private function validateDecimal($value, array $typeInfo): bool
|
||||
{
|
||||
return is_numeric($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate date, datetime, timestamp, and time types.
|
||||
*
|
||||
* @param mixed $value The value to validate.
|
||||
* @param array $typeInfo The parsed data type information.
|
||||
*
|
||||
* @return bool True if valid, false otherwise.
|
||||
* @since 5.3.0
|
||||
*/
|
||||
private function validateDate($value, array $typeInfo): bool
|
||||
{
|
||||
$formats = [
|
||||
'date' => 'Y-m-d',
|
||||
'datetime' => 'Y-m-d H:i:s',
|
||||
'timestamp' => 'Y-m-d H:i:s',
|
||||
'time' => 'H:i:s',
|
||||
];
|
||||
|
||||
if (!isset($formats[$typeInfo['type']]))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$dateTime = \DateTime::createFromFormat($formats[$typeInfo['type']], $value);
|
||||
return $dateTime && $dateTime->format($formats[$typeInfo['type']]) === $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate JSON types.
|
||||
*
|
||||
* @param mixed $value The value to validate.
|
||||
* @param array $typeInfo The parsed data type information.
|
||||
*
|
||||
* @return bool True if valid, false otherwise.
|
||||
* @since 5.3.0
|
||||
*/
|
||||
private function validateJson($value, array $typeInfo): bool
|
||||
{
|
||||
json_decode($value);
|
||||
return json_last_error() === JSON_ERROR_NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate BLOB types (including TINYBLOB, MEDIUMBLOB, LONGBLOB).
|
||||
*
|
||||
* @param mixed $value The value to validate.
|
||||
* @param array $typeInfo The parsed data type information.
|
||||
*
|
||||
* @return bool True if valid, false otherwise.
|
||||
* @since 5.3.0
|
||||
*/
|
||||
private function validateBlob($value, array $typeInfo): bool
|
||||
{
|
||||
return is_string($value) || is_resource($value);
|
||||
}
|
26
src/79fd4f39-824d-4ab6-936d-959705ff24ec/settings.json
Normal file
26
src/79fd4f39-824d-4ab6-936d-959705ff24ec/settings.json
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "",
|
||||
"guid": "79fd4f39-824d-4ab6-936d-959705ff24ec",
|
||||
"implements": [
|
||||
"feb3affa-5102-4307-93db-04525f4c66f0"
|
||||
],
|
||||
"load_selection": null,
|
||||
"name": "Validator",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "VDM.Table.Validator",
|
||||
"type": "final class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"extendsinterfaces": null,
|
||||
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Table.Validator",
|
||||
"description": "Table Value Validator\r\n\r\n@since 5.3.0",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "",
|
||||
"composer": ""
|
||||
}
|
79
src/85321deb-5c3a-401b-9ce1-039a746add51/README.md
Normal file
79
src/85321deb-5c3a-401b-9ce1-039a746add51/README.md
Normal file
@ -0,0 +1,79 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# abstract class Import (Details)
|
||||
> namespace: **VDM\Joomla\Abstraction\Console**
|
||||
> extends: **AbstractCommand**
|
||||
|
||||
```uml
|
||||
@startuml
|
||||
abstract Import #Orange {
|
||||
# Items $items
|
||||
# ImportEngine $import
|
||||
# string $queueTable
|
||||
# string $queueStatusField
|
||||
# int $queueWaitState
|
||||
# int $queueProcessingState
|
||||
# string $targetName
|
||||
# string $targetImportClass
|
||||
# static $defaultName
|
||||
+ __construct(?string $name = null)
|
||||
# configure() : void
|
||||
# doExecute(InputInterface $input, OutputInterface $output) : int
|
||||
}
|
||||
|
||||
note right of Import::__construct
|
||||
Constructor.
|
||||
|
||||
since: 5.0.2
|
||||
end note
|
||||
|
||||
note right of Import::configure
|
||||
Configures the CLI command, setting up the description and help text.
|
||||
This command parses the import queue and imports items that are still in the queue.
|
||||
It is useful for automatically processing pending item imports in the virtual warehouse.
|
||||
|
||||
since: 5.0.2
|
||||
return: void
|
||||
end note
|
||||
|
||||
note right of Import::doExecute
|
||||
Executes the CLI command, processing each spreadsheet in the import queue.
|
||||
|
||||
since: 5.0.2
|
||||
return: int
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
|
||||
|
||||
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
|
||||
|
||||
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
|
||||
|
||||
To add this specific Power to your project in JCB:
|
||||
|
||||
> simply use this SPK
|
||||
```
|
||||
Super---85321deb_5c3a_401b_9ce1_039a746add51---Power
|
||||
```
|
||||
> remember to replace the `---` with `___` to activate this Power in your code
|
||||
|
||||
---
|
||||
```
|
||||
██╗ ██████╗██████╗
|
||||
██║██╔════╝██╔══██╗
|
||||
██║██║ ██████╔╝
|
||||
██ ██║██║ ██╔══██╗
|
||||
╚█████╔╝╚██████╗██████╔╝
|
||||
╚════╝ ╚═════╝╚═════╝
|
||||
```
|
||||
> Build with [Joomla Component Builder](https://git.vdm.dev/joomla/Component-Builder)
|
||||
|
258
src/85321deb-5c3a-401b-9ce1-039a746add51/code.php
Normal file
258
src/85321deb-5c3a-401b-9ce1-039a746add51/code.php
Normal file
@ -0,0 +1,258 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Abstraction\Console;
|
||||
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\Console\Command\AbstractCommand;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
use VDM\Joomla\Componentbuilder\Import\Factory as ImportFactory;
|
||||
use VDM\Joomla\Componentbuilder\Interfaces\Spreadsheet\ImportCliInterface as ImportEngine;
|
||||
use VDM\Joomla\Data\Items;
|
||||
use VDM\Joomla\Utilities\Component\Helper;
|
||||
|
||||
|
||||
/**
|
||||
* Console Import
|
||||
*
|
||||
* @since 5.0.2
|
||||
*/
|
||||
abstract class Import extends AbstractCommand
|
||||
{
|
||||
/**
|
||||
* The Items Class.
|
||||
*
|
||||
* @var Items
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected Items $items;
|
||||
|
||||
/**
|
||||
* The Import Class.
|
||||
*
|
||||
* @var ImportEngine
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected ImportEngine $import;
|
||||
|
||||
/**
|
||||
* The queue table name.
|
||||
*
|
||||
* @var string
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected string $queueTable;
|
||||
|
||||
/**
|
||||
* The queue status field
|
||||
*
|
||||
* @var string
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected string $queueStatusField;
|
||||
|
||||
/**
|
||||
* The queue awaiting status
|
||||
*
|
||||
* @var int
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected int $queueWaitState;
|
||||
|
||||
/**
|
||||
* The queue processing status
|
||||
*
|
||||
* @var int
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected int $queueProcessingState;
|
||||
|
||||
/**
|
||||
* The main import target name.
|
||||
*
|
||||
* @var string
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected string $targetName;
|
||||
|
||||
/**
|
||||
* The target import class.
|
||||
*
|
||||
* @var string
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected string $targetImportClass;
|
||||
|
||||
/**
|
||||
* The default command name.
|
||||
*
|
||||
* @var string
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected static $defaultName;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string|null $name The name of the command; if the name is empty and no default is set, a name must be set in the configure() method
|
||||
*
|
||||
* @since 5.0.2
|
||||
*/
|
||||
public function __construct(?string $name = null)
|
||||
{
|
||||
// make sure we know what component we are working with
|
||||
Helper::setOption('com_componentbuilder');
|
||||
|
||||
// Load administrator language file for backend
|
||||
$lang = Factory::getLanguage();
|
||||
$lang->load('com_componentbuilder', JPATH_ADMINISTRATOR);
|
||||
|
||||
$this->items = ImportFactory::_('Data.Items');
|
||||
$this->import = ImportFactory::_($this->targetImportClass);
|
||||
|
||||
parent::__construct($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures the CLI command, setting up the description and help text.
|
||||
*
|
||||
* This command parses the import queue and imports items that are still in the queue.
|
||||
* It is useful for automatically processing pending item imports in the virtual warehouse.
|
||||
*
|
||||
* @return void
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected function configure(): void
|
||||
{
|
||||
$this->setDescription("Processes the import queue and {$this->targetName} imports all spreadsheets that are still in the queue.");
|
||||
$this->setHelp(
|
||||
<<<EOF
|
||||
The <info>%command.name%</info> command parses the import queue and processes all {$this->targetName} spreadsheets that are still pending import.
|
||||
This is useful for keeping the system up-to-date with incoming data.
|
||||
|
||||
Usage:
|
||||
<info>php joomla.php %command.name%</info>
|
||||
EOF);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the CLI command, processing each spreadsheet in the import queue.
|
||||
*
|
||||
* @param InputInterface $input The input to inject into the command.
|
||||
* @param OutputInterface $output The output to inject into the command.
|
||||
*
|
||||
* @return int The command exit code (0 for success).
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected function doExecute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$io = new SymfonyStyle($input, $output);
|
||||
|
||||
// Output the title for the task
|
||||
$io->title("Component Builder: {$this->targetName} import status");
|
||||
|
||||
// Get all imports in the queue that are in waiting state
|
||||
if (($queue = $this->items->table($this->queueTable)->get([$this->queueWaitState], $this->queueStatusField)) === null)
|
||||
{
|
||||
// Get the current date and time
|
||||
$timestamp = date('Y-m-d H:i:s');
|
||||
|
||||
// Output the notice of no imports to be done
|
||||
$io->info("No {$this->targetName} imports found in the queue. Idle at {$timestamp}.");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// take spreadsheets out of queue
|
||||
$this->items->table($this->queueTable)->set(array_map(function($item) {
|
||||
return [
|
||||
'guid' => $item->guid,
|
||||
$this->queueStatusField => $this->queueProcessingState
|
||||
];
|
||||
}, $queue));
|
||||
|
||||
// size of the queue
|
||||
$numberSteps = count((array) $queue);
|
||||
|
||||
// Output initial task information
|
||||
$io->info("Initiating import for {$numberSteps} {$this->targetName} spreadsheet(s) in the queue.");
|
||||
$io->newLine(2);
|
||||
|
||||
// Create a progress bar for the overall import process
|
||||
$progressBar = $io->createProgressBar($numberSteps);
|
||||
$progressBar->start();
|
||||
|
||||
// Track success and failure counts
|
||||
$successCount = 0;
|
||||
$failureCount = 0;
|
||||
|
||||
// Import one spreadsheet at a time
|
||||
foreach ($queue as $spreadsheet)
|
||||
{
|
||||
$io->newLine(2);
|
||||
|
||||
// Output the current spreadsheet being processed
|
||||
$io->section("Processing spreadsheet #{$spreadsheet->guid}...");
|
||||
|
||||
// Import the data found in the spreadsheet
|
||||
$this->import->data($spreadsheet);
|
||||
|
||||
// Get the completion message
|
||||
$completion = $this->import->message();
|
||||
|
||||
// Track success based on completion message
|
||||
if ($completion->message_success)
|
||||
{
|
||||
$successCount++;
|
||||
|
||||
// Output the success message for this spreadsheet
|
||||
$io->success($completion->message_success);
|
||||
}
|
||||
|
||||
// Track failure based on completion message
|
||||
if ($completion->message_error)
|
||||
{
|
||||
$failureCount++;
|
||||
|
||||
// Output the error message for this spreadsheet
|
||||
$io->error($completion->message_error);
|
||||
}
|
||||
|
||||
// Advance the main progress bar by one step
|
||||
sleep(1);
|
||||
$progressBar->advance();
|
||||
$io->newLine(1);
|
||||
}
|
||||
|
||||
// Finish the main progress bar
|
||||
$progressBar->finish();
|
||||
$io->newLine(2);
|
||||
|
||||
// Calculate the success and failure percentages
|
||||
$totalProcessed = $successCount + $failureCount;
|
||||
$successRate = ($totalProcessed > 0) ? round(($successCount / $totalProcessed) * 100) : 0;
|
||||
$failureRate = ($totalProcessed > 0) ? round(($failureCount / $totalProcessed) * 100) : 0;
|
||||
|
||||
// Get the current date and time
|
||||
$timestamp = date('Y-m-d H:i:s');
|
||||
|
||||
// Output the success and failure summary with the timestamp
|
||||
$io->info("The {$this->targetName} import finished: {$successRate}% success, {$failureRate}% failure. Completed at {$timestamp}.");
|
||||
|
||||
$io->newLine(1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
224
src/85321deb-5c3a-401b-9ce1-039a746add51/code.power
Normal file
224
src/85321deb-5c3a-401b-9ce1-039a746add51/code.power
Normal file
@ -0,0 +1,224 @@
|
||||
/**
|
||||
* The Items Class.
|
||||
*
|
||||
* @var Items
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected Items $items;
|
||||
|
||||
/**
|
||||
* The Import Class.
|
||||
*
|
||||
* @var ImportEngine
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected ImportEngine $import;
|
||||
|
||||
/**
|
||||
* The queue table name.
|
||||
*
|
||||
* @var string
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected string $queueTable;
|
||||
|
||||
/**
|
||||
* The queue status field
|
||||
*
|
||||
* @var string
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected string $queueStatusField;
|
||||
|
||||
/**
|
||||
* The queue awaiting status
|
||||
*
|
||||
* @var int
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected int $queueWaitState;
|
||||
|
||||
/**
|
||||
* The queue processing status
|
||||
*
|
||||
* @var int
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected int $queueProcessingState;
|
||||
|
||||
/**
|
||||
* The main import target name.
|
||||
*
|
||||
* @var string
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected string $targetName;
|
||||
|
||||
/**
|
||||
* The target import class.
|
||||
*
|
||||
* @var string
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected string $targetImportClass;
|
||||
|
||||
/**
|
||||
* The default command name.
|
||||
*
|
||||
* @var string
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected static $defaultName;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string|null $name The name of the command; if the name is empty and no default is set, a name must be set in the configure() method
|
||||
*
|
||||
* @since 5.0.2
|
||||
*/
|
||||
public function __construct(?string $name = null)
|
||||
{
|
||||
// make sure we know what component we are working with
|
||||
Helper::setOption('com_[[[component]]]');
|
||||
|
||||
// Load administrator language file for backend
|
||||
$lang = Factory::getLanguage();
|
||||
$lang->load('com_[[[component]]]', JPATH_ADMINISTRATOR);
|
||||
|
||||
$this->items = ImportFactory::_('Data.Items');
|
||||
$this->import = ImportFactory::_($this->targetImportClass);
|
||||
|
||||
parent::__construct($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configures the CLI command, setting up the description and help text.
|
||||
*
|
||||
* This command parses the import queue and imports items that are still in the queue.
|
||||
* It is useful for automatically processing pending item imports in the virtual warehouse.
|
||||
*
|
||||
* @return void
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected function configure(): void
|
||||
{
|
||||
$this->setDescription("Processes the import queue and {$this->targetName} imports all spreadsheets that are still in the queue.");
|
||||
$this->setHelp(
|
||||
<<<EOF
|
||||
The <info>%command.name%</info> command parses the import queue and processes all {$this->targetName} spreadsheets that are still pending import.
|
||||
This is useful for keeping the system up-to-date with incoming data.
|
||||
|
||||
Usage:
|
||||
<info>php joomla.php %command.name%</info>
|
||||
EOF);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the CLI command, processing each spreadsheet in the import queue.
|
||||
*
|
||||
* @param InputInterface $input The input to inject into the command.
|
||||
* @param OutputInterface $output The output to inject into the command.
|
||||
*
|
||||
* @return int The command exit code (0 for success).
|
||||
* @since 5.0.2
|
||||
*/
|
||||
protected function doExecute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$io = new SymfonyStyle($input, $output);
|
||||
|
||||
// Output the title for the task
|
||||
$io->title("Component Builder: {$this->targetName} import status");
|
||||
|
||||
// Get all imports in the queue that are in waiting state
|
||||
if (($queue = $this->items->table($this->queueTable)->get([$this->queueWaitState], $this->queueStatusField)) === null)
|
||||
{
|
||||
// Get the current date and time
|
||||
$timestamp = date('Y-m-d H:i:s');
|
||||
|
||||
// Output the notice of no imports to be done
|
||||
$io->info("No {$this->targetName} imports found in the queue. Idle at {$timestamp}.");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// take spreadsheets out of queue
|
||||
$this->items->table($this->queueTable)->set(array_map(function($item) {
|
||||
return [
|
||||
'guid' => $item->guid,
|
||||
$this->queueStatusField => $this->queueProcessingState
|
||||
];
|
||||
}, $queue));
|
||||
|
||||
// size of the queue
|
||||
$numberSteps = count((array) $queue);
|
||||
|
||||
// Output initial task information
|
||||
$io->info("Initiating import for {$numberSteps} {$this->targetName} spreadsheet(s) in the queue.");
|
||||
$io->newLine(2);
|
||||
|
||||
// Create a progress bar for the overall import process
|
||||
$progressBar = $io->createProgressBar($numberSteps);
|
||||
$progressBar->start();
|
||||
|
||||
// Track success and failure counts
|
||||
$successCount = 0;
|
||||
$failureCount = 0;
|
||||
|
||||
// Import one spreadsheet at a time
|
||||
foreach ($queue as $spreadsheet)
|
||||
{
|
||||
$io->newLine(2);
|
||||
|
||||
// Output the current spreadsheet being processed
|
||||
$io->section("Processing spreadsheet #{$spreadsheet->guid}...");
|
||||
|
||||
// Import the data found in the spreadsheet
|
||||
$this->import->data($spreadsheet);
|
||||
|
||||
// Get the completion message
|
||||
$completion = $this->import->message();
|
||||
|
||||
// Track success based on completion message
|
||||
if ($completion->message_success)
|
||||
{
|
||||
$successCount++;
|
||||
|
||||
// Output the success message for this spreadsheet
|
||||
$io->success($completion->message_success);
|
||||
}
|
||||
|
||||
// Track failure based on completion message
|
||||
if ($completion->message_error)
|
||||
{
|
||||
$failureCount++;
|
||||
|
||||
// Output the error message for this spreadsheet
|
||||
$io->error($completion->message_error);
|
||||
}
|
||||
|
||||
// Advance the main progress bar by one step
|
||||
sleep(1);
|
||||
$progressBar->advance();
|
||||
$io->newLine(1);
|
||||
}
|
||||
|
||||
// Finish the main progress bar
|
||||
$progressBar->finish();
|
||||
$io->newLine(2);
|
||||
|
||||
// Calculate the success and failure percentages
|
||||
$totalProcessed = $successCount + $failureCount;
|
||||
$successRate = ($totalProcessed > 0) ? round(($successCount / $totalProcessed) * 100) : 0;
|
||||
$failureRate = ($totalProcessed > 0) ? round(($failureCount / $totalProcessed) * 100) : 0;
|
||||
|
||||
// Get the current date and time
|
||||
$timestamp = date('Y-m-d H:i:s');
|
||||
|
||||
// Output the success and failure summary with the timestamp
|
||||
$io->info("The {$this->targetName} import finished: {$successRate}% success, {$failureRate}% failure. Completed at {$timestamp}.");
|
||||
|
||||
$io->newLine(1);
|
||||
|
||||
return 0;
|
||||
}
|
37
src/85321deb-5c3a-401b-9ce1-039a746add51/settings.json
Normal file
37
src/85321deb-5c3a-401b-9ce1-039a746add51/settings.json
Normal file
@ -0,0 +1,37 @@
|
||||
{
|
||||
"add_head": "1",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "-1",
|
||||
"guid": "85321deb-5c3a-401b-9ce1-039a746add51",
|
||||
"implements": null,
|
||||
"load_selection": null,
|
||||
"name": "Import",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "VDM.Abstraction.Console.Import",
|
||||
"type": "abstract class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "ff8d5fdb-2d1f-4178-bd18-a43b8efd1068",
|
||||
"as": "ImportFactory"
|
||||
},
|
||||
"use_selection1": {
|
||||
"use": "0f3f7188-3e0d-4d1a-8dee-7f8026cb65a9",
|
||||
"as": "ImportEngine"
|
||||
},
|
||||
"use_selection2": {
|
||||
"use": "21bca8a4-5b28-41c4-843e-8097f0ba7cca",
|
||||
"as": "default"
|
||||
},
|
||||
"use_selection3": {
|
||||
"use": "640b5352-fb09-425f-a26e-cd44eda03f15",
|
||||
"as": "default"
|
||||
}
|
||||
},
|
||||
"extendsinterfaces": null,
|
||||
"namespace": "[[[NamespacePrefix]]]\\Joomla\\Abstraction.Console.Import",
|
||||
"description": "Console Import\r\n\r\n@since 5.0.2",
|
||||
"extends_custom": "AbstractCommand",
|
||||
"licensing_template": "\/**\r\n * @package Joomla.Component.Builder\r\n *\r\n * @created 4th September, 2022\r\n * @author Llewellyn van der Merwe <https:\/\/dev.vdm.io>\r\n * @git Joomla Component Builder <https:\/\/git.vdm.dev\/joomla\/Component-Builder>\r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n",
|
||||
"head": "use Joomla\\CMS\\Factory;\r\nuse Joomla\\Console\\Command\\AbstractCommand;\r\nuse Symfony\\Component\\Console\\Input\\InputInterface;\r\nuse Symfony\\Component\\Console\\Output\\OutputInterface;\r\nuse Symfony\\Component\\Console\\Style\\SymfonyStyle;",
|
||||
"composer": ""
|
||||
}
|
@ -29,6 +29,14 @@ use VDM\Joomla\Abstraction\Factory as ExtendingFactory;
|
||||
*/
|
||||
abstract class Factory extends ExtendingFactory implements FactoryInterface
|
||||
{
|
||||
/**
|
||||
* Package Container
|
||||
*
|
||||
* @var Container|null
|
||||
* @since 5.0.3
|
||||
**/
|
||||
protected static ?Container $container = null;
|
||||
|
||||
/**
|
||||
* Create a container object
|
||||
*
|
||||
|
@ -1,3 +1,11 @@
|
||||
/**
|
||||
* Package Container
|
||||
*
|
||||
* @var Container|null
|
||||
* @since 5.0.3
|
||||
**/
|
||||
protected static ?Container $container = null;
|
||||
|
||||
/**
|
||||
* Create a container object
|
||||
*
|
||||
|
86
src/90b48ea8-0930-48d1-869a-bce9c901589c/README.md
Normal file
86
src/90b48ea8-0930-48d1-869a-bce9c901589c/README.md
Normal file
@ -0,0 +1,86 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# final class Mapper (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Import**
|
||||
|
||||
```uml
|
||||
@startuml
|
||||
class Mapper << (F,LightGreen) >> #RoyalBlue {
|
||||
# Table $table
|
||||
- array $parent
|
||||
- array $join
|
||||
+ __construct(Table $table)
|
||||
+ set(object $map, string $parentTable) : void
|
||||
+ getParent() : array
|
||||
+ getJoin() : array
|
||||
- getTableField(string $key) : ?object
|
||||
}
|
||||
|
||||
note right of Mapper::__construct
|
||||
Constructor.
|
||||
|
||||
since: 4.0.3
|
||||
end note
|
||||
|
||||
note right of Mapper::set
|
||||
Set the tables mapper
|
||||
|
||||
since: 4.0.3
|
||||
return: void
|
||||
end note
|
||||
|
||||
note right of Mapper::getParent
|
||||
Get the parent table keys
|
||||
|
||||
since: 4.0.3
|
||||
return: array
|
||||
end note
|
||||
|
||||
note right of Mapper::getJoin
|
||||
Get the join tables keys
|
||||
|
||||
since: 4.0.3
|
||||
return: array
|
||||
end note
|
||||
|
||||
note right of Mapper::getTableField
|
||||
Get the table and field name
|
||||
|
||||
since: 4.0.3
|
||||
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---90b48ea8_0930_48d1_869a_bce9c901589c---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)
|
||||
|
154
src/90b48ea8-0930-48d1-869a-bce9c901589c/code.php
Normal file
154
src/90b48ea8-0930-48d1-869a-bce9c901589c/code.php
Normal file
@ -0,0 +1,154 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Import;
|
||||
|
||||
|
||||
use VDM\Joomla\Interfaces\TableInterface as Table;
|
||||
use VDM\Joomla\Componentbuilder\Interfaces\ImportMapperInterface;
|
||||
|
||||
|
||||
/**
|
||||
* Import Mapper Class
|
||||
*
|
||||
* @since 4.0.3
|
||||
*/
|
||||
final class Mapper implements ImportMapperInterface
|
||||
{
|
||||
/**
|
||||
* The Table Class.
|
||||
*
|
||||
* @var Table
|
||||
* @since 4.0.3
|
||||
*/
|
||||
protected Table $table;
|
||||
|
||||
/**
|
||||
* The current parent table map.
|
||||
*
|
||||
* @var array
|
||||
* @since 4.0.3
|
||||
*/
|
||||
private array $parent = [];
|
||||
|
||||
/**
|
||||
* The current join tables map.
|
||||
*
|
||||
* @var array
|
||||
* @since 4.0.3
|
||||
*/
|
||||
private array $join = [];
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Table $table The Table Class.
|
||||
*
|
||||
* @since 4.0.3
|
||||
*/
|
||||
public function __construct(Table $table)
|
||||
{
|
||||
$this->table = $table;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
{
|
||||
// always reset these
|
||||
$this->parent = [];
|
||||
$this->join = [];
|
||||
|
||||
foreach ($map as $row)
|
||||
{
|
||||
$target = $row->target ?? null;
|
||||
|
||||
if (empty($target))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (($tm = $this->getTableField($target)) !== null)
|
||||
{
|
||||
$field = $this->table->get($tm->table, $tm->field);
|
||||
if ($tm->table === $parentTable)
|
||||
{
|
||||
$this->parent[$row->column] = $field;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->join[$tm->table][$row->column] = $field;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the parent table keys
|
||||
*
|
||||
* @return array
|
||||
* @since 4.0.3
|
||||
*/
|
||||
public function getParent(): array
|
||||
{
|
||||
return $this->parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the join tables keys
|
||||
*
|
||||
* @return array
|
||||
* @since 4.0.3
|
||||
*/
|
||||
public function getJoin(): array
|
||||
{
|
||||
return $this->join;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the table and field name
|
||||
*
|
||||
* @param string $key The import file key.
|
||||
*
|
||||
* @return object|null
|
||||
* @since 4.0.3
|
||||
*/
|
||||
private function getTableField(string $key): ?object
|
||||
{
|
||||
// Find the position of the first dot
|
||||
$dotPosition = strpos($key, '.');
|
||||
|
||||
// If no dot is found, return the whole string
|
||||
if ($dotPosition === false)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Extract the table (before the dot) and the field (after the dot)
|
||||
$table = substr($key, 0, $dotPosition);
|
||||
$field = substr($key, $dotPosition + 1);
|
||||
|
||||
if ($this->table->exist($table ?? '_error', $field))
|
||||
{
|
||||
return (object) ['table' => $table, 'field' => $field];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
127
src/90b48ea8-0930-48d1-869a-bce9c901589c/code.power
Normal file
127
src/90b48ea8-0930-48d1-869a-bce9c901589c/code.power
Normal file
@ -0,0 +1,127 @@
|
||||
/**
|
||||
* The Table Class.
|
||||
*
|
||||
* @var Table
|
||||
* @since 4.0.3
|
||||
*/
|
||||
protected Table $table;
|
||||
|
||||
/**
|
||||
* The current parent table map.
|
||||
*
|
||||
* @var array
|
||||
* @since 4.0.3
|
||||
*/
|
||||
private array $parent = [];
|
||||
|
||||
/**
|
||||
* The current join tables map.
|
||||
*
|
||||
* @var array
|
||||
* @since 4.0.3
|
||||
*/
|
||||
private array $join = [];
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Table $table The Table Class.
|
||||
*
|
||||
* @since 4.0.3
|
||||
*/
|
||||
public function __construct(Table $table)
|
||||
{
|
||||
$this->table = $table;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
{
|
||||
// always reset these
|
||||
$this->parent = [];
|
||||
$this->join = [];
|
||||
|
||||
foreach ($map as $row)
|
||||
{
|
||||
$target = $row->target ?? null;
|
||||
|
||||
if (empty($target))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (($tm = $this->getTableField($target)) !== null)
|
||||
{
|
||||
$field = $this->table->get($tm->table, $tm->field);
|
||||
if ($tm->table === $parentTable)
|
||||
{
|
||||
$this->parent[$row->column] = $field;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->join[$tm->table][$row->column] = $field;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the parent table keys
|
||||
*
|
||||
* @return array
|
||||
* @since 4.0.3
|
||||
*/
|
||||
public function getParent(): array
|
||||
{
|
||||
return $this->parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the join tables keys
|
||||
*
|
||||
* @return array
|
||||
* @since 4.0.3
|
||||
*/
|
||||
public function getJoin(): array
|
||||
{
|
||||
return $this->join;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the table and field name
|
||||
*
|
||||
* @param string $key The import file key.
|
||||
*
|
||||
* @return object|null
|
||||
* @since 4.0.3
|
||||
*/
|
||||
private function getTableField(string $key): ?object
|
||||
{
|
||||
// Find the position of the first dot
|
||||
$dotPosition = strpos($key, '.');
|
||||
|
||||
// If no dot is found, return the whole string
|
||||
if ($dotPosition === false)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Extract the table (before the dot) and the field (after the dot)
|
||||
$table = substr($key, 0, $dotPosition);
|
||||
$field = substr($key, $dotPosition + 1);
|
||||
|
||||
if ($this->table->exist($table ?? '_error', $field))
|
||||
{
|
||||
return (object) ['table' => $table, 'field' => $field];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
26
src/90b48ea8-0930-48d1-869a-bce9c901589c/settings.json
Normal file
26
src/90b48ea8-0930-48d1-869a-bce9c901589c/settings.json
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "",
|
||||
"guid": "90b48ea8-0930-48d1-869a-bce9c901589c",
|
||||
"implements": [
|
||||
"250a7272-9ae1-4c63-a058-26bad9ad6f70"
|
||||
],
|
||||
"load_selection": null,
|
||||
"name": "Mapper",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Import.Mapper",
|
||||
"type": "final class",
|
||||
"use_selection": {
|
||||
"use_selection0": {
|
||||
"use": "2da6d6c4-eb29-4d69-8bc2-36d96e916adf",
|
||||
"as": "Table"
|
||||
}
|
||||
},
|
||||
"extendsinterfaces": null,
|
||||
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Import.Mapper",
|
||||
"description": "Import Mapper 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": ""
|
||||
}
|
187
src/993fe913-8e36-4800-a5f7-544aa728ee48/README.md
Normal file
187
src/993fe913-8e36-4800-a5f7-544aa728ee48/README.md
Normal file
@ -0,0 +1,187 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# abstract class DateHelper (Details)
|
||||
> namespace: **VDM\Joomla\Utilities**
|
||||
|
||||
```uml
|
||||
@startuml
|
||||
abstract DateHelper #Orange {
|
||||
+ {static} fancyDate(string|int $date, bool $checkStamp = true) : string
|
||||
+ {static} fancyDynamicDate(string|int $date, bool $checkStamp = true) : string
|
||||
+ {static} fancyDayTimeDate(string|int $date, bool $checkStamp = true) : string
|
||||
+ {static} fancyDateTime(string|int $date, bool $checkStamp = true) : string
|
||||
+ {static} fancyTime(string|int $date, bool $checkStamp = true) : string
|
||||
+ {static} setDayName(string|int $date, bool $checkStamp = true) : string
|
||||
+ {static} setMonthName(string|int $date, bool $checkStamp = true) : string
|
||||
+ {static} setDay(string|int $date, bool $checkStamp = true) : string
|
||||
+ {static} setMonth(string|int $date, bool $checkStamp = true) : string
|
||||
+ {static} setYear(string|int $date, bool $checkStamp = true) : string
|
||||
+ {static} setYearMonth(string|int $date, string $spacer = '/', ...) : string
|
||||
+ {static} setYearMonthDay(string|int $date, string $spacer = '/', ...) : string
|
||||
+ {static} setDayMonthYear(string|int $date, string $spacer = '/', ...) : string
|
||||
+ {static} getValidTimestamp(string|int $date, bool $checkStamp) : int
|
||||
+ {static} isValidTimeStamp(mixed $timestamp) : bool
|
||||
+ {static} isValidateDate(string $date, string $format = 'Y-m-d H:i:s') : bool
|
||||
}
|
||||
|
||||
note right of DateHelper::fancyDate
|
||||
Convert a date to a human-readable fancy format (e.g., "1st of January 2024").
|
||||
|
||||
since: 3.0.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
note left of DateHelper::fancyDynamicDate
|
||||
Get a formatted date based on the time period (dynamic format based on age of the date).
|
||||
|
||||
since: 3.0.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
note right of DateHelper::fancyDayTimeDate
|
||||
Convert a date to a human-readable day, time, and date format (e.g., "Mon 12am 1st of January 2024").
|
||||
|
||||
since: 3.0.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
note left of DateHelper::fancyDateTime
|
||||
Convert a date to a human-readable time and date format (e.g., "(12:00) 1st of January 2024").
|
||||
|
||||
since: 3.0.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
note right of DateHelper::fancyTime
|
||||
Convert a time to a human-readable format (e.g., "12:00").
|
||||
|
||||
since: 3.0.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
note left of DateHelper::setDayName
|
||||
Convert a date to the day name (e.g., "Sunday").
|
||||
|
||||
since: 3.0.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
note right of DateHelper::setMonthName
|
||||
Convert a date to the month name (e.g., "January").
|
||||
|
||||
since: 3.0.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
note left of DateHelper::setDay
|
||||
Convert a date to the day with suffix (e.g., "1st").
|
||||
|
||||
since: 3.0.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
note right of DateHelper::setMonth
|
||||
Convert a date to the numeric month (e.g., "5").
|
||||
|
||||
since: 3.0.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
note left of DateHelper::setYear
|
||||
Convert a date to the full year (e.g., "2024").
|
||||
|
||||
since: 3.0.0
|
||||
return: string
|
||||
end note
|
||||
|
||||
note right of DateHelper::setYearMonth
|
||||
Convert a date to a year/month format (e.g., "2024/05").
|
||||
|
||||
since: 3.0.0
|
||||
return: string
|
||||
|
||||
arguments:
|
||||
string|int $date
|
||||
string $spacer = '/'
|
||||
bool $checkStamp = true
|
||||
end note
|
||||
|
||||
note left of DateHelper::setYearMonthDay
|
||||
Convert a date to a year/month/day format (e.g., "2024/05/03").
|
||||
|
||||
since: 3.0.0
|
||||
return: string
|
||||
|
||||
arguments:
|
||||
string|int $date
|
||||
string $spacer = '/'
|
||||
bool $checkStamp = true
|
||||
end note
|
||||
|
||||
note right of DateHelper::setDayMonthYear
|
||||
Convert a date to a day/month/year format (e.g., "03/05/2024").
|
||||
|
||||
since: 3.0.0
|
||||
return: string
|
||||
|
||||
arguments:
|
||||
string|int $date
|
||||
string $spacer = '/'
|
||||
bool $checkStamp = true
|
||||
end note
|
||||
|
||||
note left of DateHelper::getValidTimestamp
|
||||
Convert a date string to a valid timestamp.
|
||||
|
||||
since: 3.0.0
|
||||
return: int
|
||||
end note
|
||||
|
||||
note right of DateHelper::isValidTimeStamp
|
||||
Check if the input is a valid Unix timestamp.
|
||||
|
||||
since: 3.0.0
|
||||
return: bool
|
||||
end note
|
||||
|
||||
note left of DateHelper::isValidateDate
|
||||
Check if a string is a valid date according to the specified format.
|
||||
|
||||
since: 3.0.0
|
||||
return: bool
|
||||
end note
|
||||
|
||||
@enduml
|
||||
```
|
||||
|
||||
The Power feature in JCB allows you to write PHP classes and their implementations, making it easy to include them in your Joomla project. JCB handles linking, autoloading, namespacing, and folder structure creation for you.
|
||||
|
||||
By using the SPK (Super Power Key) in your custom code (replacing the class name in your code with the SPK), JCB will automatically pull the power from the repository into your project. This makes it available in your JCB instance, allowing you to edit it and include the class in your generated Joomla component.
|
||||
|
||||
JCB uses placeholders like [[[`NamespacePrefix`]]] and [[[`ComponentNamespace`]]] in namespacing to prevent collisions and improve reusability across different JCB systems. You can also set the **JCB powers path** globally or per component under the **Dynamic Integration** tab, providing flexibility and easy maintainability.
|
||||
|
||||
To add this specific Power to your project in JCB:
|
||||
|
||||
> simply use this SPK
|
||||
```
|
||||
Super---993fe913_8e36_4800_a5f7_544aa728ee48---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)
|
||||
|
294
src/993fe913-8e36-4800-a5f7-544aa728ee48/code.php
Normal file
294
src/993fe913-8e36-4800-a5f7-544aa728ee48/code.php
Normal file
@ -0,0 +1,294 @@
|
||||
<?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;
|
||||
|
||||
|
||||
/**
|
||||
* Simple Date Helper
|
||||
*
|
||||
* @since 5.0.2
|
||||
*/
|
||||
abstract class DateHelper
|
||||
{
|
||||
/**
|
||||
* Convert a date to a human-readable fancy format (e.g., "1st of January 2024").
|
||||
*
|
||||
* @param string|int $date The date as a string or timestamp.
|
||||
* @param bool $checkStamp Whether to check if the input is a timestamp.
|
||||
*
|
||||
* @return string Formatted date.
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public static function fancyDate($date, bool $checkStamp = true): string
|
||||
{
|
||||
$date = static::getValidTimestamp($date, $checkStamp);
|
||||
|
||||
return date('jS \o\f F Y', $date);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a formatted date based on the time period (dynamic format based on age of the date).
|
||||
*
|
||||
* @param string|int $date The date as a string or timestamp.
|
||||
* @param bool $checkStamp Whether to check if the input is a timestamp.
|
||||
*
|
||||
* @return string Formatted date.
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public static function fancyDynamicDate($date, bool $checkStamp = true): string
|
||||
{
|
||||
$date = static::getValidTimestamp($date, $checkStamp);
|
||||
|
||||
// If older than a year, use m/d/y format.
|
||||
if (date('Y', $date) < date('Y', strtotime('-1 year')))
|
||||
{
|
||||
return date('m/d/y', $date);
|
||||
}
|
||||
|
||||
// If it's the same day, return the time.
|
||||
if ($date > strtotime('-1 day'))
|
||||
{
|
||||
return date('g:i A', $date);
|
||||
}
|
||||
|
||||
// Otherwise, return the month and day.
|
||||
return date('M j', $date);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a date to a human-readable day, time, and date format (e.g., "Mon 12am 1st of January 2024").
|
||||
*
|
||||
* @param string|int $date The date as a string or timestamp.
|
||||
* @param bool $checkStamp Whether to check if the input is a timestamp.
|
||||
*
|
||||
* @return string Formatted day, time, and date.
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public static function fancyDayTimeDate($date, bool $checkStamp = true): string
|
||||
{
|
||||
$date = static::getValidTimestamp($date, $checkStamp);
|
||||
|
||||
return date('D gA jS \o\f F Y', $date);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a date to a human-readable time and date format (e.g., "(12:00) 1st of January 2024").
|
||||
*
|
||||
* @param string|int $date The date as a string or timestamp.
|
||||
* @param bool $checkStamp Whether to check if the input is a timestamp.
|
||||
*
|
||||
* @return string Formatted time and date.
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public static function fancyDateTime($date, bool $checkStamp = true): string
|
||||
{
|
||||
$date = static::getValidTimestamp($date, $checkStamp);
|
||||
|
||||
return date('(G:i) jS \o\f F Y', $time);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a time to a human-readable format (e.g., "12:00").
|
||||
*
|
||||
* @param string|int $date The date as a string or timestamp.
|
||||
* @param bool $checkStamp Whether to check if the input is a timestamp.
|
||||
*
|
||||
* @return string Formatted time.
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public static function fancyTime($date, bool $checkStamp = true): string
|
||||
{
|
||||
$date = static::getValidTimestamp($date, $checkStamp);
|
||||
|
||||
return date('G:i', $date);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a date to the day name (e.g., "Sunday").
|
||||
*
|
||||
* @param string|int $date The date as a string or timestamp.
|
||||
* @param bool $checkStamp Whether to check if the input is a timestamp.
|
||||
*
|
||||
* @return string Day name.
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public static function setDayName($date, bool $checkStamp = true): string
|
||||
{
|
||||
$date = static::getValidTimestamp($date, $checkStamp);
|
||||
|
||||
return date('l', $date);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a date to the month name (e.g., "January").
|
||||
*
|
||||
* @param string|int $date The date as a string or timestamp.
|
||||
* @param bool $checkStamp Whether to check if the input is a timestamp.
|
||||
*
|
||||
* @return string Month name.
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public static function setMonthName($date, bool $checkStamp = true): string
|
||||
{
|
||||
$date = static::getValidTimestamp($date, $checkStamp);
|
||||
|
||||
return date('F', $date);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a date to the day with suffix (e.g., "1st").
|
||||
*
|
||||
* @param string|int $date The date as a string or timestamp.
|
||||
* @param bool $checkStamp Whether to check if the input is a timestamp.
|
||||
*
|
||||
* @return string Day with suffix.
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public static function setDay($date, bool $checkStamp = true): string
|
||||
{
|
||||
$date = static::getValidTimestamp($date, $checkStamp);
|
||||
|
||||
return date('jS', $date);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a date to the numeric month (e.g., "5").
|
||||
*
|
||||
* @param string|int $date The date as a string or timestamp.
|
||||
* @param bool $checkStamp Whether to check if the input is a timestamp.
|
||||
*
|
||||
* @return string Numeric month.
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public static function setMonth($date, bool $checkStamp = true): string
|
||||
{
|
||||
$date = static::getValidTimestamp($date, $checkStamp);
|
||||
|
||||
return date('n', $date);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a date to the full year (e.g., "2024").
|
||||
*
|
||||
* @param string|int $date The date as a string or timestamp.
|
||||
* @param bool $checkStamp Whether to check if the input is a timestamp.
|
||||
*
|
||||
* @return string Full year.
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public static function setYear($date, bool $checkStamp = true): string
|
||||
{
|
||||
$date = static::getValidTimestamp($date, $checkStamp);
|
||||
|
||||
return date('Y', $date);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a date to a year/month format (e.g., "2024/05").
|
||||
*
|
||||
* @param string|int $date The date as a string or timestamp.
|
||||
* @param string $spacer The spacer between year and month.
|
||||
* @param bool $checkStamp Whether to check if the input is a timestamp.
|
||||
*
|
||||
* @return string Year/Month format.
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public static function setYearMonth($date, string $spacer = '/', bool $checkStamp = true): string
|
||||
{
|
||||
$date = static::getValidTimestamp($date, $checkStamp);
|
||||
|
||||
return date('Y' . $spacer . 'm', $date);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a date to a year/month/day format (e.g., "2024/05/03").
|
||||
*
|
||||
* @param string|int $date The date as a string or timestamp.
|
||||
* @param string $spacer The spacer between year and month.
|
||||
* @param bool $checkStamp Whether to check if the input is a timestamp.
|
||||
*
|
||||
* @return string Year/Month/Day format.
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public static function setYearMonthDay($date, string $spacer = '/', bool $checkStamp = true): string
|
||||
{
|
||||
$date = static::getValidTimestamp($date, $checkStamp);
|
||||
|
||||
return date('Y' . $spacer . 'm' . $spacer . 'd', $date);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a date to a day/month/year format (e.g., "03/05/2024").
|
||||
*
|
||||
* @param string|int $date The date as a string or timestamp.
|
||||
* @param string $spacer The spacer between year and month.
|
||||
* @param bool $checkStamp Whether to check if the input is a timestamp.
|
||||
*
|
||||
* @return string Day/Month/Year format.
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public static function setDayMonthYear($date, string $spacer = '/', bool $checkStamp = true): string
|
||||
{
|
||||
$date = static::getValidTimestamp($date, $checkStamp);
|
||||
|
||||
return date('d' . $spacer . 'm' . $spacer . 'Y', $date);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a date string to a valid timestamp.
|
||||
*
|
||||
* @param string|int $date The date as a string or timestamp.
|
||||
* @param bool $checkStamp Whether to check if the input is a timestamp.
|
||||
*
|
||||
* @return int The valid timestamp.
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public static function getValidTimestamp($date, bool $checkStamp): int
|
||||
{
|
||||
if ($checkStamp && !static::isValidTimeStamp($date))
|
||||
{
|
||||
$date = strtotime($date ?? 'Now');
|
||||
}
|
||||
|
||||
return (int) $date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the input is a valid Unix timestamp.
|
||||
*
|
||||
* @param mixed $timestamp The timestamp to validate.
|
||||
*
|
||||
* @return bool True if valid timestamp, false otherwise.
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public static function isValidTimeStamp($timestamp): bool
|
||||
{
|
||||
return (is_numeric($timestamp) && (int) $timestamp == $timestamp && $timestamp > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a string is a valid date according to the specified format.
|
||||
*
|
||||
* @param string $date The date string to validate.
|
||||
* @param string $format The format to check against (default is 'Y-m-d H:i:s').
|
||||
*
|
||||
* @return bool True if valid date, false otherwise.
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public static function isValidateDate($date, string $format = 'Y-m-d H:i:s'): bool
|
||||
{
|
||||
$d = \DateTime::createFromFormat($format, $date);
|
||||
|
||||
return $d && $d->format($format) === $date;
|
||||
}
|
||||
}
|
||||
|
271
src/993fe913-8e36-4800-a5f7-544aa728ee48/code.power
Normal file
271
src/993fe913-8e36-4800-a5f7-544aa728ee48/code.power
Normal file
@ -0,0 +1,271 @@
|
||||
/**
|
||||
* Convert a date to a human-readable fancy format (e.g., "1st of January 2024").
|
||||
*
|
||||
* @param string|int $date The date as a string or timestamp.
|
||||
* @param bool $checkStamp Whether to check if the input is a timestamp.
|
||||
*
|
||||
* @return string Formatted date.
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public static function fancyDate($date, bool $checkStamp = true): string
|
||||
{
|
||||
$date = static::getValidTimestamp($date, $checkStamp);
|
||||
|
||||
return date('jS \o\f F Y', $date);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a formatted date based on the time period (dynamic format based on age of the date).
|
||||
*
|
||||
* @param string|int $date The date as a string or timestamp.
|
||||
* @param bool $checkStamp Whether to check if the input is a timestamp.
|
||||
*
|
||||
* @return string Formatted date.
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public static function fancyDynamicDate($date, bool $checkStamp = true): string
|
||||
{
|
||||
$date = static::getValidTimestamp($date, $checkStamp);
|
||||
|
||||
// If older than a year, use m/d/y format.
|
||||
if (date('Y', $date) < date('Y', strtotime('-1 year')))
|
||||
{
|
||||
return date('m/d/y', $date);
|
||||
}
|
||||
|
||||
// If it's the same day, return the time.
|
||||
if ($date > strtotime('-1 day'))
|
||||
{
|
||||
return date('g:i A', $date);
|
||||
}
|
||||
|
||||
// Otherwise, return the month and day.
|
||||
return date('M j', $date);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a date to a human-readable day, time, and date format (e.g., "Mon 12am 1st of January 2024").
|
||||
*
|
||||
* @param string|int $date The date as a string or timestamp.
|
||||
* @param bool $checkStamp Whether to check if the input is a timestamp.
|
||||
*
|
||||
* @return string Formatted day, time, and date.
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public static function fancyDayTimeDate($date, bool $checkStamp = true): string
|
||||
{
|
||||
$date = static::getValidTimestamp($date, $checkStamp);
|
||||
|
||||
return date('D gA jS \o\f F Y', $date);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a date to a human-readable time and date format (e.g., "(12:00) 1st of January 2024").
|
||||
*
|
||||
* @param string|int $date The date as a string or timestamp.
|
||||
* @param bool $checkStamp Whether to check if the input is a timestamp.
|
||||
*
|
||||
* @return string Formatted time and date.
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public static function fancyDateTime($date, bool $checkStamp = true): string
|
||||
{
|
||||
$date = static::getValidTimestamp($date, $checkStamp);
|
||||
|
||||
return date('(G:i) jS \o\f F Y', $time);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a time to a human-readable format (e.g., "12:00").
|
||||
*
|
||||
* @param string|int $date The date as a string or timestamp.
|
||||
* @param bool $checkStamp Whether to check if the input is a timestamp.
|
||||
*
|
||||
* @return string Formatted time.
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public static function fancyTime($date, bool $checkStamp = true): string
|
||||
{
|
||||
$date = static::getValidTimestamp($date, $checkStamp);
|
||||
|
||||
return date('G:i', $date);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a date to the day name (e.g., "Sunday").
|
||||
*
|
||||
* @param string|int $date The date as a string or timestamp.
|
||||
* @param bool $checkStamp Whether to check if the input is a timestamp.
|
||||
*
|
||||
* @return string Day name.
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public static function setDayName($date, bool $checkStamp = true): string
|
||||
{
|
||||
$date = static::getValidTimestamp($date, $checkStamp);
|
||||
|
||||
return date('l', $date);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a date to the month name (e.g., "January").
|
||||
*
|
||||
* @param string|int $date The date as a string or timestamp.
|
||||
* @param bool $checkStamp Whether to check if the input is a timestamp.
|
||||
*
|
||||
* @return string Month name.
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public static function setMonthName($date, bool $checkStamp = true): string
|
||||
{
|
||||
$date = static::getValidTimestamp($date, $checkStamp);
|
||||
|
||||
return date('F', $date);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a date to the day with suffix (e.g., "1st").
|
||||
*
|
||||
* @param string|int $date The date as a string or timestamp.
|
||||
* @param bool $checkStamp Whether to check if the input is a timestamp.
|
||||
*
|
||||
* @return string Day with suffix.
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public static function setDay($date, bool $checkStamp = true): string
|
||||
{
|
||||
$date = static::getValidTimestamp($date, $checkStamp);
|
||||
|
||||
return date('jS', $date);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a date to the numeric month (e.g., "5").
|
||||
*
|
||||
* @param string|int $date The date as a string or timestamp.
|
||||
* @param bool $checkStamp Whether to check if the input is a timestamp.
|
||||
*
|
||||
* @return string Numeric month.
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public static function setMonth($date, bool $checkStamp = true): string
|
||||
{
|
||||
$date = static::getValidTimestamp($date, $checkStamp);
|
||||
|
||||
return date('n', $date);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a date to the full year (e.g., "2024").
|
||||
*
|
||||
* @param string|int $date The date as a string or timestamp.
|
||||
* @param bool $checkStamp Whether to check if the input is a timestamp.
|
||||
*
|
||||
* @return string Full year.
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public static function setYear($date, bool $checkStamp = true): string
|
||||
{
|
||||
$date = static::getValidTimestamp($date, $checkStamp);
|
||||
|
||||
return date('Y', $date);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a date to a year/month format (e.g., "2024/05").
|
||||
*
|
||||
* @param string|int $date The date as a string or timestamp.
|
||||
* @param string $spacer The spacer between year and month.
|
||||
* @param bool $checkStamp Whether to check if the input is a timestamp.
|
||||
*
|
||||
* @return string Year/Month format.
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public static function setYearMonth($date, string $spacer = '/', bool $checkStamp = true): string
|
||||
{
|
||||
$date = static::getValidTimestamp($date, $checkStamp);
|
||||
|
||||
return date('Y' . $spacer . 'm', $date);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a date to a year/month/day format (e.g., "2024/05/03").
|
||||
*
|
||||
* @param string|int $date The date as a string or timestamp.
|
||||
* @param string $spacer The spacer between year and month.
|
||||
* @param bool $checkStamp Whether to check if the input is a timestamp.
|
||||
*
|
||||
* @return string Year/Month/Day format.
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public static function setYearMonthDay($date, string $spacer = '/', bool $checkStamp = true): string
|
||||
{
|
||||
$date = static::getValidTimestamp($date, $checkStamp);
|
||||
|
||||
return date('Y' . $spacer . 'm' . $spacer . 'd', $date);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a date to a day/month/year format (e.g., "03/05/2024").
|
||||
*
|
||||
* @param string|int $date The date as a string or timestamp.
|
||||
* @param string $spacer The spacer between year and month.
|
||||
* @param bool $checkStamp Whether to check if the input is a timestamp.
|
||||
*
|
||||
* @return string Day/Month/Year format.
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public static function setDayMonthYear($date, string $spacer = '/', bool $checkStamp = true): string
|
||||
{
|
||||
$date = static::getValidTimestamp($date, $checkStamp);
|
||||
|
||||
return date('d' . $spacer . 'm' . $spacer . 'Y', $date);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a date string to a valid timestamp.
|
||||
*
|
||||
* @param string|int $date The date as a string or timestamp.
|
||||
* @param bool $checkStamp Whether to check if the input is a timestamp.
|
||||
*
|
||||
* @return int The valid timestamp.
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public static function getValidTimestamp($date, bool $checkStamp): int
|
||||
{
|
||||
if ($checkStamp && !static::isValidTimeStamp($date))
|
||||
{
|
||||
$date = strtotime($date ?? 'Now');
|
||||
}
|
||||
|
||||
return (int) $date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the input is a valid Unix timestamp.
|
||||
*
|
||||
* @param mixed $timestamp The timestamp to validate.
|
||||
*
|
||||
* @return bool True if valid timestamp, false otherwise.
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public static function isValidTimeStamp($timestamp): bool
|
||||
{
|
||||
return (is_numeric($timestamp) && (int) $timestamp == $timestamp && $timestamp > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a string is a valid date according to the specified format.
|
||||
*
|
||||
* @param string $date The date string to validate.
|
||||
* @param string $format The format to check against (default is 'Y-m-d H:i:s').
|
||||
*
|
||||
* @return bool True if valid date, false otherwise.
|
||||
* @since 3.0.0
|
||||
*/
|
||||
public static function isValidateDate($date, string $format = 'Y-m-d H:i:s'): bool
|
||||
{
|
||||
$d = \DateTime::createFromFormat($format, $date);
|
||||
|
||||
return $d && $d->format($format) === $date;
|
||||
}
|
19
src/993fe913-8e36-4800-a5f7-544aa728ee48/settings.json
Normal file
19
src/993fe913-8e36-4800-a5f7-544aa728ee48/settings.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "",
|
||||
"guid": "993fe913-8e36-4800-a5f7-544aa728ee48",
|
||||
"implements": null,
|
||||
"load_selection": null,
|
||||
"name": "DateHelper",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "Utilities Date Helper",
|
||||
"type": "abstract class",
|
||||
"use_selection": null,
|
||||
"extendsinterfaces": null,
|
||||
"namespace": "[[[NamespacePrefix]]]\\Joomla\\Utilities.DateHelper",
|
||||
"description": "Simple Date Helper\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": ""
|
||||
}
|
64
src/9ae018a5-9064-40ed-ad69-9c1ed2a459f5/README.md
Normal file
64
src/9ae018a5-9064-40ed-ad69-9c1ed2a459f5/README.md
Normal file
@ -0,0 +1,64 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# final class ChunkReadFilter (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Spreadsheet**
|
||||
|
||||
```uml
|
||||
@startuml
|
||||
class ChunkReadFilter << (F,LightGreen) >> #RoyalBlue {
|
||||
- int $startRow
|
||||
- int $endRow
|
||||
+ __construct(int $startRow, int $chunkSize)
|
||||
+ readCell(string $columnAddress, int $row, ...) : bool
|
||||
}
|
||||
|
||||
note right of ChunkReadFilter::__construct
|
||||
Constructor to initialize the chunk filter.
|
||||
|
||||
end note
|
||||
|
||||
note right of ChunkReadFilter::readCell
|
||||
Determines whether a cell should be read based on its row and column.
|
||||
|
||||
return: bool
|
||||
|
||||
arguments:
|
||||
string $columnAddress
|
||||
int $row
|
||||
string $worksheetName = ''
|
||||
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---9ae018a5_9064_40ed_ad69_9c1ed2a459f5---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)
|
||||
|
72
src/9ae018a5-9064-40ed-ad69-9c1ed2a459f5/code.php
Normal file
72
src/9ae018a5-9064-40ed-ad69-9c1ed2a459f5/code.php
Normal file
@ -0,0 +1,72 @@
|
||||
<?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\Spreadsheet;
|
||||
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Reader\IReadFilter;
|
||||
|
||||
|
||||
/**
|
||||
* Chunk Read Filter Class
|
||||
*
|
||||
* @since 3.2.0
|
||||
*/
|
||||
final class ChunkReadFilter implements IReadFilter
|
||||
{
|
||||
/**
|
||||
* The first row to read in the current chunk.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private int $startRow;
|
||||
|
||||
/**
|
||||
* The last row to read in the current chunk.
|
||||
* This is calculated as $startRow + $chunkSize - 1.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private int $endRow;
|
||||
|
||||
/**
|
||||
* Constructor to initialize the chunk filter.
|
||||
*
|
||||
* @param int $startRow The starting row to read.
|
||||
* @param int $chunkSize The number of rows to read in each chunk.
|
||||
*/
|
||||
public function __construct(int $startRow, int $chunkSize)
|
||||
{
|
||||
$this->startRow = $startRow;
|
||||
$this->endRow = $startRow + $chunkSize - 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether a cell should be read based on its row and column.
|
||||
*
|
||||
* @param string $column The column index (e.g., 'A', 'B', 'C').
|
||||
* @param int $row The row index.
|
||||
* @param string|null $worksheetName The worksheet name (not used in this case).
|
||||
*
|
||||
* @return bool Whether the cell should be read.
|
||||
*/
|
||||
public function readCell(string $columnAddress, int $row, string $worksheetName = ''): bool
|
||||
{
|
||||
// Only read rows that fall within the chunk range
|
||||
if ($row >= $this->startRow && $row <= $this->endRow)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
46
src/9ae018a5-9064-40ed-ad69-9c1ed2a459f5/code.power
Normal file
46
src/9ae018a5-9064-40ed-ad69-9c1ed2a459f5/code.power
Normal file
@ -0,0 +1,46 @@
|
||||
/**
|
||||
* The first row to read in the current chunk.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private int $startRow;
|
||||
|
||||
/**
|
||||
* The last row to read in the current chunk.
|
||||
* This is calculated as $startRow + $chunkSize - 1.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private int $endRow;
|
||||
|
||||
/**
|
||||
* Constructor to initialize the chunk filter.
|
||||
*
|
||||
* @param int $startRow The starting row to read.
|
||||
* @param int $chunkSize The number of rows to read in each chunk.
|
||||
*/
|
||||
public function __construct(int $startRow, int $chunkSize)
|
||||
{
|
||||
$this->startRow = $startRow;
|
||||
$this->endRow = $startRow + $chunkSize - 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines whether a cell should be read based on its row and column.
|
||||
*
|
||||
* @param string $column The column index (e.g., 'A', 'B', 'C').
|
||||
* @param int $row The row index.
|
||||
* @param string|null $worksheetName The worksheet name (not used in this case).
|
||||
*
|
||||
* @return bool Whether the cell should be read.
|
||||
*/
|
||||
public function readCell(string $columnAddress, int $row, string $worksheetName = ''): bool
|
||||
{
|
||||
// Only read rows that fall within the chunk range
|
||||
if ($row >= $this->startRow && $row <= $this->endRow)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
31
src/9ae018a5-9064-40ed-ad69-9c1ed2a459f5/settings.json
Normal file
31
src/9ae018a5-9064-40ed-ad69-9c1ed2a459f5/settings.json
Normal file
@ -0,0 +1,31 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "",
|
||||
"guid": "9ae018a5-9064-40ed-ad69-9c1ed2a459f5",
|
||||
"implements": [
|
||||
"-1"
|
||||
],
|
||||
"load_selection": null,
|
||||
"name": "ChunkReadFilter",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Spreadsheet.ChunkReadFilter",
|
||||
"type": "final class",
|
||||
"use_selection": null,
|
||||
"extendsinterfaces": null,
|
||||
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Spreadsheet.ChunkReadFilter",
|
||||
"description": "Chunk Read Filter Class\r\n\r\n@since 3.2.0",
|
||||
"implements_custom": "IReadFilter",
|
||||
"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": {
|
||||
"composer0": {
|
||||
"access_point": "phpspreadsheet\/vendor\/autoload.php",
|
||||
"namespace": {
|
||||
"namespace0": {
|
||||
"use": "PhpOffice\\PhpSpreadsheet\\Reader\\IReadFilter"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -28,6 +28,14 @@ use VDM\Joomla\Abstraction\Factory as ExtendingFactory;
|
||||
*/
|
||||
abstract class Factory extends ExtendingFactory implements FactoryInterface
|
||||
{
|
||||
/**
|
||||
* Package Container
|
||||
*
|
||||
* @var Container|null
|
||||
* @since 5.0.3
|
||||
**/
|
||||
protected static ?Container $container = null;
|
||||
|
||||
/**
|
||||
* Create a container object
|
||||
*
|
||||
|
@ -1,3 +1,11 @@
|
||||
/**
|
||||
* Package Container
|
||||
*
|
||||
* @var Container|null
|
||||
* @since 5.0.3
|
||||
**/
|
||||
protected static ?Container $container = null;
|
||||
|
||||
/**
|
||||
* Create a container object
|
||||
*
|
||||
|
51
src/9ffc54fa-a71e-412f-bc8b-064fc3b69167/README.md
Normal file
51
src/9ffc54fa-a71e-412f-bc8b-064fc3b69167/README.md
Normal file
@ -0,0 +1,51 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# interface RowDataProcessorInterface (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Interfaces\Spreadsheet**
|
||||
|
||||
```uml
|
||||
@startuml
|
||||
interface RowDataProcessorInterface #Lavender {
|
||||
+ process(Row $row) : mixed
|
||||
}
|
||||
|
||||
note right of RowDataProcessorInterface::process
|
||||
Processes the given spreadsheet row and returns it in a specific format.
|
||||
|
||||
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---9ffc54fa_a71e_412f_bc8b_064fc3b69167---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)
|
||||
|
34
src/9ffc54fa-a71e-412f-bc8b-064fc3b69167/code.php
Normal file
34
src/9ffc54fa-a71e-412f-bc8b-064fc3b69167/code.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Joomla.Component.Builder
|
||||
*
|
||||
* @created 4th September, 2022
|
||||
* @author Llewellyn van der Merwe <https://dev.vdm.io>
|
||||
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
|
||||
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/
|
||||
|
||||
namespace VDM\Joomla\Componentbuilder\Interfaces\Spreadsheet;
|
||||
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Worksheet\Row;
|
||||
|
||||
|
||||
/**
|
||||
* Spreadsheet Row Data Processor Interface
|
||||
*
|
||||
* @since 3.2.2
|
||||
*/
|
||||
interface RowDataProcessorInterface
|
||||
{
|
||||
/**
|
||||
* Processes the given spreadsheet row and returns it in a specific format.
|
||||
*
|
||||
* @param Row $row The row object from the spreadsheet to be processed.
|
||||
*
|
||||
* @return mixed Processed row data, could be an array, cell object, or other structures.
|
||||
*/
|
||||
public function process(Row $row): mixed;
|
||||
}
|
||||
|
8
src/9ffc54fa-a71e-412f-bc8b-064fc3b69167/code.power
Normal file
8
src/9ffc54fa-a71e-412f-bc8b-064fc3b69167/code.power
Normal file
@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Processes the given spreadsheet row and returns it in a specific format.
|
||||
*
|
||||
* @param Row $row The row object from the spreadsheet to be processed.
|
||||
*
|
||||
* @return mixed Processed row data, could be an array, cell object, or other structures.
|
||||
*/
|
||||
public function process(Row $row): mixed;
|
28
src/9ffc54fa-a71e-412f-bc8b-064fc3b69167/settings.json
Normal file
28
src/9ffc54fa-a71e-412f-bc8b-064fc3b69167/settings.json
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
"add_head": "0",
|
||||
"add_licensing_template": "2",
|
||||
"extends": "",
|
||||
"guid": "9ffc54fa-a71e-412f-bc8b-064fc3b69167",
|
||||
"implements": null,
|
||||
"load_selection": null,
|
||||
"name": "RowDataProcessorInterface",
|
||||
"power_version": "1.0.0",
|
||||
"system_name": "JCB.Interfaces.Spreadsheet.RowDataProcessorInterfa",
|
||||
"type": "interface",
|
||||
"use_selection": null,
|
||||
"extendsinterfaces": null,
|
||||
"namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Interfaces.Spreadsheet.RowDataProcessorInterface",
|
||||
"description": "Spreadsheet Row Data Processor 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": {
|
||||
"composer0": {
|
||||
"access_point": "phpspreadsheet\/vendor\/autoload.php",
|
||||
"namespace": {
|
||||
"namespace0": {
|
||||
"use": "PhpOffice\\PhpSpreadsheet\\Worksheet\\Row"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
87
src/afb5b891-7130-422a-b389-1934b0e4fc48/README.md
Normal file
87
src/afb5b891-7130-422a-b389-1934b0e4fc48/README.md
Normal file
@ -0,0 +1,87 @@
|
||||
```
|
||||
██████╗ ██████╗ ██╗ ██╗███████╗██████╗
|
||||
██╔══██╗██╔═══██╗██║ ██║██╔════╝██╔══██╗
|
||||
██████╔╝██║ ██║██║ █╗ ██║█████╗ ██████╔╝
|
||||
██╔═══╝ ██║ ██║██║███╗██║██╔══╝ ██╔══██╗
|
||||
██║ ╚██████╔╝╚███╔███╔╝███████╗██║ ██║
|
||||
╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝
|
||||
```
|
||||
# final class Row (Details)
|
||||
> namespace: **VDM\Joomla\Componentbuilder\Import**
|
||||
|
||||
```uml
|
||||
@startuml
|
||||
class Row << (F,LightGreen) >> #RoyalBlue {
|
||||
- array $values
|
||||
- int $index
|
||||
- bool $isSet
|
||||
+ set(int $index, array $values) : void
|
||||
+ clear() : self
|
||||
+ getIndex() : int
|
||||
+ getValue(string $key) : mixed
|
||||
+ unsetValue(string $key) : void
|
||||
}
|
||||
|
||||
note right of Row::set
|
||||
Set the row details
|
||||
|
||||
since: 5.0.2
|
||||
return: void
|
||||
end note
|
||||
|
||||
note right of Row::clear
|
||||
Clear the row details
|
||||
|
||||
since: 5.0.2
|
||||
return: self
|
||||
end note
|
||||
|
||||
note right of Row::getIndex
|
||||
Get Index
|
||||
|
||||
since: 5.0.2
|
||||
return: int
|
||||
end note
|
||||
|
||||
note right of Row::getValue
|
||||
Get Value
|
||||
|
||||
since: 5.0.2
|
||||
return: mixed
|
||||
end note
|
||||
|
||||
note right of Row::unsetValue
|
||||
Unset Value
|
||||
|
||||
since: 5.0.2
|
||||
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---afb5b891_7130_422a_b389_1934b0e4fc48---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)
|
||||
|
131
src/afb5b891-7130-422a-b389-1934b0e4fc48/code.php
Normal file
131
src/afb5b891-7130-422a-b389-1934b0e4fc48/code.php
Normal file
@ -0,0 +1,131 @@
|
||||
<?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\Interfaces\ImportRowInterface;
|
||||
|
||||
|
||||
/**
|
||||
* Import Row Class
|
||||
*
|
||||
* @since 4.0.3
|
||||
*/
|
||||
final class Row implements ImportRowInterface
|
||||
{
|
||||
/**
|
||||
* The row array of values.
|
||||
*
|
||||
* @var array
|
||||
* @since 5.0.2
|
||||
*/
|
||||
private array $values;
|
||||
|
||||
/**
|
||||
* The row index.
|
||||
*
|
||||
* @var int
|
||||
* @since 5.0.2
|
||||
*/
|
||||
private int $index;
|
||||
|
||||
/**
|
||||
* A flag to track if values and index are set.
|
||||
*
|
||||
* @var bool
|
||||
* @since 5.0.2
|
||||
*/
|
||||
private bool $isSet = false;
|
||||
|
||||
/**
|
||||
* Set the row details
|
||||
*
|
||||
* @param int $index The row index
|
||||
* @param array $values The values
|
||||
*
|
||||
* @return void
|
||||
* @since 5.0.2
|
||||
*/
|
||||
public function set(int $index, array $values): void
|
||||
{
|
||||
$this->index = $index;
|
||||
$this->values = $values;
|
||||
$this->isSet = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the row details
|
||||
*
|
||||
* @return self
|
||||
* @since 5.0.2
|
||||
*/
|
||||
public function clear(): self
|
||||
{
|
||||
$this->index = 0;
|
||||
$this->values = [];
|
||||
$this->isSet = false;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Index
|
||||
*
|
||||
* @return int
|
||||
* @throws \InvalidArgumentException if any of the parameters are null or empty.
|
||||
* @since 5.0.2
|
||||
*/
|
||||
public function getIndex(): int
|
||||
{
|
||||
if (!$this->isSet)
|
||||
{
|
||||
throw new \InvalidArgumentException('Index must not be null or empty. Use the set method to first set the index.');
|
||||
}
|
||||
|
||||
return $this->index;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Value
|
||||
*
|
||||
* @return mixed
|
||||
* @throws \InvalidArgumentException if any of the parameters are null or empty.
|
||||
* @since 5.0.2
|
||||
*/
|
||||
public function getValue(string $key)
|
||||
{
|
||||
if (!$this->isSet)
|
||||
{
|
||||
throw new \InvalidArgumentException('Values must be set before accessing. Use the set method to first set the values.');
|
||||
}
|
||||
|
||||
return $this->values[$key] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unset Value
|
||||
*
|
||||
* @return void
|
||||
* @throws \InvalidArgumentException if any of the parameters are null or empty.
|
||||
* @since 5.0.2
|
||||
*/
|
||||
public function unsetValue(string $key): void
|
||||
{
|
||||
if (!$this->isSet)
|
||||
{
|
||||
throw new \InvalidArgumentException('Values must be set before accessing. Use the set method to first set the values.');
|
||||
}
|
||||
|
||||
unset($this->values[$key]);
|
||||
}
|
||||
}
|
||||
|
105
src/afb5b891-7130-422a-b389-1934b0e4fc48/code.power
Normal file
105
src/afb5b891-7130-422a-b389-1934b0e4fc48/code.power
Normal file
@ -0,0 +1,105 @@
|
||||
/**
|
||||
* The row array of values.
|
||||
*
|
||||
* @var array
|
||||
* @since 5.0.2
|
||||
*/
|
||||
private array $values;
|
||||
|
||||
/**
|
||||
* The row index.
|
||||
*
|
||||
* @var int
|
||||
* @since 5.0.2
|
||||
*/
|
||||
private int $index;
|
||||
|
||||
/**
|
||||
* A flag to track if values and index are set.
|
||||
*
|
||||
* @var bool
|
||||
* @since 5.0.2
|
||||
*/
|
||||
private bool $isSet = false;
|
||||
|
||||
/**
|
||||
* Set the row details
|
||||
*
|
||||
* @param int $index The row index
|
||||
* @param array $values The values
|
||||
*
|
||||
* @return void
|
||||
* @since 5.0.2
|
||||
*/
|
||||
public function set(int $index, array $values): void
|
||||
{
|
||||
$this->index = $index;
|
||||
$this->values = $values;
|
||||
$this->isSet = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the row details
|
||||
*
|
||||
* @return self
|
||||
* @since 5.0.2
|
||||
*/
|
||||
public function clear(): self
|
||||
{
|
||||
$this->index = 0;
|
||||
$this->values = [];
|
||||
$this->isSet = false;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Index
|
||||
*
|
||||
* @return int
|
||||
* @throws \InvalidArgumentException if any of the parameters are null or empty.
|
||||
* @since 5.0.2
|
||||
*/
|
||||
public function getIndex(): int
|
||||
{
|
||||
if (!$this->isSet)
|
||||
{
|
||||
throw new \InvalidArgumentException('Index must not be null or empty. Use the set method to first set the index.');
|
||||
}
|
||||
|
||||
return $this->index;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Value
|
||||
*
|
||||
* @return mixed
|
||||
* @throws \InvalidArgumentException if any of the parameters are null or empty.
|
||||
* @since 5.0.2
|
||||
*/
|
||||
public function getValue(string $key)
|
||||
{
|
||||
if (!$this->isSet)
|
||||
{
|
||||
throw new \InvalidArgumentException('Values must be set before accessing. Use the set method to first set the values.');
|
||||
}
|
||||
|
||||
return $this->values[$key] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unset Value
|
||||
*
|
||||
* @return void
|
||||
* @throws \InvalidArgumentException if any of the parameters are null or empty.
|
||||
* @since 5.0.2
|
||||
*/
|
||||
public function unsetValue(string $key): void
|
||||
{
|
||||
if (!$this->isSet)
|
||||
{
|
||||
throw new \InvalidArgumentException('Values must be set before accessing. Use the set method to first set the values.');
|
||||
}
|
||||
|
||||
unset($this->values[$key]);
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user