feast(services): add duration solver
This commit is contained in:
29
app/Services/WorkingDays/DurationSolverFactory.php
Normal file
29
app/Services/WorkingDays/DurationSolverFactory.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Services\WorkingDays;
|
||||
|
||||
use App\Services\Utils\DurationConvertor;
|
||||
|
||||
class DurationSolverFactory
|
||||
{
|
||||
public function __construct(
|
||||
private readonly WorkingDayDeterminerFactory $workingDayDeterminerFactory,
|
||||
private readonly DurationConvertor $durationConvertor,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create DurationSolver instance for a specific country
|
||||
* @param string $countryCode
|
||||
* @return DurationSolver
|
||||
*/
|
||||
public function createDurationSolverForCountry(string $countryCode): DurationSolver
|
||||
{
|
||||
return new DurationSolver(
|
||||
$this->workingDayDeterminerFactory->createForCountry($countryCode),
|
||||
$this->durationConvertor,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user