Implemented possibility to skip key normalization in config processing

This commit is contained in:
Jérôme Vieilledent 2012-11-22 00:15:19 +01:00 committed by Fabien Potencier
parent 559fa8c214
commit 5e8d401008
2 changed files with 10 additions and 6 deletions

View File

@ -23,12 +23,15 @@ class Processor
* *
* @param NodeInterface $configTree The node tree describing the configuration * @param NodeInterface $configTree The node tree describing the configuration
* @param array $configs An array of configuration items to process * @param array $configs An array of configuration items to process
* @param bool $normalizeKeys Flag indicating if config key normalization is needed. True by default.
* *
* @return array The processed configuration * @return array The processed configuration
*/ */
public function process(NodeInterface $configTree, array $configs) public function process(NodeInterface $configTree, array $configs, $normalizeKeys = true)
{ {
$configs = self::normalizeKeys($configs); if ($normalizeKeys) {
$configs = self::normalizeKeys($configs);
}
$currentConfig = array(); $currentConfig = array();
foreach ($configs as $config) { foreach ($configs as $config) {
@ -44,12 +47,13 @@ class Processor
* *
* @param ConfigurationInterface $configuration The configuration class * @param ConfigurationInterface $configuration The configuration class
* @param array $configs An array of configuration items to process * @param array $configs An array of configuration items to process
* @param bool $normalizeKeys Flag indicating if config key normalization is needed. True by default.
* *
* @return array The processed configuration * @return array The processed configuration
*/ */
public function processConfiguration(ConfigurationInterface $configuration, array $configs) public function processConfiguration(ConfigurationInterface $configuration, array $configs, $normalizeKeys = true)
{ {
return $this->process($configuration->getConfigTreeBuilder()->buildTree(), $configs); return $this->process($configuration->getConfigTreeBuilder()->buildTree(), $configs, $normalizeKeys);
} }
/** /**

View File

@ -96,11 +96,11 @@ abstract class Extension implements ExtensionInterface, ConfigurationExtensionIn
return Container::underscore($classBaseName); return Container::underscore($classBaseName);
} }
final protected function processConfiguration(ConfigurationInterface $configuration, array $configs) final protected function processConfiguration(ConfigurationInterface $configuration, array $configs, $normalizeKeys = true)
{ {
$processor = new Processor(); $processor = new Processor();
return $processor->processConfiguration($configuration, $configs); return $processor->processConfiguration($configuration, $configs, $normalizeKeys);
} }
/** /**