StatsRepository
in package
implements
IStatsRepository
Interfaces, Classes, Traits and Enums
Table of Contents
- $avgTimeFileds : string
- $between : string
- $buildings : string
- $db : IDatabase
- $params : array<string|int, mixed>
- $requests : string
- $reservations : string
- $rooms : string
- $stats : Stats
- $users : string
- __construct() : mixed
- getAllBuildingsStats() : Stats
- Statistics for all Buildings
- getAllRoomsStats() : Stats
- Statistics for all Rooms
- getAllUsersStats() : Stats
- Statistics for all Users
- getBuildingStats() : Stats
- Statistics for specific Building
- getRequestsStats() : Stats
- Statistics of successfull requests on each endpoint of the API
- getRoomStats() : Stats
- Statistics fot specific Room
- getUserStats() : Stats
- Statistics for specific User
- setTimeSpan() : IStatsRepository
- Sets Time span of statistics
- execute() : array<string|int, mixed>
- executes the SQL request
- fillDaysOfMonth() : array<string|int, mixed>
- fills data for data per day of month
- fillDaysOfWeek() : array<string|int, mixed>
- fills data for data per day of week
- setBetween() : void
- sets sql query params to search reservation between dates
Properties
$avgTimeFileds
private
string
$avgTimeFileds
= "\n ROUND(AVG(TIME_TO_SEC(TIMEDIFF(res.planned_end, res.planned_start)))/60) as 'avg_planned_time_minutes',\n ROUND(AVG(TIME_TO_SEC(TIMEDIFF(res.actual_end, res.actual_start)))/60) as 'avg_actual_time_minutes',\n SUM(ROUND(TIME_TO_SEC(TIMEDIFF(res.actual_end, res.actual_start))/60)) as 'all_time_minutes'\n "
$between
private
string
$between
$buildings
private
string
$buildings
= '`building`'
$db
private
IDatabase
$db
$params
private
array<string|int, mixed>
$params
$requests
private
string
$requests
= '`request`'
$reservations
private
string
$reservations
= '`reservation`'
$rooms
private
string
$rooms
= '`room`'
$stats
private
Stats
$stats
$users
private
string
$users
= '`user`'
Methods
__construct()
public
__construct(IDatabase $db) : mixed
Parameters
- $db : IDatabase
Return values
mixed —getAllBuildingsStats()
Statistics for all Buildings
public
getAllBuildingsStats(int $addressId) : Stats
Parameters
- $addressId : int
Return values
Stats —getAllRoomsStats()
Statistics for all Rooms
public
getAllRoomsStats() : Stats
Return values
Stats —getAllUsersStats()
Statistics for all Users
public
getAllUsersStats() : Stats
Return values
Stats —getBuildingStats()
Statistics for specific Building
public
getBuildingStats(int $id) : Stats
Parameters
- $id : int
Return values
Stats —getRequestsStats()
Statistics of successfull requests on each endpoint of the API
public
getRequestsStats() : Stats
Return values
Stats —getRoomStats()
Statistics fot specific Room
public
getRoomStats(int $id) : Stats
Parameters
- $id : int
Return values
Stats —getUserStats()
Statistics for specific User
public
getUserStats(int $id) : Stats
Parameters
- $id : int
Return values
Stats —setTimeSpan()
Sets Time span of statistics
public
setTimeSpan([string|null $from = NULL ][, string $to = 'now' ]) : IStatsRepository
Parameters
- $from : string|null = NULL
- $to : string = 'now'
Return values
IStatsRepository —execute()
executes the SQL request
private
execute([string $sql = '' ]) : array<string|int, mixed>
Parameters
- $sql : string = ''
Return values
array<string|int, mixed> —fillDaysOfMonth()
fills data for data per day of month
private
fillDaysOfMonth(array<string|int, mixed> $data) : array<string|int, mixed>
Parameters
- $data : array<string|int, mixed>
Return values
array<string|int, mixed> —fillDaysOfWeek()
fills data for data per day of week
private
fillDaysOfWeek(array<string|int, mixed> $data) : array<string|int, mixed>
Parameters
- $data : array<string|int, mixed>
Return values
array<string|int, mixed> —setBetween()
sets sql query params to search reservation between dates
private
setBetween(JsonDateTime $from, JsonDateTime $to) : void
Parameters
- $from : JsonDateTime
- $to : JsonDateTime