Example #1
0
 /**
  * @link http://php.net/manual/en/iterator.current.php
  * @return mixed
  */
 function current()
 {
     /**
      * @var Pair $pair
      */
     $pair = parent::current();
     return $pair->second;
 }
Example #2
0
 function __construct(\Iterator $iterator, $n)
 {
     parent::__construct($iterator);
     $this->n = $n;
 }
Example #3
0
 function __construct(InOrderIterator $iterator, $size)
 {
     parent::__construct($iterator);
     $this->size = $size;
     $this->rewind();
 }
Example #4
0
 /**
  * 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++;
 }
Example #5
0
 /**
  * @link http://php.net/manual/en/iterator.valid.php
  * @return boolean
  */
 function valid()
 {
     return $this->used < $this->n && parent::valid();
 }
Example #6
0
 function __construct(\Iterator $iterator, callable $map)
 {
     parent::__construct($iterator);
     $this->mapper = $map;
 }
Example #7
0
 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());
 }
Example #9
0
 function __construct(\Iterator $iterator, $start, $count)
 {
     parent::__construct($iterator);
     $this->start = $start;
     $this->count = $count;
 }
Example #10
0
 /**
  * @return \ArrayIterator
  */
 function getInnerIterator()
 {
     return parent::getInnerIterator();
 }
Example #11
0
 function __construct(BinaryTreeIterator $iterator, $size)
 {
     parent::__construct(new ValueIterator($iterator));
     $this->size = $size;
     $this->rewind();
 }
Example #12
0
 function __construct(array $set)
 {
     parent::__construct(new ValueIterator(new \ArrayIterator($set)));
     $this->size = count($set);
     $this->rewind();
 }