MonthInYear::april()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Adlogix\EventScheduler\TemporalExpression;
6
7
use Adlogix\EventScheduler\ValueObject\Month;
8
use DateTimeInterface;
9
10
/**
11
 * @author Toni Van de Voorde <[email protected]>
12
 */
13
final class MonthInYear implements TemporalExpressionInterface
14
{
15
    /**
16
     * @var Month
17
     */
18
    protected $month;
19
20
    /**
21
     * @param Month $month
22
     */
23 2
    private function __construct(Month $month)
24
    {
25 2
        $this->month = $month;
26 2
    }
27
28
    /**
29
     * {@inheritdoc}
30
     */
31 2
    public function includes(DateTimeInterface $date): bool
32
    {
33 2
        return $this->month->equals(Month::fromDateTime($date));
34
    }
35
36
    /**
37
     * @return MonthInYear
38
     */
39
    public static function january(): self
40
    {
41
        return new self(Month::january());
42
    }
43
44
    /**
45
     * @return MonthInYear
46
     */
47
    public static function february(): self
48
    {
49
        return new self(Month::february());
50
    }
51
52
    /**
53
     * @return MonthInYear
54
     */
55
    public static function march(): self
56
    {
57
        return new self(Month::march());
58
    }
59
60
    /**
61
     * @return MonthInYear
62
     */
63 1
    public static function april(): self
64
    {
65 1
        return new self(Month::april());
66
    }
67
68
    /**
69
     * @return MonthInYear
70
     */
71
    public static function may(): self
72
    {
73
        return new self(Month::may());
74
    }
75
76
    /**
77
     * @return MonthInYear
78
     */
79
    public static function june(): self
80
    {
81
        return new self(Month::june());
82
    }
83
84
    /**
85
     * @return MonthInYear
86
     */
87
    public static function july(): self
88
    {
89
        return new self(Month::july());
90
    }
91
92
    /**
93
     * @return MonthInYear
94
     */
95
    public static function august(): self
96
    {
97
        return new self(Month::august());
98
    }
99
100
    /**
101
     * @return MonthInYear
102
     */
103
    public static function september(): self
104
    {
105
        return new self(Month::september());
106
    }
107
108
    /**
109
     * @return MonthInYear
110
     */
111
    public static function october(): self
112
    {
113
        return new self(Month::october());
114
    }
115
116
    /**
117
     * @return MonthInYear
118
     */
119 1
    public static function november(): self
120
    {
121 1
        return new self(Month::november());
122
    }
123
124
    /**
125
     * @return MonthInYear
126
     */
127
    public static function december(): self
128
    {
129
        return new self(Month::december());
130
    }
131
}
132