aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/AllConfig.php
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2019-02-06 17:07:20 +0100
committerJoas Schilling <coding@schilljs.com>2019-02-22 08:25:41 +0100
commita11ef5134cb4200399e74811bbf9d1100923efcd (patch)
tree413ab27f1f4afe390377a858d01e2e9b189731f9 /lib/private/AllConfig.php
parente7f0e8ba03363f37631ded3099d4e2bf0df5d5f6 (diff)
downloadnextcloud-server-a11ef5134cb4200399e74811bbf9d1100923efcd.tar.gz
nextcloud-server-a11ef5134cb4200399e74811bbf9d1100923efcd.zip
Add methods to get casted system values
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private/AllConfig.php')
-rw-r--r--lib/private/AllConfig.php36
1 files changed, 36 insertions, 0 deletions
diff --git a/lib/private/AllConfig.php b/lib/private/AllConfig.php
index 09520aae2a9..05ac1bad64b 100644
--- a/lib/private/AllConfig.php
+++ b/lib/private/AllConfig.php
@@ -126,6 +126,42 @@ class AllConfig implements \OCP\IConfig {
}
/**
+ * Looks up a boolean system wide defined value
+ *
+ * @param string $key the key of the value, under which it was saved
+ * @param mixed $default the default value to be returned if the value isn't set
+ * @return mixed the value or $default
+ * @since 16.0.0
+ */
+ public function getSystemValueBool(string $key, bool $default = false): bool {
+ return (bool) $this->getSystemValue($key, $default);
+ }
+
+ /**
+ * Looks up an integer system wide defined value
+ *
+ * @param string $key the key of the value, under which it was saved
+ * @param mixed $default the default value to be returned if the value isn't set
+ * @return mixed the value or $default
+ * @since 16.0.0
+ */
+ public function getSystemValueInt(string $key, int $default = 0): int {
+ return (int) $this->getSystemValue($key, $default);
+ }
+
+ /**
+ * Looks up a string system wide defined value
+ *
+ * @param string $key the key of the value, under which it was saved
+ * @param mixed $default the default value to be returned if the value isn't set
+ * @return mixed the value or $default
+ * @since 16.0.0
+ */
+ public function getSystemValueString(string $key, string $default = ''): string {
+ return (string) $this->getSystemValue($key, $default);
+ }
+
+ /**
* Looks up a system wide defined value and filters out sensitive data
*
* @param string $key the key of the value, under which it was saved