/** * @link http://php.net/manual/en/iterator.current.php * @return mixed */ function current() { /** * @var Pair $pair */ $pair = parent::current(); return $pair->second; }
function __construct(\Iterator $iterator, $n) { parent::__construct($iterator); $this->n = $n; }
function __construct(InOrderIterator $iterator, $size) { parent::__construct($iterator); $this->size = $size; $this->rewind(); }
/** * Calling `next` when iterator is not in a valid state is harmless. * * @link http://php.net/manual/en/iterator.next.php * @return void */ function next() { parent::next(); $this->i++; }
/** * @link http://php.net/manual/en/iterator.valid.php * @return boolean */ function valid() { return $this->used < $this->n && parent::valid(); }
function __construct(\Iterator $iterator, callable $map) { parent::__construct($iterator); $this->mapper = $map; }
function __construct(\Iterator $iterator, callable $filter) { parent::__construct($iterator); $this->filter = $filter; }
function testKeysMap() { $array = ['one' => 1, 'two' => 2, 'three' => 3]; $iterator = new IteratorCollectionAdapter(new ArrayIterator($array)); $this->assertEquals(['one', 'two', 'three'], $iterator->keys()->toArray()); }
function __construct(\Iterator $iterator, $start, $count) { parent::__construct($iterator); $this->start = $start; $this->count = $count; }
/** * @return \ArrayIterator */ function getInnerIterator() { return parent::getInnerIterator(); }
function __construct(BinaryTreeIterator $iterator, $size) { parent::__construct(new ValueIterator($iterator)); $this->size = $size; $this->rewind(); }
function __construct(array $set) { parent::__construct(new ValueIterator(new \ArrayIterator($set))); $this->size = count($set); $this->rewind(); }