From 6bb36a3212ac634d09f7c73e31f356ea79dadd7b Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Sat, 19 Dec 2015 00:58:14 +0100 Subject: [PATCH] Check if config file exists --- classes/Config.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/classes/Config.php b/classes/Config.php index 3e0f75f..a003624 100644 --- a/classes/Config.php +++ b/classes/Config.php @@ -38,11 +38,14 @@ Class Config */ private function __construct() { - $yaml = Yaml::parse(file_get_contents(__DIR__.'/../config.yml')); - if (isset($yaml) && is_array($yaml)) { - foreach ($yaml as $param=>$value) { - if (isset($this->$param)) { - $this->$param = $value; + $yamlfile = __DIR__.'/../config.yml'; + if (is_file($yamlfile)) { + $yaml = Yaml::parse(file_get_contents($yamlfile)); + if (isset($yaml) && is_array($yaml)) { + foreach ($yaml as $param=>$value) { + if (isset($this->$param)) { + $this->$param = $value; + } } } }