Filter Counter
olekukonko opened this issue · 5 comments
olekukonko commented
From https://github.com/morrisonlevi/Ardent/blob/master/src/Ardent/Iterator/FilteringIterator.php i notice the following code
function count() {
$i = 0;
for ($this->rewind(); $this->valid(); $this->next()) {
$i++;
}
return $i;
}
Why just just implement FilteringIterator::$counter
has integer and just do basic increment and decrements ?
morrisonlevi commented
Since writing this implementation I've found an SPL function that will replace the entire method body: iterator_count
morrisonlevi commented
See c70ca13 for the simplified implementation.
olekukonko commented
morrisonlevi commented
Agreed.
morrisonlevi commented
Commit 875de2c fixes this and adds minor documentation.