feat(services): add public holidays states infra
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Services\WorkingDays\PublicHolidays;
|
||||
|
||||
use App\Services\WorkingDays\PublicHolidays\Storage\PublicHolidaysStorageInterface;
|
||||
use App\Services\WorkingDays\WorkingDayDeterminerInterface;
|
||||
|
||||
class PublicHolidaysStateFactory
|
||||
{
|
||||
public function __construct(
|
||||
private readonly PublicHolidaysStorageInterface $holidaysStorage,
|
||||
) {
|
||||
}
|
||||
|
||||
public function createStoreForCountry(string $countryCode): PublicHolidaysStateStorageInterface
|
||||
{
|
||||
return $this->getStateImpl($countryCode);
|
||||
}
|
||||
|
||||
public function createDeterminerForCountry(string $countryCode): PublicHolidaysStateDeterminerInterface&WorkingDayDeterminerInterface
|
||||
{
|
||||
return $this->getStateImpl($countryCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $countryCode
|
||||
* @return PublicHolidaysStateDeterminer
|
||||
*/
|
||||
protected function getStateImpl(string $countryCode): PublicHolidaysStateDeterminer
|
||||
{
|
||||
return new PublicHolidaysStateDeterminer($this->holidaysStorage, $countryCode);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user