git.cweiske.de
/
bdrem.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Show help even when config file does not exist
[bdrem.git]
/
src
/
bdrem
/
Config.php
diff --git
a/src/bdrem/Config.php
b/src/bdrem/Config.php
index 04cf8882a3d3e23a6e313d59413d5c6c037cbcbf..65e353d3518dd7f9f5a1eab44983117f457aee4c 100644
(file)
--- a/
src/bdrem/Config.php
+++ b/
src/bdrem/Config.php
@@
-5,18
+5,21
@@
class Config
{
public $source;
public $date;
{
public $source;
public $date;
- public $daysPrev;
- public $daysNext;
+ public $daysPrev
= 3
;
+ public $daysNext
= 7
;
public $locale;
public $locale;
+ public $stopOnEmpty = false;
+ public $cfgFileExists;
public function load()
{
$f = __DIR__ . '/../../data/bdrem.config.php';
if (file_exists($f)) {
public function load()
{
$f = __DIR__ . '/../../data/bdrem.config.php';
if (file_exists($f)) {
+ $this->cfgFileExists = true;
return $this->loadFile($f);
}
return $this->loadFile($f);
}
-
throw new \Exception('No config file found')
;
+
$this->cfgFileExists = false
;
}
protected function loadFile($filename)
}
protected function loadFile($filename)
@@
-40,6
+43,16
@@
class Config
return new $class($settings[0]);
}
return new $class($settings[0]);
}
+ public function setDate($date)
+ {
+ if ($date === null) {
+ $this->date = date('Y-m-d');
+ } else {
+ $dt = new \DateTime($date);
+ $this->date = $dt->format('Y-m-d');
+ }
+ }
+
public function get($varname, $default = '')
{
if (!isset($this->$varname) || $this->$varname == '') {
public function get($varname, $default = '')
{
if (!isset($this->$varname) || $this->$varname == '') {