Skip to content

Implementation of Ruby's Enumerable mixin in PHP

License

Notifications You must be signed in to change notification settings

whiskyjs/objectify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Dependency Status Code Coverage License

objectify

Ruby-inspired object-oriented wrapper over builtin PHP types.

Currently implemented classes and mixins:

  • Enumerable

Usage

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.

License

Published under MIT license.

About

Implementation of Ruby's Enumerable mixin in PHP

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages