This package provides functional interfaces to manipulate arrays.
It provides collection class that provide an array interface and uses two traits that have additional functions to provide a functional interface to manipulate arrays in a functional way similar to the Ruby language.
Currently the traits provide functions for accessing array elements and traverse the array, sort the array, check if the array contains a certain value, get the minimum and maximum value in the array, filter or map the array values using a callback function, etc..
Many classes require manipulating collections of elements. However the types of elements are different for each type of collection.
This package implements a trait for manipulating generic collections of elements that can be reused in classes for many different purposes.
Trying to extend some PHP objects to be used on a more functional way.
Once one PHP developer said that nowadays IDE's can help us to avoid
remembering the lack of standardization some PHP methods has. As I don't
use an IDE, as lots of developers out there, I don't agree with that and
I'm kind of tired to try to remember if on array_filter or array_map
the array goes first and the function goes last or what order they are.
So, I think it's easier to use on a function and Ruby style way, where
we can call the methods on the object and it returns what we need.
One notable exception to try to make things easier is that PHP have some
reserved and constant words we cannot reuse even inside a namespace, like Array.
So I needed to call the Array class Collection, otherwise it will be
impossible to implement. All the classes have the original object
accessible with the values method.
Other thing is that some methods just returns a value or null, true or false.
No more guesses and wonderings of what happened if it returns 0 or false.