lithium\data\Collection::reduce()

public method

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

mixed

A single reduced value

Source

	public function reduce($filter, $initial = false) {
		if (!$this->closed()) {
			while ($this->next()) {}
		}
		return parent::reduce($filter, $initial);
	}