Code Duplication    Length = 8-8 lines in 4 locations

src/PhpSpreadsheet/Calculation/DateTime.php 4 locations

@@ 325-332 (lines=8) @@
322
323
        // Execute function
324
        $excelDateValue = Date::formattedPHPToExcel($year, $month, $day);
325
        switch (Functions::getReturnDateType()) {
326
            case Functions::RETURNDATE_EXCEL:
327
                return (float) $excelDateValue;
328
            case Functions::RETURNDATE_PHP_NUMERIC:
329
                return (int) Date::excelToTimestamp($excelDateValue);
330
            case Functions::RETURNDATE_PHP_OBJECT:
331
                return Date::excelToDateTimeObject($excelDateValue);
332
        }
333
    }
334
335
    /**
@@ 1108-1115 (lines=8) @@
1105
            }
1106
        }
1107
1108
        switch (Functions::getReturnDateType()) {
1109
            case Functions::RETURNDATE_EXCEL:
1110
                return (float) $endDate;
1111
            case Functions::RETURNDATE_PHP_NUMERIC:
1112
                return (int) Date::excelToTimestamp($endDate);
1113
            case Functions::RETURNDATE_PHP_OBJECT:
1114
                return Date::excelToDateTimeObject($endDate);
1115
        }
1116
    }
1117
1118
    /**
@@ 1510-1517 (lines=8) @@
1507
        // Execute function
1508
        $PHPDateObject = self::adjustDateByMonths($dateValue, $adjustmentMonths);
1509
1510
        switch (Functions::getReturnDateType()) {
1511
            case Functions::RETURNDATE_EXCEL:
1512
                return (float) Date::PHPToExcel($PHPDateObject);
1513
            case Functions::RETURNDATE_PHP_NUMERIC:
1514
                return (int) Date::excelToTimestamp(Date::PHPToExcel($PHPDateObject));
1515
            case Functions::RETURNDATE_PHP_OBJECT:
1516
                return $PHPDateObject;
1517
        }
1518
    }
1519
1520
    /**
@@ 1559-1566 (lines=8) @@
1556
        $adjustDaysString = '-' . $adjustDays . ' days';
1557
        $PHPDateObject->modify($adjustDaysString);
1558
1559
        switch (Functions::getReturnDateType()) {
1560
            case Functions::RETURNDATE_EXCEL:
1561
                return (float) Date::PHPToExcel($PHPDateObject);
1562
            case Functions::RETURNDATE_PHP_NUMERIC:
1563
                return (int) Date::excelToTimestamp(Date::PHPToExcel($PHPDateObject));
1564
            case Functions::RETURNDATE_PHP_OBJECT:
1565
                return $PHPDateObject;
1566
        }
1567
    }
1568
}
1569