TenantAtlas/app/Services/Baselines/SnapshotRendering/RenderedAttribute.php
ahmido 3c445709af feat: add structured baseline snapshot rendering (#158)
## Summary
- replace the baseline snapshot detail page with a structured summary-first rendering flow
- add a presenter plus renderer registry with RBAC, compliance, and fallback renderers
- add grouped policy-type browsing, fidelity and gap badges, and workspace authorization coverage
- add Feature 130 spec, plan, contract, research, quickstart, and completed task artifacts

## Testing
- focused Pest coverage was added for structured rendering, fallback behavior, degraded states, authorization, presenter logic, renderer resolution, and badge mapping
- I did not rerun the full validation suite in this final PR step

## Notes
- base branch: `dev`
- feature branch: `130-structured-snapshot-rendering`

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #158
2026-03-10 08:28:06 +00:00

37 lines
951 B
PHP

<?php
declare(strict_types=1);
namespace App\Services\Baselines\SnapshotRendering;
use InvalidArgumentException;
final readonly class RenderedAttribute
{
public function __construct(
public string $label,
public string $value,
public string $priority = 'primary',
) {
if (trim($this->label) === '') {
throw new InvalidArgumentException('RenderedAttribute label must be a non-empty string.');
}
if (! in_array($this->priority, ['primary', 'secondary'], true)) {
throw new InvalidArgumentException('RenderedAttribute priority must be either "primary" or "secondary".');
}
}
/**
* @return array{label: string, value: string, priority: string}
*/
public function toArray(): array
{
return [
'label' => $this->label,
'value' => $this->value,
'priority' => $this->priority,
];
}
}