|
|
@@ -17,6 +17,7 @@ namespace Cake\Collection;
|
|
|
use AppendIterator;
|
|
|
use ArrayObject;
|
|
|
use Cake\Collection\Collection;
|
|
|
+use Cake\Collection\Iterator\BufferedIterator;
|
|
|
use Cake\Collection\Iterator\ExtractIterator;
|
|
|
use Cake\Collection\Iterator\FilterIterator;
|
|
|
use Cake\Collection\Iterator\InsertIterator;
|
|
|
@@ -890,6 +891,19 @@ trait CollectionTrait {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * Returns a new collection where the operations performed by this collection.
|
|
|
+ * Not matter how many times the new collection is iterated, those operations will
|
|
|
+ * only be performed once.
|
|
|
+ *
|
|
|
+ * This can also be used to make any non-rewindable iterator rewindable.
|
|
|
+ *
|
|
|
+ * @return \Cake\Collection\Iterator\BufferedIterator
|
|
|
+ */
|
|
|
+ public function buffered() {
|
|
|
+ return new BufferedIterator($this);
|
|
|
+ }
|
|
|
+
|
|
|
+/**
|
|
|
* Returns a new collection with each of the elements of this collection
|
|
|
* after flattening the tree structure. The tree structure is defined
|
|
|
* by nesting elements under a key with a known name. It is possible
|