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