Total Complexity | 29 |
Total Lines | 160 |
Duplicated Lines | 0 % |
Coverage | 56.25% |
Changes | 0 |
1 | <?php |
||
12 | final class Month |
||
13 | { |
||
14 | /** |
||
15 | * @var int |
||
16 | */ |
||
17 | private $number; |
||
18 | |||
19 | /** |
||
20 | * @param int $number |
||
21 | */ |
||
22 | 22 | private function __construct(int $number) |
|
23 | { |
||
24 | 22 | $this->number = $number; |
|
25 | 22 | } |
|
26 | |||
27 | /** |
||
28 | * @return int |
||
29 | */ |
||
30 | 20 | public function number() |
|
31 | { |
||
32 | 20 | return $this->number; |
|
33 | } |
||
34 | |||
35 | /** |
||
36 | * @param Month $month |
||
37 | * @return bool |
||
38 | */ |
||
39 | 17 | public function equals(Month $month): bool |
|
40 | { |
||
41 | 17 | return $this->number === $month->number(); |
|
42 | } |
||
43 | |||
44 | /** |
||
45 | * @return Month |
||
46 | */ |
||
47 | final public static function january(): self |
||
48 | { |
||
49 | return new self(1); |
||
50 | } |
||
51 | |||
52 | /** |
||
53 | * @return Month |
||
54 | */ |
||
55 | final public static function february(): self |
||
56 | { |
||
57 | return new self(2); |
||
58 | } |
||
59 | |||
60 | /** |
||
61 | * @return Month |
||
62 | */ |
||
63 | final public static function march(): self |
||
64 | { |
||
65 | return new self(3); |
||
66 | } |
||
67 | |||
68 | /** |
||
69 | * @return Month |
||
70 | */ |
||
71 | 1 | final public static function april(): self |
|
72 | { |
||
73 | 1 | return new self(4); |
|
74 | } |
||
75 | |||
76 | /** |
||
77 | * @return Month |
||
78 | */ |
||
79 | final public static function may(): self |
||
80 | { |
||
81 | return new self(5); |
||
82 | } |
||
83 | |||
84 | /** |
||
85 | * @return Month |
||
86 | */ |
||
87 | final public static function june(): self |
||
88 | { |
||
89 | return new self(6); |
||
90 | } |
||
91 | |||
92 | /** |
||
93 | * @return Month |
||
94 | */ |
||
95 | final public static function july(): self |
||
96 | { |
||
97 | return new self(7); |
||
98 | } |
||
99 | |||
100 | /** |
||
101 | * @return Month |
||
102 | */ |
||
103 | final public static function august(): self |
||
104 | { |
||
105 | return new self(8); |
||
106 | } |
||
107 | |||
108 | /** |
||
109 | * @return Month |
||
110 | */ |
||
111 | final public static function september(): self |
||
112 | { |
||
113 | return new self(9); |
||
114 | } |
||
115 | |||
116 | /** |
||
117 | * @return Month |
||
118 | */ |
||
119 | final public static function october(): self |
||
120 | { |
||
121 | return new self(10); |
||
122 | } |
||
123 | |||
124 | /** |
||
125 | * @return Month |
||
126 | */ |
||
127 | 1 | final public static function november(): self |
|
128 | { |
||
129 | 1 | return new self(11); |
|
130 | } |
||
131 | |||
132 | /** |
||
133 | * @return Month |
||
134 | */ |
||
135 | final public static function december(): self |
||
136 | { |
||
137 | return new self(12); |
||
138 | } |
||
139 | |||
140 | /** |
||
141 | * @param DateTimeInterface $dateTime |
||
142 | * @return Month |
||
143 | */ |
||
144 | 10 | final public static function fromDateTime(DateTimeInterface $dateTime): self |
|
147 | } |
||
148 | |||
149 | /** |
||
150 | * @param int $number |
||
151 | * @return Month |
||
152 | */ |
||
153 | 22 | final public static function fromNumber(int $number): self |
|
154 | { |
||
155 | switch ($number) { |
||
172 | } |
||
173 | } |
||
174 |