TenantAtlas/app/Support/Diff/DiffPresentation.php
2026-03-14 13:31:24 +01:00

33 lines
735 B
PHP

<?php
declare(strict_types=1);
namespace App\Support\Diff;
use InvalidArgumentException;
final readonly class DiffPresentation
{
/**
* @param array<int, DiffRow> $rows
*/
public function __construct(
public DiffSummary $summary,
public array $rows,
) {
foreach ($this->rows as $row) {
if (! $row instanceof DiffRow) {
throw new InvalidArgumentException('DiffPresentation rows must contain only DiffRow instances.');
}
}
}
public static function empty(?string $message = 'No diff data available.'): self
{
return new self(
summary: DiffSummary::empty($message),
rows: [],
);
}
}