Files
online.tbbank.gov.tm-larave…/app/Modules/DateHelper/Repositories/DateHelperRepository.php
2025-03-12 23:46:17 +05:00

43 lines
749 B
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;
}
/**
* Years until
*
* @param int|int $max
*
* @return array<int, int>
*/
public static function yearsUntil(int $max = 50): array
{
$years = [];
$currentData = 2024;
for ($i = 0; $i <= $max; $i++) {
$years[] = intval($currentData) + $i;
}
return $years;
}
}