58 lines
1.8 KiB
PHP
58 lines
1.8 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Services\Utils\DurationConvertor;
|
|
use App\Services\WorkingDays\DurationSolverFactory;
|
|
use App\Services\WorkingDays\PublicHolidays\PublicHolidaysGeneratorFactory;
|
|
use App\Services\WorkingDays\PublicHolidays\PublicHolidaysStateFactory;
|
|
use App\Services\WorkingDays\PublicHolidays\Storage\DatabaseStorage;
|
|
use App\Services\WorkingDays\PublicHolidays\Storage\PublicHolidaysStorageInterface;
|
|
use App\Services\WorkingDays\WorkingDayDeterminerFactory;
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
class WorkingDaysProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Register any application services.
|
|
*/
|
|
public function register(): void
|
|
{
|
|
$this->app->singleton(PublicHolidaysStorageInterface::class, function () {
|
|
return new DatabaseStorage();
|
|
});
|
|
|
|
$this->app->singleton(PublicHolidaysStateFactory::class, function() {
|
|
return new PublicHolidaysStateFactory(
|
|
$this->app->make(PublicHolidaysStorageInterface::class)
|
|
);
|
|
});
|
|
|
|
$this->app->singleton(WorkingDayDeterminerFactory::class, function() {
|
|
return new WorkingDayDeterminerFactory(
|
|
$this->app->make(PublicHolidaysStateFactory::class)
|
|
);
|
|
});
|
|
|
|
$this->app->singleton(DurationSolverFactory::class, function() {
|
|
return new DurationSolverFactory(
|
|
$this->app->make(WorkingDayDeterminerFactory::class),
|
|
$this->app->make(DurationConvertor::class)
|
|
);
|
|
});
|
|
|
|
$this->app->singleton(PublicHolidaysGeneratorFactory::class, function() {
|
|
return new PublicHolidaysGeneratorFactory();
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Bootstrap any application services.
|
|
*/
|
|
public function boot(): void
|
|
{
|
|
}
|
|
}
|