diff --git a/src/Actions/CalculateBelgianHolidaysAction.php b/src/Actions/Belgium.php similarity index 96% rename from src/Actions/CalculateBelgianHolidaysAction.php rename to src/Actions/Belgium.php index 6de983298..a2c774e0b 100644 --- a/src/Actions/CalculateBelgianHolidaysAction.php +++ b/src/Actions/Belgium.php @@ -5,11 +5,10 @@ use Carbon\CarbonImmutable; use Spatie\Holidays\Data\Holiday; -class CalculateBelgianHolidaysAction +class Belgium implements Executable { protected int $year; - /** @return array */ public function execute(int $year): array { $this->year = $year; diff --git a/src/Actions/Executable.php b/src/Actions/Executable.php new file mode 100644 index 000000000..14049fcac --- /dev/null +++ b/src/Actions/Executable.php @@ -0,0 +1,11 @@ + */ + public function execute(int $year): array; +} diff --git a/src/Holidays.php b/src/Holidays.php index dfbba314a..d755f5f6f 100755 --- a/src/Holidays.php +++ b/src/Holidays.php @@ -3,7 +3,7 @@ namespace Spatie\Holidays; use Carbon\CarbonImmutable; -use Spatie\Holidays\Actions\CalculateBelgianHolidaysAction; +use Spatie\Holidays\Actions\Belgium; use Spatie\Holidays\Data\Holiday; use Spatie\Holidays\Exceptions\HolidaysException; @@ -45,7 +45,7 @@ public function get(): array protected function calculate(): self { $action = match ($this->countryCode) { - 'BE' => (new CalculateBelgianHolidaysAction()), + 'BE' => new Belgium(), null => throw HolidaysException::noCountryCode(), default => throw HolidaysException::unknownCountryCode($this->countryCode), };