allow setting a default value (#6908)

This commit is contained in:
frytimo
2024-03-01 13:26:51 -04:00
committed by GitHub
parent 0626fc1c9a
commit ebe12ef338
+2 -2
View File
@@ -66,7 +66,7 @@ class settings {
* @param text category * @param text category
* @param text subcategory * @param text subcategory
*/ */
public function get($category = null, $subcategory = null) { public function get(string $category = null, string $subcategory = null, mixed $default_value = null): mixed {
if (empty($category)) { if (empty($category)) {
return $this->settings; return $this->settings;
@@ -75,7 +75,7 @@ class settings {
return $this->settings[$category]; return $this->settings[$category];
} }
else { else {
return $this->settings[$category][$subcategory]; return $this->settings[$category][$subcategory] ?? $default_value;
} }
} }