|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the Holiday Library. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Michał Mańko <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE.md |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace Michalmanko\Holiday\Provider; |
|
13
|
|
|
|
|
14
|
|
|
use ArrayObject; |
|
15
|
|
|
use Michalmanko\Holiday\Holiday; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* German Holidays Provider (only contains nationwide holiday). |
|
19
|
|
|
* |
|
20
|
|
|
* @author ottowayne <[email protected]> |
|
21
|
|
|
*/ |
|
22
|
|
|
class Germany extends AbstractProvider |
|
23
|
|
|
{ |
|
24
|
|
|
/** |
|
25
|
|
|
* {@inheritdoc} |
|
26
|
|
|
*/ |
|
27
|
195 |
|
protected function prepareHolidays($year) |
|
28
|
|
|
{ |
|
29
|
195 |
|
$data = new ArrayObject(); |
|
30
|
|
|
|
|
31
|
|
|
// New Year's Day |
|
32
|
195 |
|
$data->append($this->createHoliday( |
|
33
|
195 |
|
'Neujahr', |
|
34
|
195 |
|
$year . '-01-01', |
|
35
|
|
|
Holiday::TYPE_HOLIDAY |
|
36
|
195 |
|
)); |
|
37
|
|
|
|
|
38
|
|
|
// Epiphany (BW, BY, ST) |
|
39
|
|
|
|
|
40
|
|
|
// Good Friday |
|
41
|
195 |
|
$goodFriday = $this->createHoliday( |
|
42
|
195 |
|
'Karfreitag', |
|
43
|
195 |
|
$this->getEaster($year), |
|
44
|
|
|
Holiday::TYPE_HOLIDAY |
|
45
|
195 |
|
); |
|
46
|
195 |
|
$goodFriday->modify('-2 days'); |
|
47
|
195 |
|
$data->append($goodFriday); |
|
48
|
|
|
|
|
49
|
|
|
// Easter Sunday (BB, HE) |
|
50
|
|
|
|
|
51
|
|
|
// Easter Monday |
|
52
|
195 |
|
$easterMonday = $this->createHoliday( |
|
53
|
195 |
|
'Ostermontag', |
|
54
|
195 |
|
$this->getEaster($year), |
|
55
|
|
|
Holiday::TYPE_HOLIDAY |
|
56
|
195 |
|
); |
|
57
|
195 |
|
$easterMonday->modify('+1 day'); |
|
58
|
195 |
|
$data->append($easterMonday); |
|
59
|
|
|
|
|
60
|
|
|
// Labour Day |
|
61
|
195 |
|
$data->append($this->createHoliday( |
|
62
|
195 |
|
'Erster Mai', |
|
63
|
195 |
|
$year . '-05-01', |
|
64
|
|
|
Holiday::TYPE_HOLIDAY |
|
65
|
195 |
|
)); |
|
66
|
|
|
|
|
67
|
|
|
// Feast of the Ascension |
|
68
|
195 |
|
$feastOfTheAscension = $this->createHoliday( |
|
69
|
195 |
|
'Christi Himmelfahrt', |
|
70
|
195 |
|
$this->getEaster($year), |
|
71
|
|
|
Holiday::TYPE_HOLIDAY |
|
72
|
195 |
|
); |
|
73
|
195 |
|
$feastOfTheAscension->modify('+39 day'); |
|
74
|
195 |
|
$data->append($feastOfTheAscension); |
|
75
|
|
|
|
|
76
|
|
|
// Pentecost Sunday (BB, HE) |
|
77
|
|
|
|
|
78
|
|
|
// Pentecost Monday |
|
79
|
195 |
|
$pentecostMonday = $this->createHoliday( |
|
80
|
195 |
|
'Pfingstmontag', |
|
81
|
195 |
|
$this->getEaster($year), |
|
82
|
|
|
Holiday::TYPE_HOLIDAY |
|
83
|
195 |
|
); |
|
84
|
195 |
|
$pentecostMonday->modify('+50 days'); |
|
85
|
195 |
|
$data->append($pentecostMonday); |
|
86
|
|
|
|
|
87
|
|
|
// Corpus Christi (BW, BY, HE, NW, RP, SL) |
|
88
|
|
|
|
|
89
|
|
|
// Assumption of the Blessed Virgin Mary (SL) |
|
90
|
|
|
|
|
91
|
|
|
// Day of German Unity |
|
92
|
195 |
|
$data->append($this->createHoliday( |
|
93
|
195 |
|
'Tag der Deutschen Einheit', |
|
94
|
195 |
|
$year . '-10-03', |
|
95
|
|
|
Holiday::TYPE_HOLIDAY |
|
96
|
195 |
|
)); |
|
97
|
|
|
|
|
98
|
|
|
// Reformation Day (BB, MV, SN, ST, SH, TH) |
|
99
|
|
|
// only in the year 2017 is this a nationwide holiday |
|
100
|
|
|
// source: https://de.wikipedia.org/wiki/Gesetzliche_Feiertage_in_Deutschland#cite_note-reform2-13 |
|
101
|
195 |
|
if ($year == 2017) { |
|
102
|
17 |
|
$data->append($this->getHolidayReformationDay($year)); |
|
103
|
17 |
|
} |
|
104
|
|
|
|
|
105
|
|
|
// All Saints' Day (BW, BY, NW, RP, SL) |
|
106
|
|
|
|
|
107
|
|
|
// Buß- und Bettag (has no English translation, wednesday before the 23.11) (SN) |
|
108
|
|
|
|
|
109
|
|
|
// Christmas Day |
|
110
|
195 |
|
$data->append($this->createHoliday( |
|
111
|
195 |
|
'1. Weihnachtstag', |
|
112
|
195 |
|
$year . '-12-25', |
|
113
|
|
|
Holiday::TYPE_HOLIDAY |
|
114
|
195 |
|
)); |
|
115
|
|
|
|
|
116
|
|
|
// Boxing Day |
|
117
|
195 |
|
$data->append($this->createHoliday( |
|
118
|
195 |
|
'2. Weihnachtstag', |
|
119
|
195 |
|
$year . '-12-26', |
|
120
|
|
|
Holiday::TYPE_HOLIDAY |
|
121
|
195 |
|
)); |
|
122
|
|
|
|
|
123
|
195 |
|
return $data->getArrayCopy(); |
|
124
|
|
|
} |
|
125
|
|
|
|
|
126
|
|
|
/** |
|
127
|
|
|
* Returns Holiday instance for Pentecost Sunday of the given year |
|
128
|
|
|
* @param $year |
|
129
|
|
|
* @return Holiday |
|
130
|
|
|
*/ |
|
131
|
26 |
|
public function getHolidayPentecostSunday($year) |
|
132
|
|
|
{ |
|
133
|
26 |
|
$pentecost = $this->createHoliday('Pfingstsonntag', $this->getEaster($year), Holiday::TYPE_HOLIDAY); |
|
134
|
26 |
|
$pentecost->modify('+49 days'); |
|
135
|
26 |
|
return $pentecost; |
|
136
|
|
|
|
|
137
|
|
|
} |
|
138
|
|
|
|
|
139
|
|
|
/** |
|
140
|
|
|
* Returns Holiday instance for Epiphany day of the given year |
|
141
|
|
|
* @param $year |
|
142
|
|
|
* @return Holiday |
|
143
|
|
|
*/ |
|
144
|
38 |
|
public function getHolidayEpiphany($year) |
|
145
|
|
|
{ |
|
146
|
38 |
|
return $this->createHoliday('Heilige Drei Könige', $year . '-01-06', Holiday::TYPE_HOLIDAY); |
|
147
|
|
|
} |
|
148
|
|
|
|
|
149
|
|
|
/** |
|
150
|
|
|
* Returns Holiday instance for Easter Sunday of the given year |
|
151
|
|
|
* @param $year |
|
152
|
|
|
* @return Holiday |
|
153
|
|
|
*/ |
|
154
|
26 |
|
public function getHolidayEasterSunday($year) |
|
155
|
|
|
{ |
|
156
|
26 |
|
return $this->createHoliday('Ostersonntag', $this->getEaster($year), Holiday::TYPE_HOLIDAY); |
|
157
|
|
|
} |
|
158
|
|
|
|
|
159
|
|
|
/** |
|
160
|
|
|
* Returns Holiday instance for Corpus Christi day of the given year |
|
161
|
|
|
* @param $year |
|
162
|
|
|
* @return Holiday |
|
163
|
|
|
*/ |
|
164
|
76 |
|
public function getHolidayCorpusChristi($year) |
|
165
|
|
|
{ |
|
166
|
76 |
|
$corpusChristi = $this->createHoliday('Fronleichnam', $this->getEaster($year), Holiday::TYPE_HOLIDAY); |
|
167
|
76 |
|
$corpusChristi->modify('+60 days'); |
|
168
|
76 |
|
return $corpusChristi; |
|
169
|
|
|
} |
|
170
|
|
|
|
|
171
|
|
|
/** |
|
172
|
|
|
* Returns Holiday instance for Assumption Of The Blessed Virgin Mary day of the given year |
|
173
|
|
|
* @param $year |
|
174
|
|
|
* @return Holiday |
|
175
|
|
|
*/ |
|
176
|
13 |
|
public function getHolidayAssumptionOfTheBlessedVirginMary($year) |
|
177
|
|
|
{ |
|
178
|
13 |
|
return $this->createHoliday('Mariä Himmelfahrt', $year . '-08-15', Holiday::TYPE_HOLIDAY); |
|
179
|
|
|
} |
|
180
|
|
|
|
|
181
|
|
|
/** |
|
182
|
|
|
* Be careful not to add this holiday to states in the year 2017 (nationwide holiday in 2017 only) |
|
183
|
|
|
* @param $year |
|
184
|
|
|
* @return Holiday |
|
185
|
|
|
*/ |
|
186
|
71 |
|
public function getHolidayReformationDay($year) |
|
187
|
|
|
{ |
|
188
|
71 |
|
return $this->createHoliday('Reformationstag', $year . '-10-31', Holiday::TYPE_HOLIDAY); |
|
189
|
|
|
} |
|
190
|
|
|
|
|
191
|
|
|
/** |
|
192
|
|
|
* Returns Holiday instance for All Saints Day of the given year |
|
193
|
|
|
* @param $year |
|
194
|
|
|
* @return Holiday |
|
195
|
|
|
*/ |
|
196
|
63 |
|
public function getHolidayAllSaintsDay($year) |
|
197
|
|
|
{ |
|
198
|
63 |
|
return $this->createHoliday('Allerheiligen', $year . '-11-01', Holiday::TYPE_HOLIDAY); |
|
199
|
|
|
} |
|
200
|
|
|
|
|
201
|
|
|
/** |
|
202
|
|
|
* Returns Holiday instance for "Buß Und Bett Tag" of the given year |
|
203
|
|
|
* @param $year |
|
204
|
|
|
* @return Holiday |
|
205
|
|
|
*/ |
|
206
|
12 |
|
public function getHolidayBuszUndBettTag($year) |
|
207
|
|
|
{ |
|
208
|
|
|
// wednesday before 23-11-yyyy |
|
209
|
12 |
|
$date = date('Y-m-d',strtotime('-1 Wednesday', strtotime($year . '-11-23'))); |
|
210
|
12 |
|
return $this->createHoliday('Buß- und Bettag', $date, Holiday::TYPE_HOLIDAY); |
|
211
|
|
|
} |
|
212
|
|
|
} |