62 lines
2.1 KiB
PHP
62 lines
2.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Support\Operations\Reconciliation;
|
|
|
|
final class OperationRunReconciliationRegistry
|
|
{
|
|
public function __construct(
|
|
private readonly RestoreExecuteReconciliationAdapter $restoreExecuteAdapter,
|
|
private readonly EnvironmentReviewComposeReconciliationAdapter $environmentReviewComposeAdapter,
|
|
private readonly EvidenceSnapshotReconciliationAdapter $evidenceSnapshotAdapter,
|
|
private readonly ReviewPackArtifactReconciliationAdapter $reviewPackAdapter,
|
|
private readonly InventorySyncReconciliationAdapter $inventorySyncAdapter,
|
|
private readonly BaselineCaptureReconciliationAdapter $baselineCaptureAdapter,
|
|
private readonly BackupScheduleExecutionReconciliationAdapter $backupScheduleExecutionAdapter,
|
|
) {}
|
|
|
|
/**
|
|
* @return array<int, OperationRunReconciliationAdapter>
|
|
*/
|
|
public function all(): array
|
|
{
|
|
return [
|
|
$this->restoreExecuteAdapter,
|
|
$this->environmentReviewComposeAdapter,
|
|
$this->evidenceSnapshotAdapter,
|
|
$this->reviewPackAdapter,
|
|
$this->inventorySyncAdapter,
|
|
$this->baselineCaptureAdapter,
|
|
$this->backupScheduleExecutionAdapter,
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @return array<int, string>
|
|
*/
|
|
public function supportedTypes(): array
|
|
{
|
|
return array_values(array_unique(array_merge(
|
|
$this->restoreExecuteAdapter->supportedTypes(),
|
|
$this->environmentReviewComposeAdapter->supportedTypes(),
|
|
$this->evidenceSnapshotAdapter->supportedTypes(),
|
|
$this->reviewPackAdapter->supportedTypes(),
|
|
$this->inventorySyncAdapter->supportedTypes(),
|
|
$this->baselineCaptureAdapter->supportedTypes(),
|
|
$this->backupScheduleExecutionAdapter->supportedTypes(),
|
|
)));
|
|
}
|
|
|
|
public function forType(string $type): ?OperationRunReconciliationAdapter
|
|
{
|
|
foreach ($this->all() as $adapter) {
|
|
if ($adapter->supportsType($type)) {
|
|
return $adapter;
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|