Some checks failed
Main Confidence / confidence (push) Failing after 50s
## Summary - add a config-seeded canonical control catalog plus shared resolution primitives and Microsoft subject bindings - propagate canonical control references into findings-derived evidence snapshots and tenant review composition - add the feature spec artifacts and focused Pest coverage, plus the supporting workspace and Sail helper adjustments included in this branch ## Testing - cd apps/platform && ./vendor/bin/sail artisan test --compact tests/Unit/Governance/CanonicalControlCatalogTest.php tests/Unit/Governance/CanonicalControlResolverTest.php tests/Feature/Governance/CanonicalControlResolutionIntegrationTest.php tests/Feature/Evidence/EvidenceSnapshotCanonicalControlReferenceTest.php tests/Feature/TenantReview/TenantReviewCanonicalControlReferenceTest.php tests/Feature/PlatformRelocation/CommandModelSmokeTest.php - cd apps/platform && ./vendor/bin/sail bin pint --dirty --format agent Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #272
67 lines
1.8 KiB
PHP
67 lines
1.8 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Support\Governance\Controls;
|
|
|
|
use InvalidArgumentException;
|
|
|
|
final readonly class ArtifactSuitability
|
|
{
|
|
public function __construct(
|
|
public bool $baseline,
|
|
public bool $drift,
|
|
public bool $finding,
|
|
public bool $exception,
|
|
public bool $evidence,
|
|
public bool $review,
|
|
public bool $report,
|
|
) {}
|
|
|
|
/**
|
|
* @param array<string, mixed> $data
|
|
*/
|
|
public static function fromArray(array $data): self
|
|
{
|
|
foreach (self::requiredKeys() as $key) {
|
|
if (! array_key_exists($key, $data)) {
|
|
throw new InvalidArgumentException(sprintf('Canonical control artifact suitability is missing [%s].', $key));
|
|
}
|
|
}
|
|
|
|
return new self(
|
|
baseline: (bool) $data['baseline'],
|
|
drift: (bool) $data['drift'],
|
|
finding: (bool) $data['finding'],
|
|
exception: (bool) $data['exception'],
|
|
evidence: (bool) $data['evidence'],
|
|
review: (bool) $data['review'],
|
|
report: (bool) $data['report'],
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @return array{baseline: bool, drift: bool, finding: bool, exception: bool, evidence: bool, review: bool, report: bool}
|
|
*/
|
|
public function toArray(): array
|
|
{
|
|
return [
|
|
'baseline' => $this->baseline,
|
|
'drift' => $this->drift,
|
|
'finding' => $this->finding,
|
|
'exception' => $this->exception,
|
|
'evidence' => $this->evidence,
|
|
'review' => $this->review,
|
|
'report' => $this->report,
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @return list<string>
|
|
*/
|
|
public static function requiredKeys(): array
|
|
{
|
|
return ['baseline', 'drift', 'finding', 'exception', 'evidence', 'review', 'report'];
|
|
}
|
|
}
|