Ruby-inspired object-oriented wrapper over builtin PHP types.
Currently implemented classes and mixins:
- Enumerable
Generally mirrors the functionality of Ruby's Enumerable with the following alterations:
-
Due to the nature of array type implementation in PHP (as is it de-facto being an ordered map) methods are denied knowledge of whether the collection is ordered or not and if the keys need to be preserved in resulting iterable(s). To overcome the issue, the $mode parameter containing optional flag $PRESERVE_KEYS has been added to most standard methods, as well as dedicated shortcuts for associative arrays (#amap, #aselect etc).
-
Short lambda bodies can be passed as strings. In that case create_function will be used.
-
All methods which return new iterable(s) are lazy by default. Use #to_a or #to_aa to force iterable to an array.
-
All methods which used to use extended comparison operator (===) are now only accept regular expressions string patterns which is then matched to a string value of an array item.
Published under MIT license.