StatisticsService
in package
Service layer for survey statistics.
Acts as the entry point for generating statistics across all configured graph processors (e.g., question-level statistics).
Table of Contents
Properties
- $charts : array<string|int, mixed>
- $filters : StatisticsResponseFilters
- $language : string
- $output : array<string|int, mixed>
- $surveyId : int|string
Methods
- __construct() : mixed
- run() : array<string|int, mixed>
- Execute statistics generation for all configured graphs.
- setChart() : $this
- Register a chart type processor by class name.
- setFilters() : void
- Set response filters to apply to all chart processors.
- setSurvey() : $this
- Set survey context (ID + language).
- handleChartOutput() : void
Properties
$charts
private
array<string|int, mixed>
$charts
List of charts classes to run
$filters
private
StatisticsResponseFilters
$filters
$language
private
string
$language
Active survey language
$output
private
array<string|int, mixed>
$output
= []
Gathered chart results
$surveyId
private
int|string
$surveyId
Current survey ID
Methods
__construct()
public
__construct() : mixed
run()
Execute statistics generation for all configured graphs.
public
run([array<string|int, mixed> $specificCharts = [] ]) : array<string|int, mixed>
Parameters
- $specificCharts : array<string|int, mixed> = []
-
List of specific chart classes to run
Tags
Return values
array<string|int, mixed> —Combined output from all graph processors
setChart()
Register a chart type processor by class name.
public
setChart(string $chart) : $this
Parameters
- $chart : string
Return values
$thissetFilters()
Set response filters to apply to all chart processors.
public
setFilters(StatisticsResponseFilters $filters) : void
Parameters
- $filters : StatisticsResponseFilters
setSurvey()
Set survey context (ID + language).
public
setSurvey(int|string $surveyId[, string|null $language = null ]) : $this
Parameters
- $surveyId : int|string
-
Survey ID
- $language : string|null = null
-
Language code (default = null)
Tags
Return values
$thishandleChartOutput()
private
handleChartOutput(array<string|int, mixed> $data) : void
Parameters
- $data : array<string|int, mixed>