Files
siakad/app/Support/Legacy/Reports/ReportResult.php
T
2026-11-06 14:51:38 +07:00

32 lines
1000 B
PHP

<?php
namespace App\Support\Legacy\Reports;
/** Hasil satu laporan: kolom, baris (nilai skalar), keterangan di atas tabel, dan jumlah baris sebenarnya. */
final readonly class ReportResult
{
/**
* @param list<array{key: string, label: string, num?: bool}> $columns
* @param list<array<string, scalar|null>> $rows kunci = 'key' kolom
* @param int|null $total jumlah baris sebenarnya (bila lebih banyak dari $rows)
* @param list<string> $summary baris keterangan (mis. "Periode: 2020/2021 Ganjil", "Jumlah: 120 mahasiswa")
*/
public function __construct(
public array $columns,
public array $rows,
public ?int $total = null,
public array $summary = [],
public ?string $note = null,
) {}
public function count(): int
{
return $this->total ?? count($this->rows);
}
public function truncated(): bool
{
return $this->total !== null && $this->total > count($this->rows);
}
}