From 289a130ef6c9b1173ba25ce8088261b9be308c53 Mon Sep 17 00:00:00 2001 From: Niels Vanpachtenbeke <10651054+Nielsvanpach@users.noreply.github.com> Date: Fri, 9 Feb 2024 13:14:03 +0100 Subject: [PATCH] reorganise --- src/Concerns/Observable.php | 46 ++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src/Concerns/Observable.php b/src/Concerns/Observable.php index 686c11b6d..aa7254ff7 100644 --- a/src/Concerns/Observable.php +++ b/src/Concerns/Observable.php @@ -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)) { @@ -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, + }; + } }