Exemplo n.º 1
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;
 }