diff --git a/README.md b/README.md index e0a430b..c931ff5 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,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,6 +95,7 @@ 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\Remote](#vdm-joomla-abstraction-remote) @@ -128,7 +130,6 @@ This repository contains an index (see below) of all the approved powers within - **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` - **Namespace**: [VDM\Joomla\Componentbuilder\Utilities](#vdm-joomla-componentbuilder-utilities) - - **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 UserHelper** | [Details](src/7832a726-87b6-4e95-887e-7b725d3fab8f) | [Code](src/7832a726-87b6-4e95-887e-7b725d3fab8f/code.php) | [Settings](src/7832a726-87b6-4e95-887e-7b725d3fab8f/settings.json) | SPK: `Super---7832a726_87b6_4e95_887e_7b725d3fab8f---Power` - **Namespace**: [VDM\Joomla\Data\Action](#vdm-joomla-data-action) diff --git a/src/47a63728-cd5d-4d53-99cf-2409bd1c744c/README.md b/src/47a63728-cd5d-4d53-99cf-2409bd1c744c/README.md index 67882fe..a3ef2f6 100644 --- a/src/47a63728-cd5d-4d53-99cf-2409bd1c744c/README.md +++ b/src/47a63728-cd5d-4d53-99cf-2409bd1c744c/README.md @@ -7,7 +7,7 @@ ╚═╝ ╚═════╝ ╚══╝╚══╝ ╚══════╝╚═╝ ╚═╝ ``` # abstract class SessionHelper (Details) -> namespace: **VDM\Joomla\Componentbuilder\Utilities** +> namespace: **VDM\Joomla\Utilities** ```uml @startuml diff --git a/src/47a63728-cd5d-4d53-99cf-2409bd1c744c/code.php b/src/47a63728-cd5d-4d53-99cf-2409bd1c744c/code.php index 898a2ee..5cdf483 100644 --- a/src/47a63728-cd5d-4d53-99cf-2409bd1c744c/code.php +++ b/src/47a63728-cd5d-4d53-99cf-2409bd1c744c/code.php @@ -9,7 +9,7 @@ * @license GNU General Public License version 2 or later; see LICENSE.txt */ -namespace VDM\Joomla\Componentbuilder\Utilities; +namespace VDM\Joomla\Utilities; use Joomla\CMS\Factory; diff --git a/src/47a63728-cd5d-4d53-99cf-2409bd1c744c/settings.json b/src/47a63728-cd5d-4d53-99cf-2409bd1c744c/settings.json index 752ffa6..fe5ee3a 100644 --- a/src/47a63728-cd5d-4d53-99cf-2409bd1c744c/settings.json +++ b/src/47a63728-cd5d-4d53-99cf-2409bd1c744c/settings.json @@ -11,7 +11,7 @@ "type": "abstract class", "use_selection": null, "extendsinterfaces": null, - "namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Utilities.SessionHelper", + "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 \r\n * @git 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;", diff --git a/src/993fe913-8e36-4800-a5f7-544aa728ee48/README.md b/src/993fe913-8e36-4800-a5f7-544aa728ee48/README.md new file mode 100644 index 0000000..2f4b807 --- /dev/null +++ b/src/993fe913-8e36-4800-a5f7-544aa728ee48/README.md @@ -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) + diff --git a/src/993fe913-8e36-4800-a5f7-544aa728ee48/code.php b/src/993fe913-8e36-4800-a5f7-544aa728ee48/code.php new file mode 100644 index 0000000..f8dc8f6 --- /dev/null +++ b/src/993fe913-8e36-4800-a5f7-544aa728ee48/code.php @@ -0,0 +1,294 @@ + + * @git 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; + } +} + diff --git a/src/993fe913-8e36-4800-a5f7-544aa728ee48/code.power b/src/993fe913-8e36-4800-a5f7-544aa728ee48/code.power new file mode 100644 index 0000000..068200a --- /dev/null +++ b/src/993fe913-8e36-4800-a5f7-544aa728ee48/code.power @@ -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; + } \ No newline at end of file diff --git a/src/993fe913-8e36-4800-a5f7-544aa728ee48/settings.json b/src/993fe913-8e36-4800-a5f7-544aa728ee48/settings.json new file mode 100644 index 0000000..fdcd023 --- /dev/null +++ b/src/993fe913-8e36-4800-a5f7-544aa728ee48/settings.json @@ -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 \r\n * @git 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": "" +} \ No newline at end of file diff --git a/src/bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8/code.php b/src/bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8/code.php index af809dc..9dbeb56 100644 --- a/src/bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8/code.php +++ b/src/bfd1d6d5-56c1-4fe9-9fee-1c5910e1f5d8/code.php @@ -59,7 +59,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(255)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -76,7 +76,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(255)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -127,7 +127,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(255)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -144,7 +144,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(255)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -331,7 +331,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(255)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -365,7 +365,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(255)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -535,7 +535,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -569,7 +569,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'CHAR(64)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -756,7 +756,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -807,7 +807,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(255)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -1171,7 +1171,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -1406,7 +1406,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(255)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -1440,7 +1440,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(255)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -1491,7 +1491,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -1525,7 +1525,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -1593,7 +1593,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(36)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -1644,7 +1644,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'CHAR(64)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -2003,7 +2003,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'CHAR(64)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -2044,7 +2044,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -2425,7 +2425,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(36)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -2442,7 +2442,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(255)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -2843,7 +2843,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'CHAR(64)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -3132,7 +3132,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(36)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -3149,7 +3149,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(255)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -3216,7 +3216,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(36)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -3283,7 +3283,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(255)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -3317,7 +3317,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'CHAR(64)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -3494,7 +3494,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(1024)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -3685,7 +3685,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(36)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -3702,7 +3702,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(255)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -3752,7 +3752,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'CHAR(64)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -3769,7 +3769,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(255)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -3837,7 +3837,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'MEDIUMTEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -4092,7 +4092,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -4143,7 +4143,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -4211,7 +4211,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -4422,7 +4422,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'CHAR(64)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -4490,7 +4490,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -4558,7 +4558,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -4626,7 +4626,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -4694,7 +4694,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -4762,7 +4762,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -4830,7 +4830,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -4898,7 +4898,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -5085,7 +5085,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -5119,7 +5119,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -5170,7 +5170,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'MEDIUMTEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -5272,7 +5272,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(36)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -5339,7 +5339,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(255)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -5356,7 +5356,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(255)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -5414,7 +5414,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -5431,7 +5431,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -5448,7 +5448,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -5608,7 +5608,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -5775,7 +5775,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -5884,7 +5884,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -5935,7 +5935,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(36)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -6002,7 +6002,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(255)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -6019,7 +6019,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(255)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -6111,7 +6111,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -6237,7 +6237,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -6261,7 +6261,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -6295,7 +6295,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -6445,7 +6445,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -6547,7 +6547,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -6598,7 +6598,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(36)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -6648,7 +6648,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(255)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -6665,7 +6665,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(255)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -6740,7 +6740,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -6805,7 +6805,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(255)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -6838,7 +6838,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(255)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -6855,7 +6855,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(255)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -6954,7 +6954,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -6995,7 +6995,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(255)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -7028,7 +7028,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(255)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -7079,7 +7079,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'MEDIUMTEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -7096,7 +7096,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'MEDIUMTEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -7147,7 +7147,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -7239,7 +7239,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'MEDIUMTEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -7273,7 +7273,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -7331,7 +7331,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -7365,7 +7365,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'MEDIUMTEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -7382,7 +7382,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(255)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -7399,7 +7399,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'MEDIUMTEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -7433,7 +7433,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'MEDIUMTEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -7450,7 +7450,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'MEDIUMTEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -7467,7 +7467,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -7484,7 +7484,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'MEDIUMTEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -7501,7 +7501,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -7518,7 +7518,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -7569,7 +7569,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -7586,7 +7586,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(36)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -7603,7 +7603,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -7880,7 +7880,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(255)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -7931,7 +7931,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(36)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -8022,7 +8022,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(255)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -8073,7 +8073,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(36)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -8148,7 +8148,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -8181,7 +8181,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(255)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -8231,7 +8231,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(255)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -8347,7 +8347,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'MEDIUMTEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -8381,7 +8381,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(36)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -8414,7 +8414,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(255)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -8472,7 +8472,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(255)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -8513,7 +8513,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(36)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -8598,7 +8598,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -8615,7 +8615,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -8682,7 +8682,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(255)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -8756,7 +8756,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(255)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -8882,7 +8882,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -8899,7 +8899,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -8916,7 +8916,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -8933,7 +8933,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -8967,7 +8967,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -8984,7 +8984,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -9001,7 +9001,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -9018,7 +9018,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'CHAR(64)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -9052,7 +9052,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'CHAR(64)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -9069,7 +9069,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -9154,7 +9154,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -9171,7 +9171,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(36)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -9204,7 +9204,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(255)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -9272,7 +9272,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'CHAR(64)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -9306,7 +9306,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(255)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -9357,7 +9357,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -9408,7 +9408,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'CHAR(64)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -9425,7 +9425,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(36)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -9597,7 +9597,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(255)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -9647,7 +9647,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(255)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -9884,7 +9884,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(255)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -9901,7 +9901,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(255)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -9969,7 +9969,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(36)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -10138,7 +10138,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -10220,7 +10220,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'CHAR(64)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -10237,7 +10237,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -10566,7 +10566,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -10623,7 +10623,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -10680,7 +10680,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -10851,7 +10851,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -11067,7 +11067,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -11124,7 +11124,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -11232,7 +11232,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -11249,7 +11249,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -11453,7 +11453,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(255)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -11527,7 +11527,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -11618,7 +11618,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -11635,7 +11635,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -11685,7 +11685,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(255)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -11884,7 +11884,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -11901,7 +11901,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -11951,7 +11951,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'VARCHAR(255)', 'default' => '', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => true, ], @@ -12123,7 +12123,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], @@ -12140,7 +12140,7 @@ final class Table extends BaseTable implements Tableinterface 'db' => [ 'type' => 'TEXT', 'default' => 'EMPTY', - 'null_switch' => 'NOT NULL', + 'null_switch' => 'NULL', 'unique_key' => false, 'key' => false, ], diff --git a/src/e250638e-4a50-41f9-9172-db3e7f174d26/code.php b/src/e250638e-4a50-41f9-9172-db3e7f174d26/code.php index c5cc647..b470b77 100644 --- a/src/e250638e-4a50-41f9-9172-db3e7f174d26/code.php +++ b/src/e250638e-4a50-41f9-9172-db3e7f174d26/code.php @@ -12,6 +12,8 @@ namespace VDM\Joomla\Componentbuilder\Spreadsheet; +use Joomla\CMS\Factory; +use Joomla\CMS\User\User; use PhpOffice\PhpSpreadsheet\IOFactory; use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet; @@ -105,7 +107,7 @@ final class Exporter 'font' => [ 'bold' => true, 'color' => ['rgb' => '1171A3'], - 'size' => 12, + 'size' => 13, 'name' => 'Verdana' ] ]; @@ -289,6 +291,8 @@ final class Exporter $sheet->getColumnDimension($columnIndex)->setAutoSize(true); $sheet->getStyle($columnIndex . $rowIndex)->applyFromArray($this->headerStyles); $sheet->getStyle($columnIndex . $rowIndex)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER); + $row_height = ($this->headerStyles['font']['size'] ?? 13) + 5; + $sheet->getRowDimension($rowIndex)->setRowHeight($row_height); } elseif ($columnIndex === 'A') { diff --git a/src/e250638e-4a50-41f9-9172-db3e7f174d26/code.power b/src/e250638e-4a50-41f9-9172-db3e7f174d26/code.power index 3f6dc5c..5e15b4c 100644 --- a/src/e250638e-4a50-41f9-9172-db3e7f174d26/code.power +++ b/src/e250638e-4a50-41f9-9172-db3e7f174d26/code.power @@ -76,7 +76,7 @@ 'font' => [ 'bold' => true, 'color' => ['rgb' => '1171A3'], - 'size' => 12, + 'size' => 13, 'name' => 'Verdana' ] ]; @@ -260,6 +260,8 @@ $sheet->getColumnDimension($columnIndex)->setAutoSize(true); $sheet->getStyle($columnIndex . $rowIndex)->applyFromArray($this->headerStyles); $sheet->getStyle($columnIndex . $rowIndex)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER); + $row_height = ($this->headerStyles['font']['size'] ?? 13) + 5; + $sheet->getRowDimension($rowIndex)->setRowHeight($row_height); } elseif ($columnIndex === 'A') { diff --git a/src/e250638e-4a50-41f9-9172-db3e7f174d26/settings.json b/src/e250638e-4a50-41f9-9172-db3e7f174d26/settings.json index d089f70..1e77de2 100644 --- a/src/e250638e-4a50-41f9-9172-db3e7f174d26/settings.json +++ b/src/e250638e-4a50-41f9-9172-db3e7f174d26/settings.json @@ -1,5 +1,5 @@ { - "add_head": "0", + "add_head": "1", "add_licensing_template": "2", "extends": "", "guid": "e250638e-4a50-41f9-9172-db3e7f174d26", @@ -19,7 +19,7 @@ "namespace": "[[[NamespacePrefix]]]\\Joomla\\[[[ComponentNamespace]]].Spreadsheet.Exporter", "description": "Spreadsheet Exporter Class\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 \r\n * @git Joomla Component Builder \r\n * @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.\r\n * @license GNU General Public License version 2 or later; see LICENSE.txt\r\n *\/\r\n", - "head": "", + "head": "use Joomla\\CMS\\Factory;\r\nuse Joomla\\CMS\\User\\User;", "composer": { "composer0": { "access_point": "phpspreadsheet\/vendor\/autoload.php", diff --git a/super-powers.json b/super-powers.json index f7efc3d..450c6f2 100644 --- a/super-powers.json +++ b/super-powers.json @@ -332,7 +332,7 @@ "47a63728-cd5d-4d53-99cf-2409bd1c744c": { "name": "SessionHelper", "type": "abstract class", - "namespace": "VDM\\Joomla\\Componentbuilder\\Utilities", + "namespace": "VDM\\Joomla\\Utilities", "code": "src\/47a63728-cd5d-4d53-99cf-2409bd1c744c\/code.php", "power": "src\/47a63728-cd5d-4d53-99cf-2409bd1c744c\/code.power", "settings": "src\/47a63728-cd5d-4d53-99cf-2409bd1c744c\/settings.json", @@ -747,6 +747,17 @@ "spk": "Super---95c02df3_fe0a_405b_b506_b7a5b8605b66---Power", "guid": "95c02df3-fe0a-405b-b506-b7a5b8605b66" }, + "993fe913-8e36-4800-a5f7-544aa728ee48": { + "name": "DateHelper", + "type": "abstract class", + "namespace": "VDM\\Joomla\\Utilities", + "code": "src\/993fe913-8e36-4800-a5f7-544aa728ee48\/code.php", + "power": "src\/993fe913-8e36-4800-a5f7-544aa728ee48\/code.power", + "settings": "src\/993fe913-8e36-4800-a5f7-544aa728ee48\/settings.json", + "path": "src\/993fe913-8e36-4800-a5f7-544aa728ee48", + "spk": "Super---993fe913_8e36_4800_a5f7_544aa728ee48---Power", + "guid": "993fe913-8e36-4800-a5f7-544aa728ee48" + }, "9ae018a5-9064-40ed-ad69-9c1ed2a459f5": { "name": "ChunkReadFilter", "type": "final class",