lithium\data\Collection::reduce()
Overrides
lithium\util\Collection::reduce()
Reduce, or fold, a collection down to a single value
Overridden to load any data that has not yet been loaded.
Parameters
-
callback
$filter
The filter to apply.
-
mixed
$initial
Initial value
Returns
mixedA single reduced value
Source
public function reduce($filter, $initial = false) {
if (!$this->closed()) {
while ($this->next()) {}
}
return parent::reduce($filter, $initial);
}