diff options
Diffstat (limited to 'modules-available/runmode/inc/runmode.inc.php')
-rw-r--r-- | modules-available/runmode/inc/runmode.inc.php | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/modules-available/runmode/inc/runmode.inc.php b/modules-available/runmode/inc/runmode.inc.php index ccc432d2..65b444e7 100644 --- a/modules-available/runmode/inc/runmode.inc.php +++ b/modules-available/runmode/inc/runmode.inc.php @@ -297,7 +297,7 @@ class RunModeModuleConfig */ public $permission = false; - public function __construct($file) + public function __construct(string $file) { $data = json_decode(file_get_contents($file), true); if (!is_array($data)) @@ -313,19 +313,16 @@ class RunModeModuleConfig $this->loadType($data, 'permission', 'string'); } - private function loadType($data, $key, $type) + private function loadType(array $data, string $key, string $type): void { if (!isset($data[$key])) - return false; + return; if (is_string($type) && gettype($data[$key]) !== $type) - return false; - if (is_array($type) && !in_array(gettype($data[$key]), $type)) - return false; + return; $this->{$key} = $data[$key]; - return true; } - public function userHasPermission($locationId) + public function userHasPermission(?int $locationId): bool { return $this->permission === false || User::hasPermission($this->permission, $locationId); } |