StatisticsOverview
in package
implements
CommandInterface
Uses
AuthPermissionTrait
API Command to retrieve statistical overview of a survey.
Table of Contents
Interfaces
Properties
- $permission : Permission
- $responseFactory : ResponseFactory
- $responseFilterPatcher : FilterPatcher
- $statisticsService : StatisticsService
- $survey : Survey
- $transformerOutputSurveyResponses : TransformerOutputSurveyResponses
- $language : string
- $permissionModel : Permission|null
- $surveyId : int
Methods
- __construct() : mixed
- run() : Response
- Execute the statistics overview command Retrieves and combines: - Survey statistics - Daily activity data - Latest responses
- setPermissionModel() : void
- getPermissionModel() : Permission
- hasGlobalPermission() : Response
- hasSurveyPermission() : Response
- getLatestResponses() : array<string|int, mixed>
- Retrieve the latest survey responses
- getStatisticsOverviewData() : array<string|int, mixed>
- Retrieve statistics overview and daily activity data
Properties
$permission
protected
Permission
$permission
$responseFactory
protected
ResponseFactory
$responseFactory
$responseFilterPatcher
protected
FilterPatcher
$responseFilterPatcher
$statisticsService
protected
StatisticsService
$statisticsService
$survey
protected
Survey
$survey
$transformerOutputSurveyResponses
protected
TransformerOutputSurveyResponses
$transformerOutputSurveyResponses
$language
private
string
$language
= 'en'
Survey language code
$permissionModel
private
Permission|null
$permissionModel
= null
$surveyId
private
int
$surveyId
= 0
Survey ID being processed
Methods
__construct()
public
__construct(Permission $permission, Survey $survey, ResponseFactory $responseFactory, StatisticsService $statisticsService, FilterPatcher $responseFilterPatcher, TransformerOutputSurveyResponses $transformerOutputSurveyResponses) : mixed
Parameters
- $permission : Permission
- $survey : Survey
- $responseFactory : ResponseFactory
- $statisticsService : StatisticsService
- $responseFilterPatcher : FilterPatcher
- $transformerOutputSurveyResponses : TransformerOutputSurveyResponses
run()
Execute the statistics overview command Retrieves and combines: - Survey statistics - Daily activity data - Latest responses
public
run(Request $request) : Response
Parameters
- $request : Request
-
API request containing survey ID and language
Return values
Response —Success response with overview data or error response
setPermissionModel()
public
setPermissionModel(Permission $permissionModel) : void
Parameters
- $permissionModel : Permission
getPermissionModel()
protected
getPermissionModel() : Permission
Return values
PermissionhasGlobalPermission()
protected
hasGlobalPermission(string $sPermission, string $sCRUD[, int|null $iUserID = null ]) : Response
Parameters
- $sPermission : string
- $sCRUD : string
- $iUserID : int|null = null
Return values
Response —| boolean
hasSurveyPermission()
protected
hasSurveyPermission(int $iSurveyID, string $sPermission, string $sCRUD[, string|null $iUserID = null ]) : Response
Parameters
- $iSurveyID : int
- $sPermission : string
- $sCRUD : string
- $iUserID : string|null = null
Return values
Response —| boolean
getLatestResponses()
Retrieve the latest survey responses
private
getLatestResponses(Request $request[, int $size = 10 ]) : array<string|int, mixed>
Configures and executes a paginated query to get the most recent survey responses, sorted by ID in descending order.
Parameters
- $request : Request
- $size : int = 10
Tags
Return values
array<string|int, mixed> —Transformed array of latest survey responses
getStatisticsOverviewData()
Retrieve statistics overview and daily activity data
private
getStatisticsOverviewData() : array<string|int, mixed>
Return values
array<string|int, mixed> —Array containing daily activity and overview data