Code Duplication    Length = 6-8 lines in 3 locations

src/PhpSpreadsheet/Calculation/DateTime.php 3 locations

@@ 999-1004 (lines=6) @@
996
            if (is_string($holidayDate = self::getDateValue($holidayDate))) {
997
                return Functions::VALUE();
998
            }
999
            if (($holidayDate >= $startDate) && ($holidayDate <= $endDate)) {
1000
                if ((self::WEEKDAY($holidayDate, 2) < 6) && (!in_array($holidayDate, $holidayCountedArray))) {
1001
                    --$partWeekDays;
1002
                    $holidayCountedArray[] = $holidayDate;
1003
                }
1004
            }
1005
        }
1006
1007
        if ($sDate > $eDate) {
@@ 1093-1098 (lines=6) @@
1090
            }
1091
            foreach ($holidayDates as $holidayDate) {
1092
                if ($decrementing) {
1093
                    if (($holidayDate <= $startDate) && ($holidayDate >= $endDate)) {
1094
                        if (!in_array($holidayDate, $holidayCountedArray)) {
1095
                            --$endDate;
1096
                            $holidayCountedArray[] = $holidayDate;
1097
                        }
1098
                    }
1099
                } else {
1100
                    if (($holidayDate >= $startDate) && ($holidayDate <= $endDate)) {
1101
                        if (!in_array($holidayDate, $holidayCountedArray)) {
@@ 1099-1106 (lines=8) @@
1096
                            $holidayCountedArray[] = $holidayDate;
1097
                        }
1098
                    }
1099
                } else {
1100
                    if (($holidayDate >= $startDate) && ($holidayDate <= $endDate)) {
1101
                        if (!in_array($holidayDate, $holidayCountedArray)) {
1102
                            ++$endDate;
1103
                            $holidayCountedArray[] = $holidayDate;
1104
                        }
1105
                    }
1106
                }
1107
                //    Adjust the calculated end date if it falls over a weekend
1108
                $endDoW = self::WEEKDAY($endDate, 3);
1109
                if ($endDoW >= 5) {