aboutsummaryrefslogtreecommitdiff
path: root/src/bdrem/Config.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/bdrem/Config.php')
-rw-r--r--src/bdrem/Config.php43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/bdrem/Config.php b/src/bdrem/Config.php
new file mode 100644
index 0000000..076cd04
--- /dev/null
+++ b/src/bdrem/Config.php
@@ -0,0 +1,43 @@
+<?php
+namespace bdrem;
+
+class Config
+{
+ public $source;
+ public $daysBefore;
+ public $daysAfter;
+
+ public function load()
+ {
+ $f = __DIR__ . '/../../data/bdrem.config.php';
+ if (file_exists($f)) {
+ return $this->loadFile($f);
+ }
+
+ throw new \Exception('No config file found');
+ }
+
+ protected function loadFile($filename)
+ {
+ include $filename;
+ $this->source = $source;
+ $this->daysBefore = $daysBefore;
+ $this->daysAfter = $daysAfter;
+ }
+
+ public function loadSource()
+ {
+ if ($this->source === null) {
+ throw new \Exception('No source defined');
+ }
+
+ $settings = $this->source;
+ $class = '\\bdrem\\Source_' . array_shift($settings);
+
+ return new $class($settings[0]);
+ //$rm = new \ReflectionMethod($class, '__construct');
+ //return $rm->invokeArgs(null, $settings);
+ //return call_user_func_array($class . '::__construct', $settings);
+ }
+}
+?>