144 lines
3.4 KiB
PHP
144 lines
3.4 KiB
PHP
<?php
|
|
|
|
namespace App\Modules\DateHelper\Repositories;
|
|
|
|
class DateHelperRepository
|
|
{
|
|
/**
|
|
* Month as number
|
|
*
|
|
* @return array<int, string>
|
|
*/
|
|
public static function monthsAsNumber(): array
|
|
{
|
|
$month = [];
|
|
|
|
for ($m = 1; $m <= 12; $m++) {
|
|
$month[] = str_pad(strval($m), 2, '0', STR_PAD_LEFT);
|
|
}
|
|
|
|
return $month;
|
|
}
|
|
|
|
/**
|
|
* Static numbers for months
|
|
*
|
|
* @return array<string, string>
|
|
*/
|
|
public static function staticNumberMonths(): array
|
|
{
|
|
return [
|
|
'01' => '01',
|
|
'02' => '02',
|
|
'03' => '03',
|
|
'04' => '04',
|
|
'05' => '05',
|
|
'06' => '06',
|
|
'07' => '07',
|
|
'08' => '08',
|
|
'09' => '09',
|
|
'10' => '10',
|
|
'11' => '11',
|
|
'12' => '12',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Years until
|
|
*
|
|
* @param int|int $max
|
|
*
|
|
* @return array<string|int, string|int>
|
|
*/
|
|
public static function yearsUntil(int $max = 50): array
|
|
{
|
|
$years = [];
|
|
|
|
$currentData = 2024;
|
|
|
|
for ($i = 0; $i <= $max; $i++) {
|
|
$years[] = intval($currentData) + $i;
|
|
}
|
|
|
|
return $years;
|
|
}
|
|
|
|
/**
|
|
* Static numbers for years
|
|
*
|
|
* @return array<int, string>
|
|
*/
|
|
public static function staticNumberYears(): array
|
|
{
|
|
return [
|
|
'2024' => '2024',
|
|
'2025' => '2025',
|
|
'2026' => '2026',
|
|
'2027' => '2027',
|
|
'2028' => '2028',
|
|
'2029' => '2029',
|
|
'2030' => '2030',
|
|
'2031' => '2031',
|
|
'2032' => '2032',
|
|
'2033' => '2033',
|
|
'2034' => '2034',
|
|
'2035' => '2035',
|
|
'2036' => '2036',
|
|
'2037' => '2037',
|
|
'2038' => '2038',
|
|
'2039' => '2039',
|
|
'2040' => '2040',
|
|
'2041' => '2041',
|
|
'2042' => '2042',
|
|
'2043' => '2043',
|
|
'2044' => '2044',
|
|
'2045' => '2045',
|
|
'2046' => '2046',
|
|
'2047' => '2047',
|
|
'2048' => '2048',
|
|
'2049' => '2049',
|
|
'2050' => '2050',
|
|
'2051' => '2051',
|
|
'2052' => '2052',
|
|
'2053' => '2053',
|
|
'2054' => '2054',
|
|
'2055' => '2055',
|
|
'2056' => '2056',
|
|
'2057' => '2057',
|
|
'2058' => '2058',
|
|
'2059' => '2059',
|
|
'2060' => '2060',
|
|
'2061' => '2061',
|
|
'2062' => '2062',
|
|
'2063' => '2063',
|
|
'2064' => '2064',
|
|
'2065' => '2065',
|
|
'2066' => '2066',
|
|
'2067' => '2067',
|
|
'2068' => '2068',
|
|
'2069' => '2069',
|
|
'2070' => '2070',
|
|
'2071' => '2071',
|
|
'2072' => '2072',
|
|
'2073' => '2073',
|
|
'2074' => '2074',
|
|
'2075' => '2075',
|
|
'2076' => '2076',
|
|
'2077' => '2077',
|
|
'2078' => '2078',
|
|
'2079' => '2079',
|
|
'2080' => '2080',
|
|
'2081' => '2081',
|
|
'2082' => '2082',
|
|
'2083' => '2083',
|
|
'2084' => '2084',
|
|
'2085' => '2085',
|
|
'2086' => '2086',
|
|
'2087' => '2087',
|
|
'2088' => '2088',
|
|
'2089' => '2089',
|
|
'2090' => '2090',
|
|
];
|
|
}
|
|
}
|