From 06bff0b9b84d47c43f9bc8aff06a29d85ebb7ed0 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 14 Nov 2023 14:47:55 +0100 Subject: Add function param/return types, fix a lot more phpstorm complaints --- modules-available/statistics_reporting/page.inc.php | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'modules-available/statistics_reporting/page.inc.php') diff --git a/modules-available/statistics_reporting/page.inc.php b/modules-available/statistics_reporting/page.inc.php index 36081763..ec4bbf1a 100644 --- a/modules-available/statistics_reporting/page.inc.php +++ b/modules-available/statistics_reporting/page.inc.php @@ -125,14 +125,14 @@ class Page_Statistics_Reporting extends Page foreach ($this->COLUMNS as $column) { $data['columns'][] = array( 'id' => 'col_' . $column, - 'name' => Dictionary::translateFile('template-tags', 'lang_' . $column, true), + 'name' => Dictionary::translateFile('template-tags', 'lang_' . $column), 'checked' => ($forceOn || Request::get('col_' . $column, 'off', 'string') !== 'off') ? 'checked' : '', ); } foreach ($this->TABLES as $table) { $data['tables'][] = array( - 'name' => Dictionary::translate('table_' . $table, true), + 'name' => Dictionary::translate('table_' . $table), 'value' => $table, 'allowed' => User::hasPermission("table.view.$table"), 'selected' => ($this->type === $table) ? 'selected' : '', @@ -185,12 +185,10 @@ class Page_Statistics_Reporting extends Page } Header('Content-Type: application/json; charset=utf-8'); die(json_encode($data)); - } else { - die('No permission.'); } - } else { - echo 'Invalid action.'; + die('No permission.'); } + echo 'Invalid action.'; } private function doExport() @@ -257,7 +255,6 @@ class Page_Statistics_Reporting extends Page } fclose($fh); exit(); - break; case 'xml': $xml_data = new SimpleXMLElement(''); $this->array_to_xml($res, $xml_data, 'row'); @@ -273,9 +270,9 @@ class Page_Statistics_Reporting extends Page /** * @param $data array Data to encode - * @param $xml_data \SimpleXMLElement XML Object to append to + * @param $xml_data SimpleXMLElement XML Object to append to */ - private function array_to_xml($data, $xml_data, $parentName = 'row') + private function array_to_xml(array $data, SimpleXMLElement $xml_data, string $parentName = 'row'): void { foreach ($data as $key => $value) { if (is_numeric($key)) { @@ -290,7 +287,7 @@ class Page_Statistics_Reporting extends Page } } - private function fetchData($flags) + private function fetchData(int $flags) { // TODO: Make all modes location-aware, filter while querying, not after switch ($this->type) { @@ -316,7 +313,7 @@ class Page_Statistics_Reporting extends Page // correct indexing of array after deletions return array_values($data); case 'client': - $data = GetData::perClient($flags, Request::any('new', false, 'string')); + $data = GetData::perClient($flags); // only show clients from locations which you have permission for $filterLocs = User::getAllowedLocations("table.view.client"); foreach ($data as $key => $row) { -- cgit v1.2.3-55-g7522