Files
breadcrumb-the-shire/lib/Service/Audit/AuditServicesFactory.php

63 lines
2.1 KiB
PHP
Raw Normal View History

2026-02-23 12:58:19 +01:00
<?php
namespace MintyPHP\Service\Audit;
use MintyPHP\Repository\Audit\ApiAuditLogRepository;
2026-03-04 15:56:58 +01:00
use MintyPHP\Repository\Audit\SystemAuditLogRepository;
2026-02-23 12:58:19 +01:00
use MintyPHP\Repository\Audit\UserLifecycleAuditRepository;
2026-03-04 15:56:58 +01:00
use MintyPHP\Service\Settings\SettingGateway;
2026-02-23 12:58:19 +01:00
class AuditServicesFactory
{
private ?ApiAuditService $apiAuditService = null;
private ?UserLifecycleAuditService $userLifecycleAuditService = null;
2026-03-04 15:56:58 +01:00
private ?SystemAuditRedactionService $systemAuditRedactionService = null;
private ?SystemAuditService $systemAuditService = null;
public function __construct(
private readonly AuditRepositoryFactory $auditRepositoryFactory,
private readonly SettingGateway $settingGateway
) {}
2026-02-23 12:58:19 +01:00
public function createApiAuditLogRepository(): ApiAuditLogRepository
{
2026-03-04 15:56:58 +01:00
return $this->auditRepositoryFactory->createApiAuditLogRepository();
2026-02-23 12:58:19 +01:00
}
public function createUserLifecycleAuditRepository(): UserLifecycleAuditRepository
{
2026-03-04 15:56:58 +01:00
return $this->auditRepositoryFactory->createUserLifecycleAuditRepository();
}
public function createSystemAuditLogRepository(): SystemAuditLogRepository
{
return $this->auditRepositoryFactory->createSystemAuditLogRepository();
2026-02-23 12:58:19 +01:00
}
public function createApiAuditService(): ApiAuditService
{
return $this->apiAuditService ??= new ApiAuditService($this->createApiAuditLogRepository());
}
public function createUserLifecycleAuditService(): UserLifecycleAuditService
{
return $this->userLifecycleAuditService ??= new UserLifecycleAuditService(
$this->createUserLifecycleAuditRepository()
);
}
2026-03-04 15:56:58 +01:00
public function createSystemAuditRedactionService(): SystemAuditRedactionService
{
return $this->systemAuditRedactionService ??= new SystemAuditRedactionService();
}
public function createSystemAuditService(): SystemAuditService
{
return $this->systemAuditService ??= new SystemAuditService(
$this->createSystemAuditLogRepository(),
$this->createSystemAuditRedactionService(),
$this->settingGateway
);
}
2026-02-23 12:58:19 +01:00
}