yvoyer/collection — pull request #18 by yvoyer (2014-04-11 03:19:21+00:00)
Title: Add TypedCollection::getType() and create method

Add the option to configure the type without parameters.

// will thow exception
$collection = new TypedCollection();

// Works
class SomeCollection extends TypedCollection
{
protected function getType()
{
return '\stdClass';
}
}
$collection = new SomeCollection();

// Dependencies
class SomeDepsCollection extends TypedCollection
{
private $newDep;

protected function __construct($newDep)
{
$this->deps = $deps;
parent::__construct();
}

protected function getType()
{
return '\stdClass';
}

protected function create($elements)
{
$newCollection = new self($this->type);
$newCollection->addElements($elements);

return $collection;
}
}

Todo see if the match, partition ... works