_iterator = $iterator; $this->_count = count($iterator); } /** * Returns an iterator of items for a page, or an empty array. * * @param integer $offset Page offset * @param integer $itemCountPerPage Number of items per page * @return LimitIterator|array */ public function getItems($offset, $itemCountPerPage) { if ($this->_count == 0) { return array(); } // @link http://bugs.php.net/bug.php?id=49906 | ZF-8084 // return new LimitIterator($this->_iterator, $offset, $itemCountPerPage); return new Zend_Paginator_SerializableLimitIterator($this->_iterator, $offset, $itemCountPerPage); } /** * Returns the total number of rows in the collection. * * @return integer */ public function count() { return $this->_count; } }