/** * Initializes a new instance of that class. * * @param mixed $previousValue The value that was set via IItemContext::nextValue() in the context of * the previous item. * * @param IEnumerable $seq The underlying sequence. */ public function __construct(IEnumerable $seq, $previousValue = null) { $this->_seq = $seq; $this->_previousValue = $previousValue; $this->_key = $this->_seq->key(); $this->_item = $this->_seq->current(); }
/** * Checks a sequence if it has an expected list of same values (in the same order). * * @param IEnumerable $seq The sequence. * @param array $expected The expected values. * @param bool $exact Check values exactly or not. */ protected function checkForExpectedValues(IEnumerable $seq, array $expected = [], bool $exact = true) { foreach ($expected as $index => $ev) { $seq->reset(); $count = $index; while ($count-- > 0 && $seq->valid()) { $seq->next(); } $av = $seq->current(); if ($exact) { $this->assertSame($ev, $av); } else { $this->assertEquals($ev, $av); } } }
/** * {@inheritDoc} */ public function current() { return $this->_seq->current(); }