public function addChild(NodeInterface $node)
    {
        $name = $node->getName();
        if (!\strlen($name)) {
            throw new \InvalidArgumentException('Child nodes must be named.');
        }
        if (isset($this->children[$name])) {
            throw new \InvalidArgumentException(sprintf('A child node named "%s" already exists.', $name));
        }

        $this->children[$name] = $node;
    }
public function addChild(NodeInterface $node)
    {
        $name = $node->getName();
        if (!\strlen($name)) {
            throw new \InvalidArgumentException('Child nodes must be named.');
        }
        if (isset($this->children[$name])) {
            throw new \InvalidArgumentException(sprintf('A child node named "%s" already exists.', $name));
        }

        $this->children[$name] = $node;
    }
public function addChild ( NodeInterface $ node ) { $ name = $ node -> getName ( ) ; if ( ! \ strlen ( $ name ) ) { throw new \ InvalidArgumentException ( 'Child nodes must be named.' ) ; } if ( isset ( $ this -> children [ $ name ] ) ) { throw new \ InvalidArgumentException ( sprintf ( 'A child node named "%s" already exists.' , $ name ) ) ; } $ this -> children [ $ name ] = $ node ; }
Adds a child node.

@throws \InvalidArgumentException when the child node has no name
@throws \InvalidArgumentException when the child node's name is not unique
Adds a child node .