forked from fa/breadcrumb-the-shire
67 lines
2.1 KiB
PHP
67 lines
2.1 KiB
PHP
<?php
|
|
|
|
namespace MintyPHP\Service\Settings;
|
|
|
|
use MintyPHP\Repository\Access\RoleRepository;
|
|
use MintyPHP\Repository\Org\DepartmentRepository;
|
|
use MintyPHP\Repository\Settings\SettingRepository;
|
|
use MintyPHP\Repository\Tenant\TenantRepository;
|
|
|
|
class SettingServicesFactory
|
|
{
|
|
private ?SettingRepository $settingRepository = null;
|
|
private ?TenantRepository $tenantRepository = null;
|
|
private ?RoleRepository $roleRepository = null;
|
|
private ?DepartmentRepository $departmentRepository = null;
|
|
private ?ThemeConfigService $themeConfigService = null;
|
|
private ?SettingService $settingService = null;
|
|
private ?SettingCacheService $settingCacheService = null;
|
|
private ?SettingGateway $settingGateway = null;
|
|
|
|
public function createSettingRepository(): SettingRepository
|
|
{
|
|
return $this->settingRepository ??= new SettingRepository();
|
|
}
|
|
|
|
public function createSettingService(): SettingService
|
|
{
|
|
return $this->settingService ??= new SettingService(
|
|
$this->createSettingRepository(),
|
|
$this->createTenantRepository(),
|
|
$this->createRoleRepository(),
|
|
$this->createDepartmentRepository(),
|
|
$this->createThemeConfigService()
|
|
);
|
|
}
|
|
|
|
public function createSettingGateway(): SettingGateway
|
|
{
|
|
return $this->settingGateway ??= new SettingGateway($this->createSettingService());
|
|
}
|
|
|
|
public function createSettingCacheService(): SettingCacheService
|
|
{
|
|
return $this->settingCacheService ??= new SettingCacheService();
|
|
}
|
|
|
|
public function createThemeConfigService(): ThemeConfigService
|
|
{
|
|
return $this->themeConfigService ??= new ThemeConfigService();
|
|
}
|
|
|
|
private function createTenantRepository(): TenantRepository
|
|
{
|
|
return $this->tenantRepository ??= new TenantRepository();
|
|
}
|
|
|
|
private function createRoleRepository(): RoleRepository
|
|
{
|
|
return $this->roleRepository ??= new RoleRepository();
|
|
}
|
|
|
|
private function createDepartmentRepository(): DepartmentRepository
|
|
{
|
|
return $this->departmentRepository ??= new DepartmentRepository();
|
|
}
|
|
}
|