Esempio n. 1
0
 public function process(NodeInterface $configTree, array $configs)
 {
     $configs = Extension::normalizeKeys($configs);
     $currentConfig = array();
     foreach ($configs as $config) {
         $config = $configTree->normalize($config);
         $currentConfig = $configTree->merge($currentConfig, $config);
     }
     return $configTree->finalize($currentConfig);
 }
Esempio n. 2
0
 public function addChild(NodeInterface $node)
 {
     $name = $node->getName();
     if (empty($name)) {
         throw new \InvalidArgumentException('Node name cannot be empty.');
     }
     if (isset($this->children[$name])) {
         throw new \InvalidArgumentException(sprintf('The node "%s" already exists.', $name));
     }
     if (null !== $this->prototype) {
         throw new \RuntimeException('An ARRAY node must either have a prototype, or concrete children.');
     }
     $this->children[$name] = $node;
 }