public function testIteratorSeekAndPrev() { $iterator = new PHPExcel_Worksheet_RowIterator($this->mockWorksheet, 2, 4); $columnIndexResult = 4; $iterator->seek(4); $this->assertEquals($columnIndexResult, $iterator->key()); for ($i = 1; $i < $columnIndexResult - 1; $i++) { $iterator->prev(); $this->assertEquals($columnIndexResult - $i, $iterator->key()); } }
/** * (PHP 5 >= 5.0.0)<br/> * Return the key of the current element * @link http://php.net/manual/en/iterator.key.php * @return mixed scalar on success, or null on failure. */ public function key() { return $this->rowIterator->key() - 1; }
/** * {@inheritdoc} */ public function key() { return $this->worksheet ? $this->worksheet->key() - 1 : 0; }