2026-02-23 12:58:19 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace MintyPHP\Service\Settings;
|
|
|
|
|
|
2026-03-05 08:26:51 +01:00
|
|
|
use MintyPHP\Repository\Access\RoleRepositoryInterface;
|
|
|
|
|
use MintyPHP\Repository\Org\DepartmentRepositoryInterface;
|
|
|
|
|
use MintyPHP\Repository\Settings\SettingRepositoryInterface;
|
|
|
|
|
use MintyPHP\Repository\Tenant\TenantRepositoryInterface;
|
2026-02-23 12:58:19 +01:00
|
|
|
|
|
|
|
|
class SettingServicesFactory
|
|
|
|
|
{
|
2026-03-13 11:31:33 +01:00
|
|
|
private ?ThemeConfigGateway $themeConfigService = null;
|
2026-02-23 12:58:19 +01:00
|
|
|
private ?SettingCacheService $settingCacheService = null;
|
2026-03-06 00:44:52 +01:00
|
|
|
private ?SettingsCryptoGatewayInterface $settingsCryptoGateway = null;
|
|
|
|
|
private ?SettingsMetadataGateway $settingsMetadataGateway = null;
|
|
|
|
|
private ?SettingsDefaultsGateway $settingsDefaultsGateway = null;
|
|
|
|
|
private ?SettingsAppGateway $settingsAppGateway = null;
|
|
|
|
|
private ?SettingsApiPolicyGateway $settingsApiPolicyGateway = null;
|
|
|
|
|
private ?SettingsUserLifecycleGateway $settingsUserLifecycleGateway = null;
|
|
|
|
|
private ?SettingsSystemAuditGateway $settingsSystemAuditGateway = null;
|
|
|
|
|
private ?SettingsFrontendTelemetryGateway $settingsFrontendTelemetryGateway = null;
|
|
|
|
|
private ?SettingsMicrosoftGateway $settingsMicrosoftGateway = null;
|
2026-03-09 19:16:26 +01:00
|
|
|
private ?SettingsSessionGateway $settingsSessionGateway = null;
|
2026-03-06 00:44:52 +01:00
|
|
|
private ?SettingsSmtpGateway $settingsSmtpGateway = null;
|
2026-03-10 22:48:10 +01:00
|
|
|
private ?SettingsLoginPersistenceGateway $settingsLoginPersistenceGateway = null;
|
2026-02-23 12:58:19 +01:00
|
|
|
|
2026-03-04 15:56:58 +01:00
|
|
|
public function __construct(
|
|
|
|
|
private readonly SettingRepositoryFactory $settingRepositoryFactory
|
2026-03-05 11:17:42 +01:00
|
|
|
) {
|
|
|
|
|
}
|
2026-03-04 15:56:58 +01:00
|
|
|
|
2026-03-05 08:26:51 +01:00
|
|
|
public function createSettingRepository(): SettingRepositoryInterface
|
2026-02-23 12:58:19 +01:00
|
|
|
{
|
2026-03-04 15:56:58 +01:00
|
|
|
return $this->settingRepositoryFactory->createSettingRepository();
|
2026-02-23 12:58:19 +01:00
|
|
|
}
|
|
|
|
|
|
2026-03-06 00:44:52 +01:00
|
|
|
public function createSettingsMetadataGateway(): SettingsMetadataGateway
|
2026-02-23 12:58:19 +01:00
|
|
|
{
|
2026-03-06 00:44:52 +01:00
|
|
|
return $this->settingsMetadataGateway ??= new SettingsMetadataGateway($this->createSettingRepository());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function createSettingsDefaultsGateway(): SettingsDefaultsGateway
|
|
|
|
|
{
|
|
|
|
|
return $this->settingsDefaultsGateway ??= new SettingsDefaultsGateway(
|
|
|
|
|
$this->createSettingsMetadataGateway(),
|
2026-02-23 12:58:19 +01:00
|
|
|
$this->createTenantRepository(),
|
|
|
|
|
$this->createRoleRepository(),
|
|
|
|
|
$this->createDepartmentRepository(),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-06 00:44:52 +01:00
|
|
|
public function createSettingsAppGateway(): SettingsAppGateway
|
|
|
|
|
{
|
|
|
|
|
return $this->settingsAppGateway ??= new SettingsAppGateway(
|
|
|
|
|
$this->createSettingsMetadataGateway(),
|
2026-03-13 11:31:33 +01:00
|
|
|
$this->createThemeConfigGateway(),
|
2026-03-06 00:44:52 +01:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function createSettingsApiPolicyGateway(): SettingsApiPolicyGateway
|
|
|
|
|
{
|
|
|
|
|
return $this->settingsApiPolicyGateway ??= new SettingsApiPolicyGateway($this->createSettingsMetadataGateway());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function createSettingsUserLifecycleGateway(): SettingsUserLifecycleGateway
|
|
|
|
|
{
|
|
|
|
|
return $this->settingsUserLifecycleGateway ??= new SettingsUserLifecycleGateway($this->createSettingsMetadataGateway());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function createSettingsSystemAuditGateway(): SettingsSystemAuditGateway
|
|
|
|
|
{
|
|
|
|
|
return $this->settingsSystemAuditGateway ??= new SettingsSystemAuditGateway($this->createSettingsMetadataGateway());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function createSettingsFrontendTelemetryGateway(): SettingsFrontendTelemetryGateway
|
|
|
|
|
{
|
|
|
|
|
return $this->settingsFrontendTelemetryGateway ??= new SettingsFrontendTelemetryGateway($this->createSettingsMetadataGateway());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function createSettingsMicrosoftGateway(): SettingsMicrosoftGateway
|
|
|
|
|
{
|
|
|
|
|
return $this->settingsMicrosoftGateway ??= new SettingsMicrosoftGateway(
|
|
|
|
|
$this->createSettingsMetadataGateway(),
|
|
|
|
|
$this->createSettingsCryptoGateway(),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-09 19:16:26 +01:00
|
|
|
public function createSettingsSessionGateway(): SettingsSessionGateway
|
|
|
|
|
{
|
|
|
|
|
return $this->settingsSessionGateway ??= new SettingsSessionGateway($this->createSettingsMetadataGateway());
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-06 00:44:52 +01:00
|
|
|
public function createSettingsSmtpGateway(): SettingsSmtpGateway
|
2026-02-23 12:58:19 +01:00
|
|
|
{
|
2026-03-06 00:44:52 +01:00
|
|
|
return $this->settingsSmtpGateway ??= new SettingsSmtpGateway($this->createSettingsMetadataGateway());
|
2026-02-23 12:58:19 +01:00
|
|
|
}
|
|
|
|
|
|
2026-03-10 22:48:10 +01:00
|
|
|
public function createSettingsLoginPersistenceGateway(): SettingsLoginPersistenceGateway
|
|
|
|
|
{
|
|
|
|
|
return $this->settingsLoginPersistenceGateway ??= new SettingsLoginPersistenceGateway($this->createSettingsMetadataGateway());
|
|
|
|
|
}
|
|
|
|
|
|
2026-02-23 12:58:19 +01:00
|
|
|
public function createSettingCacheService(): SettingCacheService
|
|
|
|
|
{
|
2026-04-01 20:27:42 +02:00
|
|
|
return $this->settingCacheService ??= new SettingCacheService(
|
|
|
|
|
null,
|
|
|
|
|
$this->createSettingsMetadataGateway()
|
|
|
|
|
);
|
2026-02-23 12:58:19 +01:00
|
|
|
}
|
|
|
|
|
|
2026-03-13 11:31:33 +01:00
|
|
|
public function createThemeConfigGateway(): ThemeConfigGateway
|
2026-02-23 12:58:19 +01:00
|
|
|
{
|
2026-03-13 11:31:33 +01:00
|
|
|
return $this->themeConfigService ??= new ThemeConfigGateway();
|
2026-02-23 12:58:19 +01:00
|
|
|
}
|
|
|
|
|
|
2026-03-06 00:44:52 +01:00
|
|
|
public function createSettingsCryptoGateway(): SettingsCryptoGatewayInterface
|
|
|
|
|
{
|
|
|
|
|
return $this->settingsCryptoGateway ??= new SettingsCryptoGateway();
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-05 08:26:51 +01:00
|
|
|
private function createTenantRepository(): TenantRepositoryInterface
|
2026-02-23 12:58:19 +01:00
|
|
|
{
|
2026-03-04 15:56:58 +01:00
|
|
|
return $this->settingRepositoryFactory->createTenantRepository();
|
2026-02-23 12:58:19 +01:00
|
|
|
}
|
|
|
|
|
|
2026-03-05 08:26:51 +01:00
|
|
|
private function createRoleRepository(): RoleRepositoryInterface
|
2026-02-23 12:58:19 +01:00
|
|
|
{
|
2026-03-04 15:56:58 +01:00
|
|
|
return $this->settingRepositoryFactory->createRoleRepository();
|
2026-02-23 12:58:19 +01:00
|
|
|
}
|
|
|
|
|
|
2026-03-05 08:26:51 +01:00
|
|
|
private function createDepartmentRepository(): DepartmentRepositoryInterface
|
2026-02-23 12:58:19 +01:00
|
|
|
{
|
2026-03-04 15:56:58 +01:00
|
|
|
return $this->settingRepositoryFactory->createDepartmentRepository();
|
2026-02-23 12:58:19 +01:00
|
|
|
}
|
|
|
|
|
}
|