<?php
chdir(realpath(__DIR__.'/../..'));
require_once './vendor/autoload.php';
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;
}
|