major update
This commit is contained in:
@@ -3,23 +3,35 @@
|
||||
namespace MintyPHP\Service\Audit;
|
||||
|
||||
use MintyPHP\Repository\Audit\ApiAuditLogRepository;
|
||||
use MintyPHP\Repository\Audit\SystemAuditLogRepository;
|
||||
use MintyPHP\Repository\Audit\UserLifecycleAuditRepository;
|
||||
use MintyPHP\Service\Settings\SettingGateway;
|
||||
|
||||
class AuditServicesFactory
|
||||
{
|
||||
private ?ApiAuditLogRepository $apiAuditLogRepository = null;
|
||||
private ?UserLifecycleAuditRepository $userLifecycleAuditRepository = null;
|
||||
private ?ApiAuditService $apiAuditService = null;
|
||||
private ?UserLifecycleAuditService $userLifecycleAuditService = null;
|
||||
private ?SystemAuditRedactionService $systemAuditRedactionService = null;
|
||||
private ?SystemAuditService $systemAuditService = null;
|
||||
|
||||
public function __construct(
|
||||
private readonly AuditRepositoryFactory $auditRepositoryFactory,
|
||||
private readonly SettingGateway $settingGateway
|
||||
) {}
|
||||
|
||||
public function createApiAuditLogRepository(): ApiAuditLogRepository
|
||||
{
|
||||
return $this->apiAuditLogRepository ??= new ApiAuditLogRepository();
|
||||
return $this->auditRepositoryFactory->createApiAuditLogRepository();
|
||||
}
|
||||
|
||||
public function createUserLifecycleAuditRepository(): UserLifecycleAuditRepository
|
||||
{
|
||||
return $this->userLifecycleAuditRepository ??= new UserLifecycleAuditRepository();
|
||||
return $this->auditRepositoryFactory->createUserLifecycleAuditRepository();
|
||||
}
|
||||
|
||||
public function createSystemAuditLogRepository(): SystemAuditLogRepository
|
||||
{
|
||||
return $this->auditRepositoryFactory->createSystemAuditLogRepository();
|
||||
}
|
||||
|
||||
public function createApiAuditService(): ApiAuditService
|
||||
@@ -33,4 +45,18 @@ class AuditServicesFactory
|
||||
$this->createUserLifecycleAuditRepository()
|
||||
);
|
||||
}
|
||||
|
||||
public function createSystemAuditRedactionService(): SystemAuditRedactionService
|
||||
{
|
||||
return $this->systemAuditRedactionService ??= new SystemAuditRedactionService();
|
||||
}
|
||||
|
||||
public function createSystemAuditService(): SystemAuditService
|
||||
{
|
||||
return $this->systemAuditService ??= new SystemAuditService(
|
||||
$this->createSystemAuditLogRepository(),
|
||||
$this->createSystemAuditRedactionService(),
|
||||
$this->settingGateway
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user