/** * Finds the configured configuration sources. * * The config needs at least a valid config-dir or config-file * option. * * @throw Xinc::Core::Exception::IOException * @return array with configured sources */ public function getConfigurationSources(ConfigInterface $conf) { if ($conf->hasOption('config-file')) { $file = $conf->getOption('config-file'); if (isset($file)) { if (!strstr($file, '/')) { $file = $conf->getOption('config-dir') . $file; } return array($file); } } // load every xml file in config dir $dir = $conf->getOption('config-dir'); $list = glob("{$dir}*.xml", GLOB_ERR); if ($list === false) { throw new IOException($dir, null, "config-dir '{$dir}' is not readable", IOException::FAILURE_NOT_READABLE); } return $list; }
public function getConfigurationSources(ConfigInterface $conf) { $file = $conf->getOption('project-file'); if (isset($file)) { if (!strstr($file, '/')) { $file = $conf->getOption('project-dir') . $file; } return array($file); } else { $dir = $conf->getOption('project-dir'); $list = glob("{$dir}*.xml"); if ($list === false) { throw new IOException($dir, null, null, IOException::FAILURE_NOT_READABLE); } if (empty($list)) { throw new IOException($dir, null, null, IOException::FAILURE_NOT_FOUND); } return $list; } }