1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-13 05:25:56 +00:00

initial (wip) for new prefs

This commit is contained in:
Andrew Dolgov
2021-02-25 09:33:36 +03:00
parent 922a699215
commit 988eb3ac91
4 changed files with 14 additions and 8 deletions

View File

@@ -124,12 +124,12 @@ class Config {
list ($defval, $deftype) = $this::_DEFAULTS[$const];
$this->params[$cvalue] = [ $this->cast_to(!empty($override) ? $override : $defval, $deftype), $deftype ];
$this->params[$cvalue] = [ self::cast_to(!empty($override) ? $override : $defval, $deftype), $deftype ];
}
}
}
private function cast_to(string $value, int $type_hint) {
static function cast_to(string $value, int $type_hint) {
switch ($type_hint) {
case self::T_BOOL:
return sql_bool_to_bool($value);
@@ -149,7 +149,7 @@ class Config {
private function _add(string $param, string $default, int $type_hint) {
$override = getenv($this::_ENVVAR_PREFIX . $param);
$this->params[$param] = [ $this->cast_to(!empty($override) ? $override : $default, $type_hint), $type_hint ];
$this->params[$param] = [ self::cast_to(!empty($override) ? $override : $default, $type_hint), $type_hint ];
}
static function add(string $param, string $default, int $type_hint = Config::T_STRING) {