Skip to content

ramsondon/ArrayCollectionFactory

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ArrayCollectionFactory

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();
    }

About

PHP ArrayCollectionFactory is a factory which creates type hinted ArrayCollections for your custom object on the fly

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages