Added new Collection::merge() method #1258

This commit is contained in:
Andy Miller
2017-01-20 10:47:24 -07:00
parent 9536f2e418
commit 5ecf240c26

View File

@@ -74,6 +74,21 @@ class Collection extends Iterator
return new static($this->items, $this->params, $this->pages);
}
/**
*
* Merge another collection with the current collection
*
* @param Collection $collection
* @return $this
*/
public function merge(Collection $collection)
{
foreach($collection as $page) {
$this->addPage($page);
}
return $this;
}
/**
* Set parameters to the Collection
*