aboutsummaryrefslogtreecommitdiff
path: root/src/bdrem/Config.php
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2014-01-14 17:46:51 +0100
committerChristian Weiske <cweiske@cweiske.de>2014-01-14 17:46:51 +0100
commit441c72bbf3d29be5c7f5eb0fd43ac267fe059c2f (patch)
treeadaf976068ed80a424f5acf64a754a52ce21c4e7 /src/bdrem/Config.php
downloadbdrem-441c72bbf3d29be5c7f5eb0fd43ac267fe059c2f.tar.gz
bdrem-441c72bbf3d29be5c7f5eb0fd43ac267fe059c2f.zip
first version that reads birthday reminder files
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);
+ }
+}
+?>