Code Duplication    Length = 13-13 lines in 2 locations

Schedule/ScheduleDate.php 2 locations

@@ 38-50 (lines=13) @@
35
    }
36
37
38
    public static function createWeekend(): ScheduleDate
39
    {
40
        $datetime = new \DateTimeImmutable('now');
41
        $day = (int)$datetime->format('N');
42
43
        if ($day !== 7) {
44
            $datetime = $datetime->add(
45
                new \DateInterval(
46
                    sprintf('P%sD', 7 - $day)
47
                ));
48
        }
49
        return new ScheduleDate($datetime);
50
    }
51
52
53
    public static function createWorkday(): ScheduleDate
@@ 53-65 (lines=13) @@
50
    }
51
52
53
    public static function createWorkday(): ScheduleDate
54
    {
55
        $datetime = new \DateTimeImmutable('now');
56
        $day = (int)$datetime->format('N');
57
58
        if ($day > 5) {
59
            $datetime = $datetime->sub(
60
                new \DateInterval(
61
                    sprintf('P2D')
62
                ));
63
        }
64
        return new ScheduleDate($datetime);
65
    }
66
67
68
    /**