63 lines
2.1 KiB
PHP
63 lines
2.1 KiB
PHP
<?php
|
|
|
|
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 ?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->auditRepositoryFactory->createApiAuditLogRepository();
|
|
}
|
|
|
|
public function createUserLifecycleAuditRepository(): UserLifecycleAuditRepository
|
|
{
|
|
return $this->auditRepositoryFactory->createUserLifecycleAuditRepository();
|
|
}
|
|
|
|
public function createSystemAuditLogRepository(): SystemAuditLogRepository
|
|
{
|
|
return $this->auditRepositoryFactory->createSystemAuditLogRepository();
|
|
}
|
|
|
|
public function createApiAuditService(): ApiAuditService
|
|
{
|
|
return $this->apiAuditService ??= new ApiAuditService($this->createApiAuditLogRepository());
|
|
}
|
|
|
|
public function createUserLifecycleAuditService(): UserLifecycleAuditService
|
|
{
|
|
return $this->userLifecycleAuditService ??= new UserLifecycleAuditService(
|
|
$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
|
|
);
|
|
}
|
|
}
|