12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- <?php
- namespace Symfony\Component\Config\Definition;
- class Processor
- {
-
- public function process(NodeInterface $configTree, array $configs)
- {
- $currentConfig = array();
- foreach ($configs as $config) {
- $config = $configTree->normalize($config);
- $currentConfig = $configTree->merge($currentConfig, $config);
- }
- return $configTree->finalize($currentConfig);
- }
-
- public function processConfiguration(ConfigurationInterface $configuration, array $configs)
- {
- return $this->process($configuration->getConfigTreeBuilder()->buildTree(), $configs);
- }
-
- public static function normalizeConfig($config, $key, $plural = null)
- {
- if (null === $plural) {
- $plural = $key.'s';
- }
- if (isset($config[$plural])) {
- return $config[$plural];
- }
- if (isset($config[$key])) {
- if (\is_string($config[$key]) || !\is_int(key($config[$key]))) {
-
- return array($config[$key]);
- }
- return $config[$key];
- }
- return array();
- }
- }
|