generated from spatie/package-skeleton-php
-
-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/main' into Ukraine
- Loading branch information
Showing
66 changed files
with
1,828 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,6 @@ trim_trailing_whitespace = false | |
|
||
[*.{yml,yaml}] | ||
indent_size = 2 | ||
|
||
[*.snap] | ||
insert_final_newline = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Contributing a new country ? | ||
|
||
* [ ] Have you checked to ensure there aren't other open [Pull Requests](https://github.com/spatie/holidays/pulls) for the same country? | ||
|
||
1. Create a new class in the Countries directory. It should extend the Country class. | ||
2. Add a test for the new country in the tests directory. | ||
3. Run the tests so a snapshot gets created. | ||
4. Verify the result in the newly created snapshot is correct. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
.php_cs | ||
.php_cs.cache | ||
.phpunit.cache | ||
.vscode | ||
build | ||
composer.lock | ||
coverage | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
namespace Spatie\Holidays\Countries; | ||
|
||
use Carbon\CarbonImmutable; | ||
|
||
class Bangladesh extends Country | ||
{ | ||
public function countryCode(): string | ||
{ | ||
return 'bd'; | ||
} | ||
|
||
protected function allHolidays(int $year): array | ||
{ | ||
return array_merge([ | ||
'International Mother Language Day' => '02-21', | ||
'Birthday of Sheikh Mujibur Rahman' => '03-17', | ||
'Independence Day' => '03-26', | ||
'Bengali New Year' => '04-14', | ||
'May Day' => '05-01', | ||
'National Mourning Day' => '08-15', | ||
'Victory Day' => '12-16', | ||
'Christmas Day' => '12-25', | ||
], $this->variableHolidays($year)); | ||
} | ||
|
||
/** @return array<string, CarbonImmutable> */ | ||
protected function variableHolidays(int $year): array | ||
{ | ||
// The variable holidays all follow the lunar calendar, so their dates are not confirmed. | ||
return []; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
namespace Spatie\Holidays\Countries; | ||
|
||
use Carbon\CarbonImmutable; | ||
|
||
class Bolivia extends Country | ||
{ | ||
public function countryCode(): string | ||
{ | ||
return 'bo'; | ||
} | ||
|
||
protected function allHolidays(int $year): array | ||
{ | ||
return array_merge([ | ||
'Día de Año Nuevo' => '01-01', | ||
'Día del Estado Plurinacional' => '01-22', | ||
'Día del Trabajador' => '05-01', | ||
'Año Nuevo Aymara' => '06-21', | ||
'Día de la Independencia' => '08-06', | ||
'Día de Todos los Santos' => '11-02', | ||
'Navidad' => '12-25', | ||
], $this->variableHolidays($year)); | ||
} | ||
|
||
/** @return array<string, CarbonImmutable> */ | ||
protected function variableHolidays(int $year): array | ||
{ | ||
$easter = $this->easter($year); | ||
|
||
return [ | ||
'Lunes de Carnaval' => $easter->subWeeks(6)->subDays(6), | ||
'Martes de Carnaval' => $easter->subWeeks(6)->subDays(5), | ||
'Viernes Santo' => $easter->subDays(2), | ||
'Corpus Christi' => $easter->addWeeks(8)->addDays(4), | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
namespace Spatie\Holidays\Countries; | ||
|
||
use Carbon\CarbonImmutable; | ||
|
||
class Croatia extends Country | ||
{ | ||
public function countryCode(): string | ||
{ | ||
return 'hr'; | ||
} | ||
|
||
protected function allHolidays(int $year): array | ||
{ | ||
return array_merge([ | ||
'Nova godina' => '01-01', | ||
'Bogojavljenje' => '01-06', | ||
'Praznik rada' => '05-01', | ||
'Dan državnosti' => '05-30', | ||
'Dan antifašističke borbe' => '06-22', | ||
'Dan pobjede i domovinske zahvalnosti i Dan hrvatskih branitelja' => '08-05', | ||
'Velika Gospa' => '08-15', | ||
'Svi sveti' => '11-01', | ||
'Dan sjećanja na žrtve Domovinskog rata i Dan sjećanja na žrtvu Vukovara i Škabrnje' => '11-18', | ||
'Božić' => '12-25', | ||
'Sveti Stjepan' => '12-26', | ||
], $this->variableHolidays($year)); | ||
} | ||
|
||
/** @return array<string, CarbonImmutable> */ | ||
protected function variableHolidays(int $year): array | ||
{ | ||
$easter = $this->easter($year); | ||
|
||
return [ | ||
'Uskrsni ponedjeljak' => $easter->addDay(), | ||
'Tijelovo' => $easter->addDays(60), | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
namespace Spatie\Holidays\Countries; | ||
|
||
use Carbon\CarbonImmutable; | ||
|
||
class Czechia extends Country | ||
{ | ||
public function countryCode(): string | ||
{ | ||
return 'cz'; | ||
} | ||
|
||
protected function allHolidays(int $year): array | ||
{ | ||
return array_merge([ | ||
'Den obnovy samostatného českého státu' => '01-01', | ||
'Svátek práce' => '05-01', | ||
'Den vítězství' => '05-08', | ||
'Den slovanských věrozvěstů Cyrila a Metoděje' => '07-05', | ||
'Den upálení mistra Jana Husa' => '07-06', | ||
'Den české státnosti' => '09-28', | ||
'Den vzniku samostatného československého státu' => '10-28', | ||
'Den boje za svobodu a demokracii a Mezinárodní den studentstva' => '11-17', | ||
'Štědrý den' => '12-24', | ||
'1. svátek vánoční' => '12-25', | ||
'2. svátek vánoční' => '12-26', | ||
], $this->variableHolidays($year)); | ||
} | ||
|
||
/** @return array<string, CarbonImmutable> */ | ||
protected function variableHolidays(int $year): array | ||
{ | ||
$easter = $this->easter($year); | ||
|
||
return [ | ||
'Velikonoční pondělí' => $easter->addDay(), | ||
'Velký pátek' => $easter->subDays(2), | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.