antograssiot 150be2d7b5 add missing use statement 10 years ago
..
Iterator a718ac7222 use a temp variable instead of the array 10 years ago
Collection.php 28fc8cc30b Addinig serializable support for ZipIterator and documenting new functions 10 years ago
CollectionInterface.php d5b06604e7 Renamed {n} to {*} in collections 11 years ago
CollectionTrait.php 150be2d7b5 add missing use statement 10 years ago
ExtractTrait.php d5b06604e7 Renamed {n} to {*} in collections 11 years ago
README.md 0a1b1a123a Correct CS in readme 11 years ago
composer.json 4a0955dbcc Convert indentation to spaces for composer.json files 11 years ago
functions.php 5f51f3aa09 Fix CS warnings in function docblocks 11 years ago

README.md

CakePHP Collection Library

The collection classes provide a set of tools to manipulate arrays or Traversable objects. If you have ever used underscore.js, you have an idea of what you can expect from the collection classes.

Usage

Collections can be created using an array or Traversable object. A simple use of a Collection would be:

use Cake\Collection\Collection;

$items = ['a' => 1, 'b' => 2, 'c' => 3];
$collection = new Collection($items);

// Create a new collection containing elements
// with a value greater than one.
$overOne = $collection->filter(function ($value, $key, $iterator) {
    return $value > 1;
});

The Collection\CollectionTrait allows you to integrate collection-like features into any Traversable object you have in your application as well.

Documentation

Please make sure you check the official documentation