Code Duplication    Length = 6-8 lines in 3 locations

src/PhpSpreadsheet/Calculation/DateTime.php 3 locations

@@ 981-986 (lines=6) @@
978
            if (is_string($holidayDate = self::getDateValue($holidayDate))) {
979
                return Functions::VALUE();
980
            }
981
            if (($holidayDate >= $startDate) && ($holidayDate <= $endDate)) {
982
                if ((self::WEEKDAY($holidayDate, 2) < 6) && (!in_array($holidayDate, $holidayCountedArray))) {
983
                    --$partWeekDays;
984
                    $holidayCountedArray[] = $holidayDate;
985
                }
986
            }
987
        }
988
989
        if ($sDate > $eDate) {
@@ 1075-1080 (lines=6) @@
1072
            }
1073
            foreach ($holidayDates as $holidayDate) {
1074
                if ($decrementing) {
1075
                    if (($holidayDate <= $startDate) && ($holidayDate >= $endDate)) {
1076
                        if (!in_array($holidayDate, $holidayCountedArray)) {
1077
                            --$endDate;
1078
                            $holidayCountedArray[] = $holidayDate;
1079
                        }
1080
                    }
1081
                } else {
1082
                    if (($holidayDate >= $startDate) && ($holidayDate <= $endDate)) {
1083
                        if (!in_array($holidayDate, $holidayCountedArray)) {
@@ 1081-1088 (lines=8) @@
1078
                            $holidayCountedArray[] = $holidayDate;
1079
                        }
1080
                    }
1081
                } else {
1082
                    if (($holidayDate >= $startDate) && ($holidayDate <= $endDate)) {
1083
                        if (!in_array($holidayDate, $holidayCountedArray)) {
1084
                            ++$endDate;
1085
                            $holidayCountedArray[] = $holidayDate;
1086
                        }
1087
                    }
1088
                }
1089
                //    Adjust the calculated end date if it falls over a weekend
1090
                $endDoW = self::WEEKDAY($endDate, 3);
1091
                if ($endDoW >= 5) {