Code Duplication    Length = 5-7 lines in 3 locations

src/PhpSpreadsheet/Worksheet/PageSetup.php 1 location

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

src/PhpSpreadsheet/Worksheet.php 2 locations

@@ 1229-1233 (lines=5) @@
1226
        // Uppercase coordinate
1227
        $pCoordinate = strtoupper($pCoordinate);
1228
1229
        if (strpos($pCoordinate, ':') !== false || strpos($pCoordinate, ',') !== false) {
1230
            throw new Exception('Cell coordinate can not be a range of cells.');
1231
        } elseif (strpos($pCoordinate, '$') !== false) {
1232
            throw new Exception('Cell coordinate must not be absolute.');
1233
        }
1234
1235
        // Create new cell object, if required
1236
        return $createIfNotExists ? $this->createNewCell($pCoordinate) : null;
@@ 2347-2353 (lines=7) @@
2344
        // Uppercase coordinate
2345
        $pCellCoordinate = strtoupper($pCellCoordinate);
2346
2347
        if (strpos($pCellCoordinate, ':') !== false || strpos($pCellCoordinate, ',') !== false) {
2348
            throw new Exception('Cell coordinate string can not be a range of cells.');
2349
        } elseif (strpos($pCellCoordinate, '$') !== false) {
2350
            throw new Exception('Cell coordinate string must not be absolute.');
2351
        } elseif ($pCellCoordinate == '') {
2352
            throw new Exception('Cell coordinate can not be zero-length string.');
2353
        }
2354
2355
        // Check if we already have a comment for this cell.
2356
        if (isset($this->comments[$pCellCoordinate])) {