generated from spatie/package-skeleton-php
-
-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add Tunisia Holidays * fix Tunisia Hijri Holidays * fix PHPStan error * sync latest commits * change Hijri Dates to generated Like in turkey holidays * minor fixes * minor fixes * fix phpstan error * fix phpstan error * implement turkey method as trait for Hijri holidays * minor fix * move tunisia translations to correct dir * Update src/Countries/Tunisia.php Co-authored-by: Niels Vanpachtenbeke <[email protected]> * Update src/Countries/Tunisia.php Co-authored-by: Niels Vanpachtenbeke <[email protected]> * Update tests/Countries/TunisiaTest.php Co-authored-by: Niels Vanpachtenbeke <[email protected]> * Update tests/Countries/TunisiaTest.php Co-authored-by: Niels Vanpachtenbeke <[email protected]> * remove HijriCalendar * Fix phpstan fail test * Fix phpstan Ternary operator condition is always true. * Fix code to use IslamicCalendar * Fix translation add Araft day fix totalDays for tunisia --------- Co-authored-by: ʍᴙ.ώoŁƒ <[email protected]> Co-authored-by: Niels Vanpachtenbeke <[email protected]>
- Loading branch information
1 parent
3f2f025
commit c081087
Showing
7 changed files
with
487 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"New Year's Day'": "رأس السنة الميلادية", | ||
"Independence Day": "عيد الاستقلال", | ||
"Martyrs' Day": "عيد الشهداء", | ||
"Labour Day": "عيد الشغل", | ||
"Republic Day": "عيد الجمهورية", | ||
"Women's Day": "عيد المرأة", | ||
"Evacuation Day": "عيد الجلاء", | ||
"Revolution and Youth Day": "عيد الثورة والشباب", | ||
"Eid al-Fitr": "عيد الفطر", | ||
"Eid al-Fitr Day 2": "عيد الفطر اليوم الثاني", | ||
"Eid al-Fitr Day 3": "عيد الفطر اليوم الثالث", | ||
"Eid al-Adha": "عيد الأضحى", | ||
"Eid al-Adha Day 2": "عيد الأضحى اليوم الثاني", | ||
"Eid al-Adha Day 3": "عيد الأضحى اليوم الثالث", | ||
"Eid al-Adha Day 4": "عيد الأضحى اليوم الرابع", | ||
"Islamic New Year": "رأس السنة الهجرية", | ||
"Birthday of the Prophet Muhammad": "المولد النبوي الشريف", | ||
"Arafat Day": "يوم عرفة (وقفة عيد الأضحى)", | ||
"Day": "يوم" | ||
} | ||
|
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,22 @@ | ||
{ | ||
"New Year's Day'": "New Year's Day", | ||
"Independence Day": "Independence Day", | ||
"Martyrs' Day": "Martyrs' Day", | ||
"Labour Day": "Labour Day", | ||
"Republic Day": "Republic Day", | ||
"Women's Day": "Women's Day", | ||
"Evacuation Day": "Evacuation Day", | ||
"Revolution and Youth Day": "Revolution and Youth Day", | ||
"Eid al-Fitr": "Eid al-Fitr day 1", | ||
"Eid al-Fitr Day 2": "Eid al-Fitr day 2", | ||
"Eid al-Fitr Day 3": "Eid al-Fitr day 3", | ||
"Eid al-Adha": "Eid al-Adha day 1", | ||
"Eid al-Adha Day 2": "Eid al-Adha day 2", | ||
"Eid al-Adha Day 3": "Eid al-Adha day 3", | ||
"Eid al-Adha Day 4": "Eid al-Adha day 4", | ||
"Islamic New Year": "Islamic new year", | ||
"Birthday of the Prophet Muhammad": "Birthday of the Prophet Mohamed", | ||
"Arafat Day": "Arafat Day", | ||
"Day": "Day" | ||
} | ||
|
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,22 @@ | ||
{ | ||
"New Year's Day'": "Jour de l'An", | ||
"Independence Day": "Fête de l'indépendance", | ||
"Martyrs' Day": "Fête des Martyrs", | ||
"Labour Day": "Fête du Travail", | ||
"Republic Day": "Fête de la République", | ||
"Women's Day": "Fête de la femme", | ||
"Evacuation Day": "Fête d'évacuation", | ||
"Revolution and Youth Day": "Fête de la Révolution et de la Jeunesse", | ||
"Eid al-Fitr": "Eid al-Fitr 1er jour", | ||
"Eid al-Fitr Day 2": "Eid al-Fitr 2e jour", | ||
"Eid al-Fitr Day 3": "Eid al-Fitr 3e jour", | ||
"Eid al-Adha": "Eid al-Adha", | ||
"Eid al-Adha Day 2": "Eid al-Adha", | ||
"Eid al-Adha Day 3": "Eid al-Adha", | ||
"Eid al-Adha Day 4": "Eid al-Adha", | ||
"Islamic New Year": "Nouvel an islamique", | ||
"Birthday of the Prophet Muhammad": "Anniversaire du prophète Mohamed", | ||
"Arafat Day": "Arafat Day", | ||
"Day": "Jour" | ||
} | ||
|
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,279 @@ | ||
<?php | ||
|
||
namespace Spatie\Holidays\Countries; | ||
|
||
use Spatie\Holidays\Calendars\IslamicCalendar; | ||
use Spatie\Holidays\Concerns\Translatable; | ||
use Spatie\Holidays\Contracts\HasTranslations; | ||
use Spatie\Holidays\Contracts\Islamic; | ||
|
||
class Tunisia extends Country implements HasTranslations, Islamic | ||
{ | ||
use IslamicCalendar; | ||
use Translatable; | ||
|
||
protected const eidAlFitr = [ | ||
2005 => '11-04', | ||
2006 => '10-24', | ||
2007 => '10-13', | ||
2008 => '10-02', | ||
2009 => '09-21', | ||
2010 => '09-10', | ||
2011 => '08-30', | ||
2012 => '08-19', | ||
2013 => '08-08', | ||
2014 => '07-28', | ||
2015 => '07-17', | ||
2016 => '07-07', | ||
2017 => '06-26', | ||
2018 => '06-15', | ||
2019 => '06-05', | ||
2020 => '05-24', | ||
2021 => '05-13', | ||
2022 => '05-02', | ||
2023 => '04-20', | ||
2024 => '04-10', | ||
2025 => '03-31', | ||
2026 => '03-21', | ||
2027 => '03-10', | ||
2028 => '02-27', | ||
2029 => '02-15', | ||
2030 => '02-04', | ||
2031 => '01-25', | ||
2032 => '01-15', | ||
2033 => '01-03', | ||
2034 => '12-13', | ||
2035 => '12-02', | ||
2036 => '11-20', | ||
2037 => '11-09', | ||
]; | ||
|
||
protected const arafat = [ | ||
2005 => '01-21', | ||
2006 => '01-10', | ||
2007 => '01-01', | ||
2008 => '12-09', | ||
2009 => '11-26', | ||
2010 => '11-15', | ||
2011 => '11-05', | ||
2012 => '10-25', | ||
2013 => '10-15', | ||
2014 => '10-04', | ||
2015 => '09-23', | ||
2016 => '09-11', | ||
2017 => '08-31', | ||
2018 => '08-20', | ||
2019 => '08-10', | ||
2020 => '07-30', | ||
2021 => '07-19', | ||
2022 => '07-09', | ||
2023 => '06-27', | ||
2024 => '06-16', | ||
2025 => '06-06', | ||
2026 => '05-26', | ||
2027 => '05-16', | ||
2028 => '05-05', | ||
2029 => '04-24', | ||
2030 => '04-13', | ||
2031 => '04-02', | ||
2032 => '03-21', | ||
2033 => '03-11', | ||
2034 => '03-01', | ||
2035 => '02-18', | ||
2036 => '02-07', | ||
2037 => '01-26', | ||
]; | ||
protected const eidAlAdha = [ | ||
2005 => '01-22', | ||
2006 => '01-11', | ||
2007 => '01-02', | ||
2008 => '12-10', | ||
2009 => '11-27', | ||
2010 => '11-16', | ||
2011 => '11-06', | ||
2012 => '10-26', | ||
2013 => '10-16', | ||
2014 => '10-05', | ||
2015 => '09-24', | ||
2016 => '09-12', | ||
2017 => '08-31', | ||
2018 => '08-21', | ||
2019 => '08-11', | ||
2020 => '07-31', | ||
2021 => '07-20', | ||
2022 => '07-09', | ||
2023 => '06-28', | ||
2024 => '06-17', | ||
2025 => '06-07', | ||
2026 => '05-27', | ||
2027 => '05-17', | ||
2028 => '05-06', | ||
2029 => '04-25', | ||
2030 => '04-14', | ||
2031 => '04-03', | ||
2032 => '03-22', | ||
2033 => '03-12', | ||
2034 => '03-02', | ||
2035 => '02-19', | ||
2036 => '02-08', | ||
2037 => '01-27', | ||
]; | ||
protected const islamicNewYear = [ | ||
2005 => '02-10', | ||
2006 => '01-31', | ||
2007 => '01-20', | ||
2008 => '01-10', | ||
2009 => '12-18', | ||
2010 => '12-07', | ||
2011 => '11-27', | ||
2012 => '11-15', | ||
2013 => '11-05', | ||
2014 => '10-25', | ||
2015 => '10-14', | ||
2016 => '10-03', | ||
2017 => '09-22', | ||
2018 => '09-11', | ||
2019 => '08-31', | ||
2020 => '08-20', | ||
2021 => '08-09', | ||
2022 => '07-30', | ||
2023 => '07-19', | ||
2024 => '07-08', | ||
2025 => '06-06', | ||
2026 => '06-17', | ||
2027 => '06-07', | ||
2028 => '05-26', | ||
2029 => '05-15', | ||
2030 => '05-05', | ||
2031 => '04-24', | ||
2032 => '04-12', | ||
2033 => '04-01', | ||
2034 => '03-22', | ||
2035 => '03-12', | ||
2036 => '02-29', | ||
2037 => '02-17', | ||
]; | ||
protected const ashura = [ | ||
2005 => '02-19', | ||
2006 => '02-09', | ||
2007 => '01-29', | ||
2008 => '01-19', | ||
2009 => '12-27', | ||
2010 => '12-16', | ||
2011 => '12-06', | ||
2012 => '11-25', | ||
2013 => '11-15', | ||
2014 => '11-04', | ||
2015 => '10-24', | ||
2016 => '10-13', | ||
2017 => '10-02', | ||
2018 => '09-21', | ||
2019 => '09-10', | ||
2020 => '08-30', | ||
2021 => '08-19', | ||
2022 => '08-08', | ||
2023 => '07-28', | ||
2024 => '07-17', | ||
2025 => '07-07', | ||
2026 => '06-26', | ||
2027 => '06-15', | ||
2028 => '06-04', | ||
2029 => '05-24', | ||
2030 => '05-13', | ||
2031 => '05-02', | ||
2032 => '04-20', | ||
2033 => '04-10', | ||
2034 => '03-30', | ||
2035 => '03-19', | ||
2036 => '03-08', | ||
2037 => '02-25', | ||
]; | ||
protected const prophetMuhammadBirthday = [ | ||
2005 => '04-21', | ||
2006 => '04-11', | ||
2007 => '03-31', | ||
2008 => '03-20', | ||
2009 => '03-09', | ||
2010 => '02-26', | ||
2011 => '02-16', | ||
2012 => '02-05', | ||
2013 => '01-24', | ||
2014 => '01-13', | ||
2015 => '12-23', | ||
2016 => '12-12', | ||
2017 => '12-01', | ||
2018 => '11-20', | ||
2019 => '11-09', | ||
2020 => '10-29', | ||
2021 => '10-21', | ||
2022 => '10-08', | ||
2023 => '09-28', | ||
2024 => '09-16', | ||
2025 => '09-06', | ||
2026 => '08-26', | ||
2027 => '08-15', | ||
2028 => '08-04', | ||
2029 => '07-25', | ||
2030 => '07-14', | ||
2031 => '07-03', | ||
2032 => '06-21', | ||
2033 => '06-10', | ||
2034 => '05-31', | ||
2035 => '05-21', | ||
2036 => '05-09', | ||
2037 => '04-29', | ||
]; | ||
|
||
/** | ||
* @return string | ||
*/ | ||
public function countryCode(): string | ||
{ | ||
return 'tn'; | ||
} | ||
|
||
public function defaultLocale(): string | ||
{ | ||
return 'en'; | ||
} | ||
|
||
protected function allHolidays(int $year): array | ||
{ | ||
$revolutionHoliday = []; | ||
|
||
if (2022 > $year && $year >= 2011) { | ||
$revolutionHoliday['Revolution and Youth Day'] = '01-14'; | ||
} | ||
|
||
if ($year >= 2022) { | ||
$revolutionHoliday['Revolution and Youth Day'] = '12-17'; | ||
} | ||
|
||
return array_merge([ | ||
'New Year\'s Day' => '01-01', | ||
'Independence Day' => '03-20', | ||
'Martyrs\' Day' => '04-09', | ||
'Labour Day' => '05-01', | ||
'Republic Day' => '07-25', | ||
'Women\'s Day' => '08-13', | ||
'Evacuation Day' => '10-15', | ||
], $revolutionHoliday, $this->islamicHolidays($year)); | ||
} | ||
|
||
public function islamicHolidays(int $year): array | ||
{ | ||
$eidAlFitr = $this->eidAlFitr(year: $year, totalDays: 2); | ||
$eidAlAdha = $this->eidAlAdha(year: $year, totalDays: 2); | ||
|
||
return array_merge( | ||
[ | ||
'Arafat Day' => $this->arafat($year), | ||
'Islamic New Year' => $this->islamicNewYear($year), | ||
'Birthday of the Prophet Muhammad' => $this->prophetMuhammadBirthday($year), | ||
], | ||
$this->convertPeriods(name: 'Eid al-Fitr', year: $year, period: $eidAlFitr[0]), | ||
$this->convertPeriods(name: 'Eid al-Adha', year: $year, period: $eidAlAdha[0]), | ||
); | ||
} | ||
|
||
} |
Oops, something went wrong.