diff --git a/boot.php b/boot.php index 3a5b62b..d5aa475 100644 --- a/boot.php +++ b/boot.php @@ -1,7 +1,7 @@ set('git', 'repositories', rtrim($config->get('git', 'repositories'), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR); // Startup and configure Silex application diff --git a/src/GitList/Config.php b/src/GitList/Config.php index a7f09e3..33d5b39 100644 --- a/src/GitList/Config.php +++ b/src/GitList/Config.php @@ -6,13 +6,17 @@ class Config { protected $data; - public function __construct($file) - { + public static function fromFile($file) { if (!file_exists($file)) { die(sprintf('Please, create the %1$s file.', $file)); } + $data = parse_ini_file($file, true); + return new static($data); + } - $this->data = parse_ini_file($file, true); + public function __construct($data) + { + $this->data = $data; $this->validateOptions(); }