meobda-website/app/Actions/GetCurrentAuditionEtudeSet.php

21 lines
369 B
PHP

<?php
namespace App\Actions;
use Carbon\Carbon;
class GetCurrentAuditionEtudeSet
{
public function __invoke(): int
{
return $this->getCurrentSet();
}
public function getCurrentSet(?string $date = null): int
{
$date = $date ? Carbon::parse($date) : now();
return $date->month < 3 ? $date->year : $date->year + 1;
}
}