diff options
author | Simon Rettberg | 2023-11-14 14:47:55 +0100 |
---|---|---|
committer | Simon Rettberg | 2023-11-14 14:47:55 +0100 |
commit | 06bff0b9b84d47c43f9bc8aff06a29d85ebb7ed0 (patch) | |
tree | 7e5493b102074672d8cfd8fe1a61e49f080edbe8 /modules-available/statistics_reporting/inc/getdata.inc.php | |
parent | Update phpstorm config (diff) | |
download | slx-admin-06bff0b9b84d47c43f9bc8aff06a29d85ebb7ed0.tar.gz slx-admin-06bff0b9b84d47c43f9bc8aff06a29d85ebb7ed0.tar.xz slx-admin-06bff0b9b84d47c43f9bc8aff06a29d85ebb7ed0.zip |
Add function param/return types, fix a lot more phpstorm complaints
Diffstat (limited to 'modules-available/statistics_reporting/inc/getdata.inc.php')
-rw-r--r-- | modules-available/statistics_reporting/inc/getdata.inc.php | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/modules-available/statistics_reporting/inc/getdata.inc.php b/modules-available/statistics_reporting/inc/getdata.inc.php index 90af0c58..75db119d 100644 --- a/modules-available/statistics_reporting/inc/getdata.inc.php +++ b/modules-available/statistics_reporting/inc/getdata.inc.php @@ -24,7 +24,7 @@ class GetData return $carry . sprintf("%04d", $item); }) . sprintf("%04d", $entry['locationid']); } else { - $entry['locationname'] = Dictionary::translate('notAssigned', true); + $entry['locationname'] = Dictionary::translate('notAssigned'); } if ($anonymize) { unset($entry['locationid']); @@ -56,7 +56,8 @@ class GetData } // total - public static function total($flags = 0) { + public static function total(int $flags = 0): array + { $printable = 0 !== ($flags & GETDATA_PRINTABLE); // total time online, average time online, total number of logins $data = Queries::getOverallStatistics(self::$from, self::$to, self::$lowerTimeBound, self::$upperTimeBound); @@ -70,7 +71,8 @@ class GetData } // per location - public static function perLocation($flags = 0) { + public static function perLocation(int $flags = 0): array + { $anonymize = 0 !== ($flags & GETDATA_ANONYMOUS); $printable = 0 !== ($flags & GETDATA_PRINTABLE); $data = Queries::getLocationStatistics(self::$from, self::$to, self::$lowerTimeBound, self::$upperTimeBound); @@ -85,7 +87,8 @@ class GetData } // per client - public static function perClient($flags = 0, $new = false) { + public static function perClient(int $flags = 0): array + { $anonymize = 0 !== ($flags & GETDATA_ANONYMOUS); $printable = 0 !== ($flags & GETDATA_PRINTABLE); $data = Queries::getClientStatistics(self::$from, self::$to, self::$lowerTimeBound, self::$upperTimeBound); @@ -101,7 +104,8 @@ class GetData } // per user - public static function perUser($flags = 0) { + public static function perUser(int $flags = 0): array + { $anonymize = 0 !== ($flags & GETDATA_ANONYMOUS); $res = Queries::getUserStatistics(self::$from, self::$to, self::$lowerTimeBound, self::$upperTimeBound); $data = array(); @@ -116,7 +120,8 @@ class GetData // per vm - public static function perVM($flags = 0) { + public static function perVM(int $flags = 0): array + { $anonymize = 0 !== ($flags & GETDATA_ANONYMOUS); $res = Queries::getVMStatistics(self::$from, self::$to, self::$lowerTimeBound, self::$upperTimeBound); $data = array(); @@ -130,7 +135,7 @@ class GetData return $data; } - private static function nullToZero(&$row) + private static function nullToZero(array &$row): void { foreach ($row as &$field) { if (is_null($field)) { @@ -140,7 +145,7 @@ class GetData } // Format $seconds into ".d .h .m .s" format (day, hour, minute, second) - private static function formatSeconds($seconds) + private static function formatSeconds(int $seconds): string { return sprintf('%dd, %02d:%02d:%02d', $seconds / (3600*24), ($seconds % (3600*24)) / 3600, ($seconds%3600) / 60, $seconds%60); } |