Code Duplication    Length = 8-8 lines in 3 locations

src/Period.php 3 locations

@@ 22-29 (lines=8) @@
19
        return new static($startDate, $endDate);
20
    }
21
22
    public static function days(int $numberOfDays): self
23
    {
24
        $endDate = Carbon::today();
25
26
        $startDate = Carbon::today()->subDays($numberOfDays)->startOfDay();
27
28
        return new static($startDate, $endDate);
29
    }
30
31
    public static function months(int $numberOfMonths): self
32
    {
@@ 31-38 (lines=8) @@
28
        return new static($startDate, $endDate);
29
    }
30
31
    public static function months(int $numberOfMonths): self
32
    {
33
        $endDate = Carbon::today();
34
35
        $startDate = Carbon::today()->subMonths($numberOfMonths)->startOfDay();
36
37
        return new static($startDate, $endDate);
38
    }
39
40
    public static function years(int $numberOfYears): self
41
    {
@@ 40-47 (lines=8) @@
37
        return new static($startDate, $endDate);
38
    }
39
40
    public static function years(int $numberOfYears): self
41
    {
42
        $endDate = Carbon::today();
43
44
        $startDate = Carbon::today()->subYears($numberOfYears)->startOfDay();
45
46
        return new static($startDate, $endDate);
47
    }
48
49
    public function __construct(DateTime $startDate, DateTime $endDate)
50
    {