Download the PHP package troublete/collection without Composer
On this page you can find all versions of the php package troublete/collection. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download troublete/collection
More information about troublete/collection
Files in troublete/collection
Package collection
Short Description Small functional multi-purpose collection
License GPL-2.0-only
Informations about the package collection
Functional Collection
Small functional multi-purpose collection
Insall
Usage
API
of(...$values)
Setup new collection with provided values. immutable
map(callable $mapFunc)
Method which will be applied to each element in the value set of the collection. mutable
filter(callable $predicate)
Method which will create a collection copy and filter values by function (returning false
filters value out). immutable
generator(): \Generator
Returns Generator
over value set.
extract(): array
Will return value set.
extend(callable $func)
Method will call the provided Closure
and inject set values. Returned values will be put into immutable FunctionalCollection
and returned. immutable
concat(FunctionaCollection $collection)
Method will combine to value sets of two collection and return a new one with set values. immutable
chain(callable $map)
Method which will apply $map
to every element in the value collection and will reduce the result and add it to the overall value set and create a immutable new collection with it. immutable
reduce(callable $func = null)
Method to reduce the value set (value by value) according to the result of calling $func
and return the created accumulated value. If $func
is null
the raw value is used and added to the accumulator.
License
GPL-2.0 © 2018 Willi Eßer