Add nodes to this collection.
@param Node|Node[]|NodeCollection $nodes Nodes to add to collection.
@return $this
@throws \InvalidArgumentException
774860
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;
  }
887970
public function add(iterable $elements): CollectionInterface
    {
        foreach ($elements as $key => $element) {
            $this->set($key, $element);
        }

        return $this;
    }
1283629
public function addFeedableItems($items)
    {
        if (!is_array($items) && !($items instanceof \Traversable)) {
            throw new \InvalidArgumentException('You should pass an array or a collection of Feedable items');
        }

        foreach ($items as $feedable) {
            if (!$feedable instanceof Feedable) {
                throw new \InvalidArgumentException('Feedable items should implement Feedable interface');
            }

            $this->addItem($feedable->getFeedItem());
        }

        return $this;
    }
42209
public function add(Node\NodeInterface $node)
	{
		$node->setRepository($this);
		parent::add($node);
		$this->array[] = $node;
	}
244493
public function addNode(Node $node): self
    {
        $this->nodes[] = $node;
        $this->nodesByType[$node::NODE_TYPE][] = $node;
        return $this;
    }
1343737
public function add(... $items) : Set
    {
        $values = $this->_pushAll($items);
        $this->setValues($values);
        return $this;
    }
512526
public function addChildren(array $children)
    {
        if ($this->exists) {
            \DB::connection($this->connection)->transaction(function () use ($children) {
                $lastChildPosition = $this->getLastChildPosition();

                foreach ($children as $child) {
                    if (!$child instanceof EntityInterface) {
                        if (isset($child['id'])) {
                            unset($child['id']);
                        }

                        $child = new static($child);
                    }

                    $this->addChild($child, $lastChildPosition);
                    $lastChildPosition++;
                }
            });
        }

        return $this;
    }
75398
public function add($collection)
    {
        if (!is_array($collection) and !($collection instanceof \Traversable)) {
            throw new \InvalidArgumentException(self::MSG_NOT_ITERABLE, 230);
        }
        
        foreach ($collection as $name => $closure) {
            $this->set($name, $closure);
        }
        
        return $this;
    }
385736
public function addManagedCollections($collections)
    {
        if (!is_array($collections)) {
            $collections = array($collections);
        }
        $this->managedCollections = array_merge($this->managedCollections, $collections);

        return $this;
    }
1216228
public function add($items)
    {
        if (is_array($items)) {
            $this->collection[] = new RecordField($items);
        } elseif (is_object($items) && $items instanceof RecordField) {
            $this->collection[] = $items;
        }

        return $this;
    }
1278244
public function setSubnodes(\Doctrine\Common\Collections\ArrayCollection $subnodes)
    {
        $this->subnodes = $subnodes;

        return $this;
    }
1077566
private function addNode(NodeInterface $node)
    {
        $this->nodeIndex++;
        $this->graph['nodes'][] = $node->toArray();

        return $this->nodeIndex;
    }
391462
public function addPages( $pages ) {
		if( !is_array( $pages ) && !$pages instanceof Pages ) {
			throw new InvalidArgumentException( '$pages needs to either be an array or a Pages object' );
		}
		if( $pages instanceof Pages ) {
			$pages = $pages->toArray();
		}
		foreach( $pages as $page ) {
			$this->addPage( $page );
		}
	}
1042904
public function addQueries(array $queries) : self
    {
        foreach ($queries as $key => $value) {
            if (is_null($value)) {
                continue;
            }

            if (!is_string($key)) {
                throw new \InvalidArgumentException("Invalid querystring '" . $key . "'");
            }

            if (!is_string($value) && !is_array($value)) {
                throw new \InvalidArgumentException(sprintf(
                    "Invalid querystring value '%s' with type '%s'",
                    $key,
                    gettype($value)
                ));
            }

            $this->uri['query'][$key] = $value;
        }

        return $this;
    }
1197854
public function setChildNodes(array $childNodes)
    {
        // Ensure integrity of $nodes array
        foreach ($childNodes as $childNode) {
            if (! is_a($childNode, AbstractNode::class)) {
                throw new \InvalidArgumentException(
                    'Error: Expected AbstractNode, but got "'.gettype($childNode).'"'
                );
            }
        }

        $this->childNodes = $childNodes;
    }
373713
public function setCollections($collections)
    {
        if (!is_array($collections) && !$collections instanceof Traversable) {
            throw new Exception\InvalidArgumentException(sprintf(
                '%s: expects an array or Traversable, received "%s"',
                __METHOD__,
                (is_object($collections) ? get_class($collections) : gettype($collections))
            ));
        }

        if ($collections instanceof Traversable) {
            $collections = ArrayUtils::iteratorToArray($collections);
        }

        $this->collections = $collections;
    }
733669
function add($element)
    {
        if(get_class($element) !== $this->manager->getModel()){
            throw new InvalidArgumentException("This element is not compatible with this collection, it only support  ".$this->manager->getModel());
        }
        return array_push($this->elements,$this->manager->hydrate($element));
    }