1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-11 01:22:54 +00:00

Fix config listing

This commit is contained in:
Jordi Boggiano 2012-11-13 12:30:17 +01:00
parent 75da832cd3
commit ef68125b3b

View file

@ -267,25 +267,30 @@ EOT
*/
protected function listConfiguration(array $contents, OutputInterface $output, $k = null)
{
$origK = $k;
foreach ($contents as $key => $value) {
if ($k === null && !in_array($key, array('config', 'repositories'))) {
continue;
}
if (is_array($value)) {
if (is_array($value) && !is_numeric(key($value))) {
$k .= preg_replace('{^config\.}', '', $key . '.');
$this->listConfiguration($value, $output, $k);
if (substr_count($k,'.') > 1) {
$k = str_split($k,strrpos($k,'.',-2));
if (substr_count($k, '.') > 1) {
$k = str_split($k, strrpos($k, '.', -2));
$k = $k[0] . '.';
} else {
$k = null;
$k = $origK;
}
continue;
}
if (is_array($value)) {
$value = '['.implode(', ', $value).']';
}
$output->writeln('[<comment>' . $k . $key . '</comment>] <info>' . $value . '</info>');
}
}