summaryrefslogtreecommitdiffstats
path: root/modules-available/locationinfo/api.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'modules-available/locationinfo/api.inc.php')
-rw-r--r--modules-available/locationinfo/api.inc.php14
1 files changed, 7 insertions, 7 deletions
diff --git a/modules-available/locationinfo/api.inc.php b/modules-available/locationinfo/api.inc.php
index 14be7718..24919ba1 100644
--- a/modules-available/locationinfo/api.inc.php
+++ b/modules-available/locationinfo/api.inc.php
@@ -14,7 +14,7 @@ function HandleParameters()
$get = Request::get('get', 0, 'string');
$uuid = Request::get('uuid', false, 'string');
- $output = false;
+ $output = null;
if ($get === "timestamp") {
$output = array('ts' => getLastChangeTs($uuid));
} elseif ($get === "machines") {
@@ -24,7 +24,7 @@ function HandleParameters()
$output = array_values($output);
} elseif ($get === "config") {
$type = InfoPanel::getConfig($uuid, $output);
- if ($type === false) {
+ if ($type === null) {
http_response_code(404);
die('Panel not found');
}
@@ -38,7 +38,7 @@ function HandleParameters()
$locationIds = LocationInfo::getLocationsOr404($uuid);
$output = LocationInfo::getCalendar($locationIds);
}
- if ($output !== false) {
+ if ($output !== null) {
Header('Content-Type: application/json; charset=utf-8');
echo json_encode($output);
} else {
@@ -59,7 +59,7 @@ function HandleParameters()
* @param string $paneluuid panels uuid
* @return int UNIX_TIMESTAMP
*/
-function getLastChangeTs($paneluuid)
+function getLastChangeTs(string $paneluuid): int
{
$panel = Database::queryFirst('SELECT lastchange, locationids FROM locationinfo_panel WHERE paneluuid = :paneluuid',
compact('paneluuid'));
@@ -84,7 +84,7 @@ function getLastChangeTs($paneluuid)
* @param int[] $idList list of the location ids.
* @return array aggregated PC states
*/
-function getPcStates($idList, $paneluuid)
+function getPcStates(array $idList, string $paneluuid): array
{
$pcStates = array();
foreach ($idList as $id) {
@@ -130,7 +130,7 @@ function getPcStates($idList, $paneluuid)
* @param int[] $idList Array list of the locations.
* @return array location tree data
*/
-function getLocationTree($idList)
+function getLocationTree(array $idList): array
{
if (in_array(0, $idList)) {
return array_values(Location::getTree());
@@ -140,7 +140,7 @@ function getLocationTree($idList)
return findLocations($locations, $idList);
}
-function findLocations($locations, $idList)
+function findLocations(array $locations, array $idList): array
{
$ret = array();
foreach ($locations as $location) {