X-Git-Url: https://git.cweiske.de/bdrem.git/blobdiff_plain/e86787a8eb6a31fbe95f1a3854d66e25e5e63c67..ef83af1b350cd1d1c8bf28077977763bdae93cf2:/src/bdrem/Config.php diff --git a/src/bdrem/Config.php b/src/bdrem/Config.php index 5d34f76..7a0fd68 100644 --- a/src/bdrem/Config.php +++ b/src/bdrem/Config.php @@ -4,6 +4,7 @@ namespace bdrem; class Config { public $source; + public $date; public $daysBefore; public $daysAfter; public $locale; @@ -21,11 +22,9 @@ class Config protected function loadFile($filename) { include $filename; - $this->source = $source; - $this->daysBefore = $daysBefore; - $this->daysAfter = $daysAfter; - if (isset($locale)) { - $this->locale = $locale; + $vars = get_defined_vars(); + foreach ($vars as $k => $value) { + $this->$k = $value; } } @@ -40,5 +39,13 @@ class Config return new $class($settings[0]); } + + public function get($varname, $default = '') + { + if (!isset($this->$varname) || $this->$varname == '') { + return $default; + } + return $this->$varname; + } } ?>