diff options
| author | winter | 2025-01-18 20:02:39 +0000 |
|---|---|---|
| committer | winter | 2025-01-18 20:02:39 +0000 |
| commit | 66bdcf04f431d615b5fac93e7677e7304888e90c (patch) | |
| tree | d75f1b299e8ed2ff8d2fd6ccd42185cfb06b6729 /Digitigrade/GlobalSettings.php | |
| parent | 00ab9734e880219fa68fed98cefda5ce12958e4b (diff) | |
implement settings editor page
Diffstat (limited to 'Digitigrade/GlobalSettings.php')
| -rw-r--r-- | Digitigrade/GlobalSettings.php | 13 |
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 |
