ogsoft-example/app/Services/WorkingDays/PublicHolidays/PublicHolidaysGeneratorFactory.php

23 lines
652 B
PHP
Raw Normal View History

<?php
declare(strict_types=1);
namespace App\Services\WorkingDays\PublicHolidays;
use App\Services\WorkingDays\PublicHolidays\Generator\PublicHolidaysCzechGenerator;
use App\Services\WorkingDays\PublicHolidays\Generator\PublicHolidaysGenerator;
/**
* Factory for creating public holidays generators
*/
class PublicHolidaysGeneratorFactory
{
public function createPublicHolidaysGeneratorForCountry(string $countryCode): PublicHolidaysGenerator
{
return match ($countryCode) {
'CZ' => new PublicHolidaysCzechGenerator(),
default => throw new \RuntimeException('Unsupported country code'),
};
}
}