refactor(audit): decouple API audit classes from core via interfaces
Core code (lib/) no longer imports any MintyPHP\Module\Audit\* classes directly. New ApiAuditServiceInterface and ApiSystemAuditReporterInterface follow the existing pattern (interface + null implementation in core, concrete binding from module registrar). DoctorRunner and helpers/app.php now resolve through DI interfaces, ensuring the audit module remains fully optional. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -12,9 +12,13 @@ use MintyPHP\App\Container\Registrars\SettingsRegistrar;
|
||||
use MintyPHP\App\Container\Registrars\UserRegistrar;
|
||||
use MintyPHP\App\Module\ModuleEventDispatcher;
|
||||
use MintyPHP\App\Module\ModuleRegistry;
|
||||
use MintyPHP\Service\Audit\ApiAuditServiceInterface;
|
||||
use MintyPHP\Service\Audit\ApiSystemAuditReporterInterface;
|
||||
use MintyPHP\Service\Audit\AuditMetadataEnricherInterface;
|
||||
use MintyPHP\Service\Audit\AuditRecorderInterface;
|
||||
use MintyPHP\Service\Audit\ImportAuditInterface;
|
||||
use MintyPHP\Service\Audit\NullApiAuditService;
|
||||
use MintyPHP\Service\Audit\NullApiSystemAuditReporter;
|
||||
use MintyPHP\Service\Audit\NullAuditMetadataEnricher;
|
||||
use MintyPHP\Service\Audit\NullAuditRecorder;
|
||||
use MintyPHP\Service\Audit\NullImportAudit;
|
||||
@@ -87,5 +91,11 @@ if (!$container->has(ImportAuditInterface::class)) {
|
||||
if (!$container->has(AuditMetadataEnricherInterface::class)) {
|
||||
$container->set(AuditMetadataEnricherInterface::class, static fn (): AuditMetadataEnricherInterface => new NullAuditMetadataEnricher());
|
||||
}
|
||||
if (!$container->has(ApiAuditServiceInterface::class)) {
|
||||
$container->set(ApiAuditServiceInterface::class, static fn (): ApiAuditServiceInterface => new NullApiAuditService());
|
||||
}
|
||||
if (!$container->has(ApiSystemAuditReporterInterface::class)) {
|
||||
$container->set(ApiSystemAuditReporterInterface::class, static fn (): ApiSystemAuditReporterInterface => new NullApiSystemAuditReporter());
|
||||
}
|
||||
|
||||
return $container;
|
||||
|
||||
Reference in New Issue
Block a user