aboutsummaryrefslogtreecommitdiffhomepage
path: root/Digitigrade/GlobalSettings.php
diff options
context:
space:
mode:
Diffstat (limited to 'Digitigrade/GlobalSettings.php')
-rw-r--r--Digitigrade/GlobalSettings.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/Digitigrade/GlobalSettings.php b/Digitigrade/GlobalSettings.php
index 435c85a..52c6582 100644
--- a/Digitigrade/GlobalSettings.php
+++ b/Digitigrade/GlobalSettings.php
@@ -26,6 +26,19 @@ class GlobalSettings extends Singleton {
}
/**
+ * 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
* @param string $value the new value