| Recommend this page to a friend! | 
|  Download | 
| Info | Documentation |  Files |  Install with Composer |  Download | Reputation | Support forum | Blog | Links | 
| Ratings | Unique User Downloads | Download Rankings | ||||
|     72% | Total: 130 | All time:  9,364 This week: 455  | ||||
| Version | License | PHP version | Categories | |||
| ite-collection 1.1.2 | BSD License | 5.6 | PHP 5, Data types, Traits | 
| Description | Author | |||
| This package can manage sets of arrays or objects as collections. Innovation Award 
 | 
It contains two different types of collections - ArrayCollection and ObjectCollection. ArrayCollection stores unique values in array. ObjectCollection stores unique objects, instances of a given class.
    <?php
    // ArrayCollection usage:
    use Ite\Collection\ArrayCollection;
    $collection = new ArrayCollection();
    $collection->set(12);
    $collection->set("A");
    //var_dump($collection->toArray());
    $collection->set("B");
    //var_dump($collection->toArray());
    $collection2 = new ArrayCollection([1,44,'asd', 5 => PHP_INT_MAX]);
    $collection->merge($collection2);
    var_dump($collection->toArray());
    //$max = $collection->remove(PHP_INT_MAX);
    //var_dump($collection->toArray(), $max);
    foreach ($collection as $key => $val) {
            echo $key.': '.$val.PHP_EOL;
    }
    // ObjectCollection usage:
    use Ite\Collection\ObjectCollection;
    $collection = new ObjectCollection('\stdClass');
    $a = new stdClass();
    $b = new stdClass();
    $c = new stdClass();
    $d = new stdClass();
    $e = new stdClass();
    $collection->set($a);
    $collection->set($b);
    $collection->set($c);
    //$collection->set($c); -> throw exception
    $collection->set($d);
    $collection->set($e);
    foreach ($collection as $key => $val) {
            echo $key.': '.get_class($val).PHP_EOL;
    }|  Files (9) | 
| File | Role | Description | ||
|---|---|---|---|---|
|  src (4 files) | ||||
|  tests (2 files) | ||||
|    composer.json | Conf. | composer file | ||
|    license | Lic. | license | ||
|    README.md | Doc. | readme file | ||
|  Files (9) | / | src | 
| File | Role | Description | 
|---|---|---|
|  ArrayCollection.php | Class | ArrayCollection class | 
|  CollectionInterface.php | Class | CollectionInterface | 
|  CollectionTrait.php | Class | Base collection methods | 
|  ObjectCollection.php | Class | ObjectCollection class | 
|  Files (9) | / | tests | 
| File | Role | Description | 
|---|---|---|
|    array_collection.php | Example | array collection tests | 
|    object_collection.php | Example | object collection examples | 
| The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. | 
|  Install with Composer | 
| Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
| 0% | 
 | 
 | 
| User Ratings | ||||||||||||||||||||||||||||||
| 
 | ||||||||||||||||||||||||||||||
| Applications that use this package | 
 If you know an application of this package, send a message to the author to add a link here.
 If you know an application of this package, send a message to the author to add a link here.