public function getConfig()
{
$configFile = $this->getConfigFilePath();
if (!is_file($configFile)) {
throw new \Exception("Impossible to locate the config file rmt.xxx at {$configFile}. If it's the first time you " . 'are using this tool, you setup your project using the [RMT init] command');
}
if (pathinfo($configFile, PATHINFO_EXTENSION) == 'json') {
$config = json_decode(file_get_contents($configFile), true);
if (!is_array($config)) {
throw new \Exception("Impossible to parse your config file ({$configFile}), you probably have an error in the JSON syntax");
}
} else {
try {
$config = Yaml::parse(file_get_contents($configFile), true);
} catch (\Exception $e) {
throw new \Exception("Impossible to parse your config file ({$configFile}), " . 'you probably have an error in the YML syntax: ' . $e->getMessage());
}
}
return $config;
}