Code Duplication    Length = 11-12 lines in 2 locations

src/PhpSpreadsheet/Worksheet/ColumnCellIterator.php 1 location

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

src/PhpSpreadsheet/Worksheet/RowCellIterator.php 1 location

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