/** * Constructor. * * @param \Iterator $iterator Source data * @param integer $offset Offset (Optional) * @param integer $count Maximum item count (Optional) * @param integer $mode Result counting mode * @throws \InvalidArgumentException Inner iterator is not countable */ public function __construct(\Iterator $iterator, int $offset = 0, int $count = -1, int $mode = self::MODE_PASS) { if (!$iterator instanceof \Countable) { throw new \InvalidArgumentException('Supplied iterator must be countable'); } parent::__construct($iterator, $offset, $count); $this->offset = $offset; $this->count = $count; $this->mode = $mode; }
function __construct($options = array()) { $this->options = $options + $this->options; $this->options = $this->options + $this->getDefaultOptions(); if (!isset($this->options['listClass'])) { throw new Exception("No List Class was set", 500); } if (!isset($this->options['itemClass'])) { throw new Exception("No Item Class was set", 500); } if (!isset($this->options['array'])) { //get a lit of all of them by default. $this->options['array'] = $this->getAllForConstructor(); } $list = new \ArrayIterator($this->options['array']); parent::__construct($list, $this->options['offset'], $this->options['limit']); }
/** * Construct a Zend\Paginator\SerializableLimitIterator * * @param Iterator $it Iterator to limit (must be serializable by un-/serialize) * @param int $offset Offset to first element * @param int $count Maximum number of elements to show or -1 for all * @see LimitIterator::__construct */ public function __construct(Iterator $it, $offset = 0, $count = -1) { parent::__construct($it, $offset, $count); $this->offset = $offset; $this->count = $count; }