iterator = $iterator; $this->count = count($iterator); } /** * Returns an iterator of items for a page, or an empty array. * * @param int $offset Page offset * @param int $itemCountPerPage Number of items per page * @return array|\Zend\Paginator\SerializableLimitIterator */ public function getItems($offset, $itemCountPerPage) { if ($this->count == 0) { return array(); } return new Paginator\SerializableLimitIterator($this->iterator, $offset, $itemCountPerPage); } /** * Returns the total number of rows in the collection. * * @return int */ public function count() { return $this->count; } }