ramsondon/arraycollectionfactory

There is no license information available for the latest version (v1.0) of this package.

a type save array generator via type hinting

v1.0 2014-08-19 10:56 UTC

This package is not auto-updated.

Last update: 2024-10-08 08:11:07 UTC


README

ArrayCollectionFactory is a dynamic ArrayCollection generator for type save access via type hints in PHP.

the ArrayCollection implements \Countable, \Iterator and the dynamically created cached ArrayCollection contains the methods:

->append(Class\of\Object $object);

->getAt($index);

->removeAt($index);

try phpunit in directory src/Ramsondon/TypedArray/Test to generate cached ArrayCollection and Interface.
the cached files will be created in src/Ramsondon/TypedArray/Cache

How to use:

    use Ramsondon\ArrayCollectionFactory;

    $factroy = new ArrayCollectionFactory();

    /* @var $collection \Ramsondon\TypedArray\Cache\ITestObjectArrayCollection */
    $collection = $factory->create('Class\\Of\\TestObject');

    $object = new Class\Of\TestObject();

    $collection->append($object);

    /* @var $testobject \Class\Of\TestObject */
    foreach ($collection as $testobject) {
        $testobject->doSomething();
    }