feat: add administration reporting and correction services
This commit is contained in:
@@ -7,6 +7,12 @@ final class PrintReportRenderer
|
||||
/** @param list<string> $headers @param list<list<mixed>> $rows */
|
||||
public function render(string $title, array $headers, array $rows): string
|
||||
{
|
||||
$headerCount = count($headers);
|
||||
foreach ($rows as $number => $row) {
|
||||
if (!is_array($row) || count($row) !== $headerCount) {
|
||||
throw new InvalidArgumentException(sprintf('Print report row %d must contain %d fields.', $number + 1, $headerCount));
|
||||
}
|
||||
}
|
||||
$head = implode('', array_map(fn(mixed $value): string => '<th>' . $this->escape($value) . '</th>', $headers));
|
||||
$body = '';
|
||||
foreach ($rows as $row) {
|
||||
|
||||
Reference in New Issue
Block a user