public function add($nodes) {
    if ($nodes instanceof Node) {
      $this->nodes[] = $nodes;
    }
    elseif ($nodes instanceof NodeCollection) {
      $this->nodes = array_merge($this->nodes, $nodes->nodes);
    }
    elseif (is_array($nodes)) {
      $this->nodes = array_merge($this->nodes, $nodes);
    }
    else {
      throw new \InvalidArgumentException();
    }
    $this->nodes = static::sortUnique($this->nodes);
    return $this;
  }
public function add($nodes) {
    if ($nodes instanceof Node) {
      $this->nodes[] = $nodes;
    }
    elseif ($nodes instanceof NodeCollection) {
      $this->nodes = array_merge($this->nodes, $nodes->nodes);
    }
    elseif (is_array($nodes)) {
      $this->nodes = array_merge($this->nodes, $nodes);
    }
    else {
      throw new \InvalidArgumentException();
    }
    $this->nodes = static::sortUnique($this->nodes);
    return $this;
  }
public function add ( $ nodes ) { if ( $ nodes instanceof Node ) { $ this -> nodes [ ] = $ nodes ; } elseif ( $ nodes instanceof NodeCollection ) { $ this -> nodes = array_merge ( $ this -> nodes , $ nodes -> nodes ) ; } elseif ( is_array ( $ nodes ) ) { $ this -> nodes = array_merge ( $ this -> nodes , $ nodes ) ; } else { throw new \ InvalidArgumentException ( ) ; } $ this -> nodes = static :: sortUnique ( $ this -> nodes ) ; return $ this ; }
Add nodes to this collection.
@param Node|Node[]|NodeCollection $nodes Nodes to add to collection.
@return $this
@throws \InvalidArgumentException
Add nodes to this collection .