Skip to content

Instantly share code, notes, and snippets.

View mohamed-samir907's full-sized avatar
🏠
Working from home

Mohamed Samir mohamed-samir907

🏠
Working from home
View GitHub Profile
@mohamed-samir907
mohamed-samir907 / LazyGeneratorCollection.php
Created October 14, 2020 23:01 — forked from andrerom/LazyGeneratorCollection.php
Lazy Collection using Generator in PHP (Example, script in bottom of file to test it)
<?php
/**
* Class GeneratorCollection, allows for lazy loaded arrays using Generators withouth it's limitations.
*
* This collection class takes Generator as argument, and allows user to threat it like any kind of array. It will take
* care about storing the values returned from generator so user can iterate over it several times.
*
* NOTE: In current form only works with generators that uses integers as keys (lists).
*/
@mohamed-samir907
mohamed-samir907 / LazyGeneratorCollection.php
Created October 14, 2020 23:01 — forked from andrerom/LazyGeneratorCollection.php
Lazy Collection using Generator in PHP (Example, script in bottom of file to test it)
<?php
/**
* Class GeneratorCollection, allows for lazy loaded arrays using Generators withouth it's limitations.
*
* This collection class takes Generator as argument, and allows user to threat it like any kind of array. It will take
* care about storing the values returned from generator so user can iterate over it several times.
*
* NOTE: In current form only works with generators that uses integers as keys (lists).
*/