23 lines
652 B
PHP
23 lines
652 B
PHP
|
<?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'),
|
||
|
};
|
||
|
}
|
||
|
}
|