34 lines
792 B
PHP
34 lines
792 B
PHP
<?php
|
|
|
|
namespace App\Services\Analytics;
|
|
|
|
/**
|
|
* Колонка результата отчёта (для таблицы и графика).
|
|
*/
|
|
readonly class Column
|
|
{
|
|
/**
|
|
* @param 'dimension'|'measure'|'period' $kind
|
|
* @param 'string'|'date'|'number'|'money'|'percent' $type
|
|
*/
|
|
public function __construct(
|
|
public string $key,
|
|
public string $label,
|
|
public string $kind,
|
|
public string $type,
|
|
public ?string $unit = null,
|
|
) {}
|
|
|
|
/** @return array<string,mixed> */
|
|
public function toArray(): array
|
|
{
|
|
return [
|
|
'key' => $this->key,
|
|
'label' => $this->label,
|
|
'kind' => $this->kind,
|
|
'type' => $this->type,
|
|
'unit' => $this->unit,
|
|
];
|
|
}
|
|
}
|