예제 #1
0
파일: Daux.php 프로젝트: rlugojr/daux.io
 /**
  * @param string $config_file
  * @param bool $optional
  * @throws Exception
  */
 protected function loadConfiguration($config_file, $optional = true)
 {
     if (!file_exists($config_file)) {
         if ($optional) {
             return;
         }
         throw new Exception('The configuration file is missing. Check path : ' . $config_file);
     }
     $config = json_decode(file_get_contents($config_file), true);
     if (!isset($config)) {
         throw new Exception('The configuration file "' . $config_file . '" is corrupt. Is your JSON well-formed ?');
     }
     $this->options->merge($config);
 }