protected function normalize($config)
{
// Validate the config entry
$this->validateRootElements($config);
// For single value elements, normalize all class name and options, remove null entry
foreach (array('vcs', 'version-generator', 'version-persister') as $configKey) {
$value = $config[$configKey];
if ($value == null) {
unset($config[$configKey]);
continue;
}
$config[$configKey] = $this->getClassAndOptions($value, $configKey);
}
// Same process but for list value elements
foreach (array('prerequisites', 'pre-release-actions', 'post-release-actions') as $configKey) {
foreach ($config[$configKey] as $key => $item) {
// Accept the element to be define by key or by value
if (!is_numeric($key)) {
if ($item == null) {
$item = array();
}
$item['name'] = $key;
}
$config[$configKey][$key] = $this->getClassAndOptions($item, $configKey . '_' . $key);
}
}
return $config;
}