_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(); } return new LimitIterator($this->_iterator, $offset, $itemCountPerPage); } /** * Returns the total number of rows in the collection. * * @return integer */ public function count() { return $this->_count; } }