public function count() { if ($this->iterator instanceof Countable) { return $this->iterator->count(); } return iterator_count($this->iterator); }