original_string: 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;
      }
code: 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;
      }
code_tokens: 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 ; }
docstring: Adds a child node.
  
  @throws \InvalidArgumentException when the child node has no name
  @throws \InvalidArgumentException when the child node's name is not unique
docstring_tokens: Adds a child node .