Code Duplication    Length = 5-7 lines in 3 locations

src/PhpSpreadsheet/Worksheet/PageSetup.php 1 location

@@ 678-684 (lines=7) @@
675
     */
676
    public function setPrintArea($value, $index = 0, $method = self::SETPRINTRANGE_OVERWRITE)
677
    {
678
        if (strpos($value, '!') !== false) {
679
            throw new PhpSpreadsheetException('Cell coordinate must not specify a worksheet.');
680
        } elseif (strpos($value, ':') === false) {
681
            throw new PhpSpreadsheetException('Cell coordinate must be a range of cells.');
682
        } elseif (strpos($value, '$') !== false) {
683
            throw new PhpSpreadsheetException('Cell coordinate must not be absolute.');
684
        }
685
        $value = strtoupper($value);
686
687
        if ($method == self::SETPRINTRANGE_OVERWRITE) {

src/PhpSpreadsheet/Worksheet/Worksheet.php 2 locations

@@ 1219-1223 (lines=5) @@
1216
        // Uppercase coordinate
1217
        $pCoordinate = strtoupper($pCoordinate);
1218
1219
        if (strpos($pCoordinate, ':') !== false || strpos($pCoordinate, ',') !== false) {
1220
            throw new Exception('Cell coordinate can not be a range of cells.');
1221
        } elseif (strpos($pCoordinate, '$') !== false) {
1222
            throw new Exception('Cell coordinate must not be absolute.');
1223
        }
1224
1225
        // Create new cell object, if required
1226
        return $createIfNotExists ? $this->createNewCell($pCoordinate) : null;
@@ 2344-2350 (lines=7) @@
2341
        // Uppercase coordinate
2342
        $pCellCoordinate = strtoupper($pCellCoordinate);
2343
2344
        if (strpos($pCellCoordinate, ':') !== false || strpos($pCellCoordinate, ',') !== false) {
2345
            throw new Exception('Cell coordinate string can not be a range of cells.');
2346
        } elseif (strpos($pCellCoordinate, '$') !== false) {
2347
            throw new Exception('Cell coordinate string must not be absolute.');
2348
        } elseif ($pCellCoordinate == '') {
2349
            throw new Exception('Cell coordinate can not be zero-length string.');
2350
        }
2351
2352
        // Check if we already have a comment for this cell.
2353
        if (isset($this->comments[$pCellCoordinate])) {