36 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?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);
 | |
|     }
 | |
| }
 |