Integrasi Menu Laporan Operator
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user