Code Duplication    Length = 5-7 lines in 3 locations

src/PhpSpreadsheet/Worksheet.php 2 locations

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

src/PhpSpreadsheet/Worksheet/PageSetup.php 1 location

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