From 66bdcf04f431d615b5fac93e7677e7304888e90c Mon Sep 17 00:00:00 2001 From: winter Date: Sat, 18 Jan 2025 20:02:39 +0000 Subject: implement settings editor page --- Digitigrade/GlobalSettings.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'Digitigrade/GlobalSettings.php') diff --git a/Digitigrade/GlobalSettings.php b/Digitigrade/GlobalSettings.php index 435c85a..52c6582 100644 --- a/Digitigrade/GlobalSettings.php +++ b/Digitigrade/GlobalSettings.php @@ -25,6 +25,19 @@ class GlobalSettings extends Singleton { return $stmt->fetchColumn(0) ?: null; } + /** + * Gets a boolean setting's value. + * @param string $key which setting to get + * @return ?bool the value, or null if not set + */ + public function getBool(string $key): ?bool { + return match ($this->get($key)) { + '', 'false' => false, + '1', 'true' => true, + default => null + }; + } + /** * Sets the value of a setting. * @param string $key which setting to modify -- cgit v1.3