lithium\util\Collection::reduce()
Reduce, or fold, a collection down to a single value
Parameters
-
callable
$reducer
The reduce function, i.e.
function($carry, $item) { return ... }
-
mixed
$initial
Initial value passed to the reduce function as
$carry
, defaults tofalse
.
Returns
mixedA single reduced value.
Links
Source
public function reduce($reducer, $initial = false) {
return array_reduce($this->_data, $reducer, $initial);
}