Code Duplication    Length = 11-12 lines in 2 locations

src/PhpSpreadsheet/Worksheet/ColumnCellIterator.php 1 location

@@ 119-129 (lines=11) @@
116
     *
117
     * @return ColumnCellIterator
118
     */
119
    public function seek($row = 1)
120
    {
121
        if (($row < $this->startRow) || ($row > $this->endRow)) {
122
            throw new \PhpOffice\PhpSpreadsheet\Exception("Row $row is out of range ({$this->startRow} - {$this->endRow})");
123
        } elseif ($this->onlyExistingCells && !($this->subject->cellExistsByColumnAndRow($this->columnIndex, $row))) {
124
            throw new \PhpOffice\PhpSpreadsheet\Exception('In "IterateOnlyExistingCells" mode and Cell does not exist');
125
        }
126
        $this->position = $row;
127
128
        return $this;
129
    }
130
131
    /**
132
     * Rewind the iterator to the starting row.

src/PhpSpreadsheet/Worksheet/RowCellIterator.php 1 location

@@ 121-132 (lines=12) @@
118
     *
119
     * @return RowCellIterator
120
     */
121
    public function seek($column = 'A')
122
    {
123
        $column = \PhpOffice\PhpSpreadsheet\Cell::columnIndexFromString($column) - 1;
124
        if (($column < $this->startColumn) || ($column > $this->endColumn)) {
125
            throw new \PhpOffice\PhpSpreadsheet\Exception("Column $column is out of range ({$this->startColumn} - {$this->endColumn})");
126
        } elseif ($this->onlyExistingCells && !($this->subject->cellExistsByColumnAndRow($column, $this->rowIndex))) {
127
            throw new \PhpOffice\PhpSpreadsheet\Exception('In "IterateOnlyExistingCells" mode and Cell does not exist');
128
        }
129
        $this->position = $column;
130
131
        return $this;
132
    }
133
134
    /**
135
     * Rewind the iterator to the starting column.