31 lines
565 B
PHP
31 lines
565 B
PHP
<?php
|
|
|
|
namespace App\Modules\DateHelper\Repositories;
|
|
|
|
class DateHelperRepository
|
|
{
|
|
public static function monthsAsNumber(): array
|
|
{
|
|
$month = [];
|
|
|
|
for ($m = 1; $m <= 12; $m++) {
|
|
$month[] = str_pad(strval($m), 2, '0', STR_PAD_LEFT);
|
|
}
|
|
|
|
return $month;
|
|
}
|
|
|
|
public static function yearsUntil(int $max = 50): array
|
|
{
|
|
$years = [];
|
|
|
|
$currentData = date('Y');
|
|
|
|
for ($i = 0; $i <= $max; $i++) {
|
|
$years[] = intval($currentData) + $i;
|
|
}
|
|
|
|
return $years;
|
|
}
|
|
}
|