From 5bdf22764f92dc2df2800209b4909c890b80c31e Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Fri, 9 Jan 2015 13:35:05 -0700 Subject: [PATCH] Added a `copy()` method on collections --- system/src/Grav/Common/Page/Collection.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/system/src/Grav/Common/Page/Collection.php b/system/src/Grav/Common/Page/Collection.php index ae633ea28..5dd03ceb0 100644 --- a/system/src/Grav/Common/Page/Collection.php +++ b/system/src/Grav/Common/Page/Collection.php @@ -35,6 +35,17 @@ class Collection extends Iterator return $this->params; } + /** + * + * Create a copy of this collection + * + * @return static + */ + public function copy() + { + return new static($this->items, $this->params, $this->pages); + } + /** * Set parameters to the Collection *