diff --git a/app/Providers/WorkingDaysProvider.php b/app/Providers/WorkingDaysProvider.php new file mode 100644 index 0000000..c73c810 --- /dev/null +++ b/app/Providers/WorkingDaysProvider.php @@ -0,0 +1,57 @@ +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 + { + } +} diff --git a/bootstrap/providers.php b/bootstrap/providers.php index 38b258d..94930ec 100644 --- a/bootstrap/providers.php +++ b/bootstrap/providers.php @@ -1,5 +1,6 @@