/** * Merge one or more collections * * @param CollectionInterface $collection,... The collection to merge * * @return CollectionInterface This method is chainable */ public function merge(CollectionInterface $collection) { $this->objects = array_merge($this->objects, $collection->toArray()); return $this; }
/** * Merge one or more collections * * @param CollectionInterface $collection,... The collection to merge * * @return CollectionInterface This method creates new instance of collection */ public function merge(CollectionInterface $collection) { return new static(array_merge($this->objects, $collection->toArray())); }