Code Duplication    Length = 11-12 lines in 2 locations

src/PhpSpreadsheet/Worksheet/ColumnCellIterator.php 1 location

@@ 99-109 (lines=11) @@
96
     *
97
     * @return ColumnCellIterator
98
     */
99
    public function seek($row = 1)
100
    {
101
        if (($row < $this->startRow) || ($row > $this->endRow)) {
102
            throw new PhpSpreadsheetException("Row $row is out of range ({$this->startRow} - {$this->endRow})");
103
        } elseif ($this->onlyExistingCells && !($this->worksheet->cellExistsByColumnAndRow($this->columnIndex, $row))) {
104
            throw new PhpSpreadsheetException('In "IterateOnlyExistingCells" mode and Cell does not exist');
105
        }
106
        $this->currentRow = $row;
107
108
        return $this;
109
    }
110
111
    /**
112
     * Rewind the iterator to the starting row.

src/PhpSpreadsheet/Worksheet/RowCellIterator.php 1 location

@@ 100-111 (lines=12) @@
97
     *
98
     * @return RowCellIterator
99
     */
100
    public function seek($column = 'A')
101
    {
102
        $column = Coordinate::columnIndexFromString($column);
103
        if (($column < $this->startColumnIndex) || ($column > $this->endColumnIndex)) {
104
            throw new PhpSpreadsheetException("Column $column is out of range ({$this->startColumnIndex} - {$this->endColumnIndex})");
105
        } elseif ($this->onlyExistingCells && !($this->worksheet->cellExistsByColumnAndRow($column, $this->rowIndex))) {
106
            throw new PhpSpreadsheetException('In "IterateOnlyExistingCells" mode and Cell does not exist');
107
        }
108
        $this->currentColumnIndex = $column;
109
110
        return $this;
111
    }
112
113
    /**
114
     * Rewind the iterator to the starting column.