Code Duplication    Length = 5-7 lines in 3 locations

src/PhpSpreadsheet/Worksheet/PageSetup.php 1 location

@@ 698-704 (lines=7) @@
695
     */
696
    public function setPrintArea($value, $index = 0, $method = self::SETPRINTRANGE_OVERWRITE)
697
    {
698
        if (strpos($value, '!') !== false) {
699
            throw new PhpSpreadsheetException('Cell coordinate must not specify a worksheet.');
700
        } elseif (strpos($value, ':') === false) {
701
            throw new PhpSpreadsheetException('Cell coordinate must be a range of cells.');
702
        } elseif (strpos($value, '$') !== false) {
703
            throw new PhpSpreadsheetException('Cell coordinate must not be absolute.');
704
        }
705
        $value = strtoupper($value);
706
707
        if ($method == self::SETPRINTRANGE_OVERWRITE) {

src/PhpSpreadsheet/Worksheet.php 2 locations

@@ 1215-1219 (lines=5) @@
1212
        // Uppercase coordinate
1213
        $pCoordinate = strtoupper($pCoordinate);
1214
1215
        if (strpos($pCoordinate, ':') !== false || strpos($pCoordinate, ',') !== false) {
1216
            throw new Exception('Cell coordinate can not be a range of cells.');
1217
        } elseif (strpos($pCoordinate, '$') !== false) {
1218
            throw new Exception('Cell coordinate must not be absolute.');
1219
        }
1220
1221
        // Create new cell object, if required
1222
        return $createIfNotExists ? $this->createNewCell($pCoordinate) : null;
@@ 2331-2337 (lines=7) @@
2328
        // Uppercase coordinate
2329
        $pCellCoordinate = strtoupper($pCellCoordinate);
2330
2331
        if (strpos($pCellCoordinate, ':') !== false || strpos($pCellCoordinate, ',') !== false) {
2332
            throw new Exception('Cell coordinate string can not be a range of cells.');
2333
        } elseif (strpos($pCellCoordinate, '$') !== false) {
2334
            throw new Exception('Cell coordinate string must not be absolute.');
2335
        } elseif ($pCellCoordinate == '') {
2336
            throw new Exception('Cell coordinate can not be zero-length string.');
2337
        }
2338
2339
        // Check if we already have a comment for this cell.
2340
        if (isset($this->comments[$pCellCoordinate])) {