Skip to content

Commit

Permalink
reorganise
Browse files Browse the repository at this point in the history
  • Loading branch information
Nielsvanpach committed Feb 9, 2024
1 parent 6a2c268 commit 289a130
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions src/Concerns/Observable.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,6 @@

trait Observable
{
protected function observedChristmasDay(int $year): ?CarbonInterface
{
$christmasDay = (new CarbonImmutable($year.'-12-25'))->startOfDay();

return match ($christmasDay->dayName) {
'Saturday' => $christmasDay->next('monday'),
'Sunday' => $christmasDay->next('tuesday'),
default => null,
};
}

protected function observedBoxingDay(int $year): ?CarbonInterface
{
$christmasDay = (new CarbonImmutable($year.'-12-25'))->startOfDay();
$boxingDay = $christmasDay->addDay();

return match ($christmasDay->dayName) {
'Friday' => $boxingDay->next('monday'),
'Saturday' => $boxingDay->next('tuesday'),
default => null,
};
}

protected function weekendToNextMonday(string|CarbonInterface $date, int $year): ?CarbonInterface
{
if (is_string($date)) {
Expand All @@ -55,4 +32,27 @@ protected function sundayToNextMonday(string|CarbonInterface $date, int $year):

return null;
}

protected function observedChristmasDay(int $year): ?CarbonInterface
{
$christmasDay = (new CarbonImmutable($year.'-12-25'))->startOfDay();

return match ($christmasDay->dayName) {
'Saturday' => $christmasDay->next('monday'),
'Sunday' => $christmasDay->next('tuesday'),
default => null,
};
}

protected function observedBoxingDay(int $year): ?CarbonInterface
{
$christmasDay = (new CarbonImmutable($year.'-12-25'))->startOfDay();
$boxingDay = $christmasDay->addDay();

return match ($christmasDay->dayName) {
'Friday' => $boxingDay->next('monday'),
'Saturday' => $boxingDay->next('tuesday'),
default => null,
};
}
}

0 comments on commit 289a130

Please sign in to comment.