Добавил базовые датасеты и агрегации для конструктора отчетов

This commit is contained in:
brusnitsyn
2026-06-22 17:00:58 +09:00
parent 71bd4b9d1a
commit 5bad7599cf
16 changed files with 1453 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
<?php
namespace App\Services\Analytics;
/**
* Результат построения отчёта: описания колонок, строки и итоги.
*/
readonly class AnalyticsResult
{
/**
* @param Column[] $columns
* @param array<int,array<string,mixed>> $rows
* @param array<string,mixed> $totals
*/
public function __construct(
public array $columns,
public array $rows,
public array $totals = [],
) {}
/** @return array<string,mixed> */
public function toArray(): array
{
return [
'columns' => array_map(fn (Column $c) => $c->toArray(), $this->columns),
'rows' => $this->rows,
'totals' => $this->totals,
];
}
}