blob: 076cd043fab05b85efba646d437024500786ab79 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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);
}
}
?>
|