├── .cliffignore ├── .editorconfig ├── phpstan.neon.dist ├── src └── Yasumi │ ├── data │ └── translations │ │ ├── matariki.php │ │ ├── anzacDay.php │ │ ├── australiaDay.php │ │ ├── waitangiDay.php │ │ ├── canadaDay.php │ │ ├── familyDay.php │ │ ├── heritageDay.php │ │ ├── portugalDay.php │ │ ├── victoriaDay.php │ │ ├── civicHoliday.php │ │ ├── discoveryDay.php │ │ ├── islanderDay.php │ │ ├── louisRielDay.php │ │ ├── natalHoliday.php │ │ ├── stAndrewsDay.php │ │ ├── stDavidsDay.php │ │ ├── stRupertsDay.php │ │ ├── terryFoxDay.php │ │ ├── thanksgivingDay.php │ │ ├── carnationRevolutionDay.php │ │ ├── orangemensDay.php │ │ ├── stFloriansDay.php │ │ ├── stLeopoldsDay.php │ │ ├── walpurgisEve.php │ │ ├── worldAnimalDay.php │ │ ├── dayOfLiberation.php │ │ ├── plebisciteDay.php │ │ ├── saskatchewanDay.php │ │ ├── dayOfReformation.php │ │ ├── goldCupParadeDay.php │ │ ├── winterTime.php │ │ ├── allSoulsDay.php │ │ ├── yukonHeritageDay.php │ │ ├── stJohnsEve.php │ │ ├── stMartinsDay.php │ │ ├── statehoodDay.php │ │ ├── epiphanyEve.php │ │ ├── secondNewYearsDay.php │ │ ├── allSaintsEve.php │ │ ├── annunciation.php │ │ ├── nationalPatriotsDay.php │ │ ├── reformationDay.php │ │ ├── saintJeanBaptisteDay.php │ │ ├── remembranceDay.php │ │ ├── summerTime.php │ │ ├── preserenDay.php │ │ ├── restorationOfIndepence.php │ │ ├── independenceDay.php │ │ ├── novaScotiaHeritageDay.php │ │ ├── dayAfterNewYearsDay.php │ │ ├── uprisingAgainstOccupation.php │ │ ├── nationalIndigenousPeoplesDay.php │ │ ├── portugueseRepublicDay.php │ │ ├── truthAndReconciliationDay.php │ │ ├── armisticeDay.php │ │ ├── victoryInEuropeDay.php │ │ ├── newYearsEve.php │ │ ├── stJosephsDay.php │ │ ├── maundyThursday.php │ │ ├── stGeorgesDay.php │ │ ├── substituteHoliday.php │ │ ├── queensBirthday.php │ │ ├── internationalWomensDay.php │ │ ├── corpusChristi.php │ │ ├── labourDay.php │ │ ├── ashWednesday.php │ │ ├── stStephensDay.php │ │ ├── fathersDay.php │ │ ├── immaculateConception.php │ │ ├── stJohnsDay.php │ │ ├── valentinesDay.php │ │ ├── mothersDay.php │ │ ├── pentecostMonday.php │ │ ├── ascensionDay.php │ │ ├── epiphany.php │ │ ├── christmasEve.php │ │ ├── pentecost.php │ │ ├── assumptionOfMary.php │ │ ├── allSaintsDay.php │ │ ├── goodFriday.php │ │ ├── easter.php │ │ ├── easterMonday.php │ │ ├── secondChristmasDay.php │ │ ├── christmasDay.php │ │ ├── newYearsDay.php │ │ └── internationalWorkersDay.php │ ├── Exception │ ├── Exception.php │ ├── UnknownLocaleException.php │ ├── InvalidYearException.php │ ├── ProviderNotFoundException.php │ └── MissingTranslationException.php │ ├── Filters │ ├── BankHolidaysFilter.php │ ├── OfficialHolidaysFilter.php │ ├── OtherHolidaysFilter.php │ ├── SeasonalHolidaysFilter.php │ ├── ObservedHolidaysFilter.php │ ├── AbstractFilter.php │ ├── OnFilter.php │ └── BetweenFilter.php │ ├── Provider │ ├── DateTimeZoneFactory.php │ ├── Austria │ │ ├── Vienna.php │ │ ├── LowerAustria.php │ │ ├── Styria.php │ │ ├── Tyrol.php │ │ ├── Burgenland.php │ │ ├── Vorarlberg.php │ │ ├── Carinthia.php │ │ └── Salzburg.php │ ├── Canada │ │ ├── Ontario.php │ │ ├── NewBrunswick.php │ │ ├── BritishColumbia.php │ │ ├── NorthwestTerritories.php │ │ ├── Alberta.php │ │ ├── Saskatchewan.php │ │ └── Nunavut.php │ ├── UnitedKingdom │ │ ├── England.php │ │ └── Wales.php │ ├── Switzerland │ │ ├── Aargau.php │ │ ├── Solothurn.php │ │ ├── Grisons.php │ │ ├── Vaud.php │ │ ├── AppenzellAusserrhoden.php │ │ ├── Bern.php │ │ ├── StGallen.php │ │ ├── BaselStadt.php │ │ ├── Valais.php │ │ ├── BaselLandschaft.php │ │ ├── Thurgau.php │ │ ├── Schaffhausen.php │ │ └── Zurich.php │ ├── Germany │ │ ├── RhinelandPalatinate.php │ │ ├── BadenWurttemberg.php │ │ ├── Bavaria.php │ │ ├── Hesse.php │ │ ├── Saarland.php │ │ ├── NorthRhineWestphalia.php │ │ ├── SchleswigHolstein.php │ │ ├── Bremen.php │ │ ├── SaxonyAnhalt.php │ │ └── LowerSaxony.php │ ├── France │ │ ├── BasRhin.php │ │ ├── HautRhin.php │ │ └── Moselle.php │ ├── Spain │ │ ├── Navarre.php │ │ ├── Melilla.php │ │ └── Aragon.php │ └── Australia │ │ └── Tasmania │ │ ├── Northwest.php │ │ ├── Northwest │ │ └── CircularHead.php │ │ ├── South.php │ │ ├── Northeast.php │ │ ├── FlindersIsland.php │ │ ├── KingIsland.php │ │ ├── South │ │ └── Southeast.php │ │ └── CentralNorth.php │ └── TranslationsInterface.php ├── .php-cs-fixer.php ├── examples ├── filters.php ├── between_filter.php ├── basic.php └── custom_provider.php ├── rector.php ├── LICENSE ├── DCO ├── SECURITY.md └── composer.json /.cliffignore: -------------------------------------------------------------------------------- 1 | # skip commits by their SHA1 2 | 3 | # 2.8.0 release 4 | 074fe08b5e48cea705943f5d77d0fc8956aa3be8 5 | 4049db27e2dc197865aa857531d6baaa4e76be04 6 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | indent_size = 4 7 | indent_style = space 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.json] 12 | indent_size = 2 13 | 14 | [*.{yml,yaml}] 15 | indent_size = 2 16 | -------------------------------------------------------------------------------- /phpstan.neon.dist: -------------------------------------------------------------------------------- 1 | parameters: 2 | level: 6 3 | paths: 4 | - src 5 | - examples 6 | ignoreErrors: 7 | - 8 | message: '#Comparison operation "<=" between [0-9]+ and int<[0-9]+, max> is always true.#' 9 | path: src/Yasumi/Provider/Turkey.php 10 | - 11 | identifier: missingType.generics 12 | reportUnmatchedIgnoredErrors: true # Do not allow outdated errors in the baseline 13 | treatPhpDocTypesAsCertain: false 14 | tipsOfTheDay: false 15 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/matariki.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Matariki 19 | return [ 20 | 'en' => 'Matariki', 21 | ]; 22 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/anzacDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for ANZAC Day 19 | return [ 20 | 'en' => 'ANZAC Day', 21 | ]; 22 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/australiaDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Australia Day 19 | return [ 20 | 'en' => 'Australia Day', 21 | ]; 22 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/waitangiDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Waitangi Day 19 | return [ 20 | 'en' => 'Waitangi Day', 21 | ]; 22 | -------------------------------------------------------------------------------- /src/Yasumi/Exception/Exception.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Exception; 19 | 20 | /** 21 | * Interface Exception. 22 | */ 23 | interface Exception 24 | { 25 | } 26 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/canadaDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Canada Day 19 | return [ 20 | 'en' => 'Canada Day', 21 | 'fr' => 'Fête du Canada', 22 | ]; 23 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/familyDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Family Day 19 | return [ 20 | 'en' => 'Family Day', 21 | 'fr' => 'Fête de la famille', 22 | ]; 23 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/heritageDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Heritage Day 19 | return [ 20 | 'en' => 'Heritage Day', 21 | 'fr' => 'Fête du patrimoine', 22 | ]; 23 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/portugalDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Portugal Day 19 | return [ 20 | 'en' => 'Portugal Day', 21 | 'pt' => 'Dia de Portugal', 22 | ]; 23 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/victoriaDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Victoria Day 19 | return [ 20 | 'en' => 'Victoria Day', 21 | 'fr' => 'Fête de la Reine', 22 | ]; 23 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/civicHoliday.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Civic Holiday 19 | return [ 20 | 'en' => 'Civic Holiday', 21 | 'fr' => 'Premier lundi d’août', 22 | ]; 23 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/discoveryDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Discovery Day 19 | return [ 20 | 'en' => 'Discovery Day', 21 | 'fr' => 'Journée découverte', 22 | ]; 23 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/islanderDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Islander Day 19 | return [ 20 | 'en' => 'Islander Day', 21 | 'fr' => 'Fête des Insulaires', 22 | ]; 23 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/louisRielDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Louis Riel Day 19 | return [ 20 | 'en' => 'Louis Riel Day', 21 | 'fr' => 'Journée Louis Riel', 22 | ]; 23 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/natalHoliday.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Natal Holiday 19 | return [ 20 | 'en' => 'Natal Holiday', 21 | 'fr' => 'Jour de la Fondation', 22 | ]; 23 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/stAndrewsDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for St. Andrew's Day 19 | return [ 20 | 'en' => 'St. Andrew’s Day', 21 | 'ro' => 'Sfântul Andrei', 22 | ]; 23 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/stDavidsDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for St. David's Day 19 | return [ 20 | 'cy' => 'Dydd Gŵyl Dewi', 21 | 'en' => 'St. David’s Day', 22 | ]; 23 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/stRupertsDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Saint Rupert's Day. 19 | return [ 20 | 'de_AT' => 'Rupert', 21 | 'en' => 'Saint Rupert’s Day', 22 | ]; 23 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/terryFoxDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Terry Fox Day 19 | return [ 20 | 'en' => 'Terry Fox Day', 21 | 'fr' => 'Journée Terry Fox', 22 | ]; 23 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/thanksgivingDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Thanksgiving 19 | return [ 20 | 'en' => 'Thanksgiving', 21 | 'fr' => 'Action de grâce', 22 | ]; 23 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/carnationRevolutionDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Freedom Day 19 | return [ 20 | 'en' => 'Freedom Day', 21 | 'pt' => 'Dia da Liberdade', 22 | ]; 23 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/orangemensDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Orangemen's Day 19 | return [ 20 | 'en' => 'Orangemen’s Day', 21 | 'fr' => 'Fête des orangistes', 22 | ]; 23 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/stFloriansDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Saint Florian's Day. 19 | return [ 20 | 'de_AT' => 'Florian', 21 | 'en' => 'Saint Florian’s Day', 22 | ]; 23 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/stLeopoldsDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Saint Leopold's Day. 19 | return [ 20 | 'de_AT' => 'Leopold', 21 | 'en' => 'Saint Leopold’s Day', 22 | ]; 23 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/walpurgisEve.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Walpurgis Night 19 | return [ 20 | 'en' => 'Walpurgis Night', 21 | 'sv' => 'valborgsmässoafton', 22 | ]; 23 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/worldAnimalDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for World Animal Day 19 | return [ 20 | 'en' => 'World Animal Day', 21 | 'nl' => 'Werelddierendag', 22 | ]; 23 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/dayOfLiberation.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Day of Liberation 19 | return [ 20 | 'de' => 'Tag der Befreiung', 21 | 'en' => 'Day of Liberation', 22 | ]; 23 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/plebisciteDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Plebiscite Day. 19 | return [ 20 | 'de_AT' => 'Tag der Volksabstimmung', 21 | 'en' => 'Plebiscite Day', 22 | ]; 23 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/saskatchewanDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Saskatchewan Day 19 | return [ 20 | 'en' => 'Saskatchewan Day', 21 | 'fr' => 'Jour Saskatchewan', 22 | ]; 23 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/dayOfReformation.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Day of Reformation 19 | return [ 20 | 'de' => 'Tag der Reformation', 21 | 'en' => 'Day of Reformation', 22 | ]; 23 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/goldCupParadeDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Gold Cup Parade Day 19 | return [ 20 | 'en' => 'Gold Cup Parade Day', 21 | 'fr' => 'Défilé de la Coupe d’or', 22 | ]; 23 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/winterTime.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Wintertime 19 | return [ 20 | 'da' => 'sommertid slutter', 21 | 'en' => 'Wintertime', 22 | 'nl' => 'wintertijd', 23 | ]; 24 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/allSoulsDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for All Souls' Day 19 | return [ 20 | 'en' => 'All Souls’ Day', 21 | 'lt' => 'Vėlinės', 22 | 'pt' => 'Dia de Finados', 23 | ]; 24 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/yukonHeritageDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Yukon Heritage Day 19 | return [ 20 | 'en' => 'Yukon Heritage Day', 21 | 'fr' => 'Journée du patrimoine du Yukon', 22 | ]; 23 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/stJohnsEve.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for St. John's Eve 19 | return [ 20 | 'da' => 'sankthansaften', 21 | 'en' => 'St. John’s Eve', 22 | 'sv' => 'midsommarafton', 23 | ]; 24 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/stMartinsDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for St. Martin's Day 19 | return [ 20 | 'de_AT' => 'Martin', 21 | 'en' => 'St. Martin’s Day', 22 | 'nl' => 'Sint Maarten', 23 | ]; 24 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/statehoodDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Statehood Day 19 | return [ 20 | 'en' => 'Statehood Day', 21 | 'hr' => 'Dan državnosti', 22 | 'sl' => 'Dan državnosti', 23 | ]; 24 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/epiphanyEve.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Epiphany Eve 19 | return [ 20 | 'da' => 'helligtrekongersaften', 21 | 'en' => 'Epiphany Eve', 22 | 'sv' => 'trettondagsafton', 23 | ]; 24 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/secondNewYearsDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for New Year's Day 19 | return [ 20 | 'da' => '2. nytårsdag', 21 | 'en' => '2nd January', 22 | 'sl' => 'Novo leto (2. dan)', 23 | ]; 24 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/allSaintsEve.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for All Saints' Eve 19 | return [ 20 | 'da' => 'allehelgensaften', 21 | 'en' => 'All Saints’ Eve', 22 | 'sv' => 'alla helgons afton', 23 | ]; 24 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/annunciation.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Annunciation 19 | return [ 20 | 'el' => 'Ευαγγελισμός της Θεοτόκου', 21 | 'en' => 'Annunciation', 22 | 'fr' => 'Annonciation', 23 | ]; 24 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/nationalPatriotsDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for National Patriot's Day 19 | return [ 20 | 'en' => 'National Patriot’s Day', 21 | 'fr' => 'Journée nationale des patriotes', 22 | ]; 23 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/reformationDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Reformation Day 19 | return [ 20 | 'de' => 'Reformationstag', 21 | 'en' => 'Reformation Day', 22 | 'sl' => 'Dan reformacije', 23 | ]; 24 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/saintJeanBaptisteDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Saint-Jean Baptiste Day 19 | return [ 20 | 'en' => 'Saint-Jean-Baptiste Day', 21 | 'fr' => 'Fête de la Saint-Jean-Baptiste', 22 | ]; 23 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/remembranceDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Remembrance Day 19 | return [ 20 | 'en' => 'Remembrance Day', 21 | 'fr' => 'Jour du souvenir', 22 | 'sl' => 'Dan spomina na mrtve', 23 | ]; 24 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/summerTime.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Summertime 19 | return [ 20 | 'da' => 'sommertid starter', 21 | 'en' => 'Summertime', 22 | 'ko' => '서머타임', 23 | 'nl' => 'zomertijd', 24 | ]; 25 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/preserenDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Prešeren Day 19 | return [ 20 | 'en' => 'Prešeren Day, Slovenian Cultural Holiday', 21 | 'sl' => 'Prešernov dan, slovenski kulturni praznik', 22 | ]; 23 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/restorationOfIndepence.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Restoration of Independence 19 | return [ 20 | 'en' => 'Restoration of Independence', 21 | 'pt' => 'Restauração da Independência', 22 | ]; 23 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/independenceDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Independence Day 19 | return [ 20 | 'en' => 'Independence Day', 21 | 'hr' => 'Dan neovisnosti', 22 | 'sl' => 'Dan samostojnosti in enotnosti', 23 | ]; 24 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/novaScotiaHeritageDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Nova Scotia Heritage Day 19 | return [ 20 | 'en' => 'Nova Scotia Heritage Day', 21 | 'fr' => 'Journée du patrimoine de la Nouvelle-Écosse', 22 | ]; 23 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/dayAfterNewYearsDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Day after New Year's Day 19 | return [ 20 | 'en' => 'Day after New Year’s Day', 21 | 'ko' => '새해 연휴', 22 | 'ro' => 'A doua zi după Anul Nou', 23 | ]; 24 | -------------------------------------------------------------------------------- /src/Yasumi/Exception/UnknownLocaleException.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Exception; 19 | 20 | /** 21 | * Class UnknownLocaleException. 22 | */ 23 | class UnknownLocaleException extends \InvalidArgumentException implements Exception 24 | { 25 | } 26 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/uprisingAgainstOccupation.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Day of Uprising Against Occupation 19 | return [ 20 | 'en' => 'Day of Uprising Against Occupation', 21 | 'sl' => 'Dan upora proti okupatorju', 22 | ]; 23 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/nationalIndigenousPeoplesDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for National Indigenous Peoples Day 19 | return [ 20 | 'en' => 'National Indigenous Peoples Day', 21 | 'fr' => 'Journée nationale des peuples autochtones', 22 | ]; 23 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/portugueseRepublicDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Implantation of the Portuguese Republic 19 | return [ 20 | 'en' => 'Implantation of the Portuguese Republic', 21 | 'pt' => 'Implantação da República Portuguesa', 22 | ]; 23 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/truthAndReconciliationDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Truth And Reconciliation Day 19 | return [ 20 | 'en' => 'National Day For Truth And Reconciliation', 21 | 'fr' => 'la Journée nationale de la vérité et de la réconciliation', 22 | ]; 23 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/armisticeDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Armistice Day 19 | return [ 20 | 'el' => 'Ημέρα Ανακωχής', 21 | 'en' => 'Armistice Day', 22 | 'fr' => 'Armistice', 23 | 'fr_FR' => 'Armistice 1918', 24 | 'nl' => 'Wapenstilstand', 25 | ]; 26 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/victoryInEuropeDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Victory in Europe Day 19 | return [ 20 | 'cs' => 'Den vítězství', 21 | 'en' => 'Victory in Europe Day', 22 | 'fr' => 'Victoire 1945', 23 | 'sk' => 'Deň víťazstva nad fašizmom', 24 | ]; 25 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/newYearsEve.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for New Year's Eve 19 | return [ 20 | 'da' => 'nytårsaften', 21 | 'de' => 'Silvester', 22 | 'en' => 'New Year’s Eve', 23 | 'ko' => '신년전야', 24 | 'lv' => 'Vecgada vakars', 25 | 'sv' => 'nyårsafton', 26 | ]; 27 | -------------------------------------------------------------------------------- /src/Yasumi/Exception/InvalidYearException.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Exception; 19 | 20 | /** 21 | * Class InvalidYearException. 22 | * 23 | * @author Quentin Neyrat 24 | */ 25 | class InvalidYearException extends \InvalidArgumentException implements Exception 26 | { 27 | } 28 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/stJosephsDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for St. Joseph's Day 19 | return [ 20 | 'ca' => 'Sant Josep', 21 | 'de' => 'Josephstag', 22 | 'en' => 'St. Joseph’s Day', 23 | 'es' => 'San José', 24 | 'fr' => 'Saint-Joseph', 25 | 'it' => 'San Giuseppe', 26 | ]; 27 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/maundyThursday.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Maundy Thursday 19 | return [ 20 | 'ca' => 'dijous Sant', 21 | 'da' => 'skærtorsdag', 22 | 'el' => 'Μεγάλη Πέμπτη', 23 | 'en' => 'Maundy Thursday', 24 | 'es' => 'Jueves Santo', 25 | 'nb' => 'skjærtorsdag', 26 | ]; 27 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/stGeorgesDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for St. George's Day 19 | return [ 20 | 'bg' => 'Гергьовден, ден на храбростта и Българската армия', 21 | 'ca' => 'Sant Jordi', 22 | 'el' => 'Αγίου Γεωργίου', 23 | 'en' => 'St. George’s Day', 24 | 'es' => 'San Jorge', 25 | ]; 26 | -------------------------------------------------------------------------------- /src/Yasumi/Exception/ProviderNotFoundException.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Exception; 19 | 20 | /** 21 | * Class ProviderNotFoundException. 22 | * 23 | * @author Quentin Neyrat 24 | */ 25 | class ProviderNotFoundException extends \InvalidArgumentException implements Exception 26 | { 27 | } 28 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/substituteHoliday.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translation pattern for substitute holidays. 19 | return [ 20 | 'da' => '{0} (erstatning)', 21 | 'en' => '{0} (substitute day)', 22 | 'en_CA' => '{0} observed', 23 | 'en_US' => '{0} observed', 24 | 'ja' => '振替休日 ({0})', 25 | 'ko' => '대체공휴일', 26 | ]; 27 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/queensBirthday.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Queen's Birthday 19 | return [ 20 | 'da' => 'Dronningens fødselsdag', 21 | 'en' => 'Queen’s Birthday', 22 | 'fr' => 'Anniversaire officiel de la reine', 23 | 'pt' => 'Aniversário da Rainha', 24 | 'ru' => 'Официальный день рождения королевы', 25 | ]; 26 | -------------------------------------------------------------------------------- /.php-cs-fixer.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | $config = new AzuyaLabs\PhpCsFixerConfig\Config('2015', null, 'Yasumi'); 19 | $config->getFinder()->in(__DIR__)->notPath('var'); 20 | 21 | $defaults = $config->getRules(); 22 | 23 | $config->setRules(array_merge($defaults, [ 24 | 'php_unit_method_casing' => ['case' => 'camel_case'], 25 | ])); 26 | 27 | return $config; 28 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/internationalWomensDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for International Women's Day 19 | return [ 20 | 'de' => 'Internationaler Frauentag', 21 | 'en' => 'International Women’s Day', 22 | 'ka' => 'ქალთა საერთაშორისო დღე', 23 | 'ko' => '국제 여성의 날', 24 | 'ru' => 'Международный женский день', 25 | 'uk' => 'Міжнародний жіночий день', 26 | ]; 27 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/corpusChristi.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Corpus Christi 19 | return [ 20 | 'de' => 'Fronleichnam', 21 | 'en' => 'Corpus Christi', 22 | 'fr' => 'Fête-Dieu', 23 | 'hr' => 'Tijelovo', 24 | 'it' => 'Corpus Domini', 25 | 'pl' => 'Boże Ciało', 26 | 'pt' => 'Corpus Christi', 27 | 'pt_PT' => 'Corpo de Deus', 28 | 'sk' => 'Božie Telo', 29 | ]; 30 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/labourDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Labour Day 19 | return [ 20 | 'en' => 'Labour Day', 21 | 'en_US' => 'Labor Day', 22 | 'fr' => 'Fête du travail', 23 | 'ja' => '労働の日', 24 | 'ko' => '노동절', 25 | 'nl' => 'Dag van de arbeid', 26 | 'sk' => 'Sviatok práce', 27 | 'sl' => 'Praznik dela (2. dan)', 28 | 'tr' => 'Emek ve Dayanışma Günü', 29 | ]; 30 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/ashWednesday.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Ash Wednesday 19 | return [ 20 | 'de' => 'Aschermittwoch', 21 | 'en' => 'Ash Wednesday', 22 | 'es' => 'Miércoles de Ceniza', 23 | 'fr' => 'Mercredi des Cendres', 24 | 'it' => 'Mercoledi delle Ceneri', 25 | 'nl' => 'Aswoensdag', 26 | 'pt' => 'Quarta-feira de Cinzas', 27 | 'sk' => 'Popolcová streda', 28 | ]; 29 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/stStephensDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for St. Stephen's Day 19 | return [ 20 | 'ca' => 'Sant Esteve', 21 | 'cy' => 'Gŵyl San Steffan', 22 | 'de' => 'Stephanstag', 23 | 'en' => 'St. Stephen’s Day', 24 | 'es' => 'Sant Esteve', 25 | 'fr' => 'Saint-Étienne', 26 | 'ga' => 'Lá Fhéile Stiofáin', 27 | 'hr' => 'Sveti Stjepan', 28 | 'it' => 'Santo Stefano', 29 | ]; 30 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/fathersDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Father's Day 19 | return [ 20 | 'da' => 'fars dag', 21 | 'de' => 'Vatertag', 22 | 'el' => 'Γιορτή του πατέρα', 23 | 'en' => 'Father’s Day', 24 | 'fr' => 'Fête des pères', 25 | 'it' => 'Festa del papà', 26 | 'lt' => 'Tėvo dieną', 27 | 'nl' => 'Vaderdag', 28 | 'pt' => 'Dia do Pai', 29 | 'ro' => 'Ziua Tatălui', 30 | 'sk' => 'Deň otcov', 31 | ]; 32 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/immaculateConception.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Immaculate Conception 19 | return [ 20 | 'ca' => 'Immaculada Concepció', 21 | 'de' => 'Mariä Empfängnis', 22 | 'el' => 'Ευαγγελισμός της Θεοτόκου', 23 | 'en' => 'Immaculate Conception', 24 | 'es' => 'Inmaculada Concepción', 25 | 'fr' => 'Immaculée Conception', 26 | 'it' => 'Immacolata Concezione', 27 | 'pt' => 'Dia da Imaculada Conceição', 28 | 'sk' => 'Nepoškvrnené počatie Panny Márie', 29 | ]; 30 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/stJohnsDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for St. John's Day 19 | return [ 20 | 'ca' => 'Sant Joan', 21 | 'da' => 'sankthansaften', 22 | 'el' => 'Σύναξις Προφήτου Προδρόμου και Βαπτιστού Ιωάννου', 23 | 'en' => 'St. John’s Day', 24 | 'es' => 'Sant Joan', 25 | 'et' => 'Jaanipäev', 26 | 'fi' => 'Juhannuspäivä', 27 | 'lt' => 'Rasos ir Joninių diena', 28 | 'lv' => 'Jāņi', 29 | 'ro' => 'Sfântul Ioan Botezătorul', 30 | 'sv' => 'midsommardagen', 31 | ]; 32 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/valentinesDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Valentine's Day 19 | return [ 20 | 'ca' => 'Dia de Sant Valentí', 21 | 'de' => 'Valentinstag', 22 | 'el' => 'Αγίου Βαλεντίνου', 23 | 'en' => 'Valentine’s Day', 24 | 'es' => 'San Valentín', 25 | 'fr' => 'Saint-Valentin', 26 | 'it' => 'San Valentino', 27 | 'ja' => 'バレンタイン·デー', 28 | 'ko' => '발렌타인 데이', 29 | 'nl' => 'Valentijnsdag', 30 | 'pl' => 'Walentynki', 31 | 'pt' => 'Dia dos Namorados', 32 | ]; 33 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/mothersDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Mother's Day 19 | return [ 20 | 'da' => 'mors dag', 21 | 'de' => 'Muttertag', 22 | 'el' => 'Ημέρα της μητέρας', 23 | 'en' => 'Mother’s Day', 24 | 'fr' => 'Fête des mères', 25 | 'it' => 'Festa della mamma', 26 | 'ka' => 'დედის დღე', 27 | 'lt' => 'Motinos dieną', 28 | 'lv' => 'Mātes dienu', 29 | 'nl' => 'Moederdag', 30 | 'pt' => 'Dia da Mãe', 31 | 'ro' => 'Ziua Mamei', 32 | 'sk' => 'Deň matiek', 33 | ]; 34 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/pentecostMonday.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Whitmonday 19 | return [ 20 | 'da' => '2. pinsedag', 21 | 'de' => 'Pfingstmontag', 22 | 'el' => 'Αγίου Πνεύματος', 23 | 'en' => 'Whitmonday', 24 | 'fr' => 'Lundi de Pentecôte', 25 | 'ga' => 'Luan Cincíse', 26 | 'hu' => 'Pünkösdhétfő', 27 | 'it' => 'Lunedi di Pentecoste', 28 | 'nb' => 'andre pinsedag', 29 | 'nl' => 'tweede pinksterdag', 30 | 'nl_BE' => 'pinkstermaandag', 31 | 'ro' => 'A doua zi de Rusalii', 32 | ]; 33 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/ascensionDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Ascension Day 19 | return [ 20 | 'da' => 'Kristi himmelfartsdag', 21 | 'de' => 'Christi Himmelfahrt', 22 | 'de_CH' => 'Auffahrt', 23 | 'el' => 'Ανάληψη του Χριστού', 24 | 'en' => 'Ascension Day', 25 | 'fi' => 'Helatorstai', 26 | 'fr' => 'Ascension', 27 | 'it' => 'Ascensione', 28 | 'nb' => 'Kristi himmelfartsdag', 29 | 'nl' => 'Hemelvaart', 30 | 'sk' => 'Nanebovstúpenie Pána', 31 | 'sv' => 'Kristi himmelsfärdsdag', 32 | ]; 33 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/epiphany.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Epiphany 19 | return [ 20 | 'ca' => 'Epifania', 21 | 'de' => 'Heilige 3 Könige', 22 | 'de_AT' => 'Heilige Drei Könige', 23 | 'de_CH' => 'Heilige Drei Könige', 24 | 'el' => 'Θεοφάνεια', 25 | 'en' => 'Epiphany', 26 | 'es' => 'Día de Reyes', 27 | 'fi' => 'Loppiainen', 28 | 'fr' => 'Epiphanie', 29 | 'hr' => 'Sveta tri kralja', 30 | 'it' => 'Epifania', 31 | 'ja' => 'エピファニー', 32 | 'nl' => 'Drie Koningen', 33 | 'pl' => 'Święto Trzech Króli', 34 | 'ro' => 'Bobotează', 35 | 'sk' => 'Zjavenie Pána / Traja králi', 36 | 'sv' => 'trettondedag jul', 37 | ]; 38 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/christmasEve.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Christmas Eve 19 | return [ 20 | 'bg' => 'Бъдни вечер', 21 | 'cs' => 'Štědrý den', 22 | 'cy' => 'Noswyl Nadolig', 23 | 'da' => 'juleaften', 24 | 'de' => 'Heiliger Abend', 25 | 'en' => 'Christmas Eve', 26 | 'et' => 'Jõululaupäev', 27 | 'fr' => 'Réveillon de Noël', 28 | 'it' => 'Vigilia di Natale', 29 | 'ko' => '크리스마스 이브', 30 | 'lt' => 'Šv. Kūčios', 31 | 'lv' => 'Ziemassvētku vakars', 32 | 'pl' => 'Wigilia Bożego Narodzenia', 33 | 'pt' => 'Véspera de Natal', 34 | 'ro' => 'Ajunul Crãciunului', 35 | 'sk' => 'Štedrý deň', 36 | 'sv' => 'julafton', 37 | ]; 38 | -------------------------------------------------------------------------------- /examples/filters.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // This file demonstrates the use of filters; selecting only a number of holidays 19 | // based on certain conditions. In this example we show only the holidays that are 20 | // marked as 'official'. 21 | 22 | require 'vendor/autoload.php'; 23 | 24 | // Use the factory to create a new holiday provider instance 25 | $holidays = Yasumi\Yasumi::create('Netherlands', (int) date('Y')); 26 | 27 | // Create a filter instance for the official holidays 28 | $official = new Yasumi\Filters\OfficialHolidaysFilter($holidays->getIterator()); 29 | 30 | echo 'List of all official holidays: ' . PHP_EOL; 31 | foreach ($official as $day) { 32 | echo $day->getName() . PHP_EOL; 33 | } 34 | -------------------------------------------------------------------------------- /rector.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector; 19 | use Rector\Config\RectorConfig; 20 | use Rector\Set\ValueObject\SetList; 21 | 22 | return static function (RectorConfig $rectorConfig): void { 23 | $rectorConfig->paths([ 24 | __DIR__ . '/src', 25 | __DIR__ . '/tests', 26 | ]); 27 | 28 | // single rules 29 | $rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class); 30 | 31 | // sets of rules 32 | $rectorConfig->sets([ 33 | SetList::CODE_QUALITY, 34 | SetList::DEAD_CODE, 35 | SetList::EARLY_RETURN, 36 | SetList::PHP_81, 37 | SetList::TYPE_DECLARATION, 38 | ]); 39 | }; 40 | -------------------------------------------------------------------------------- /src/Yasumi/Filters/BankHolidaysFilter.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Filters; 19 | 20 | use Yasumi\Holiday; 21 | 22 | /** 23 | * BankHolidaysFilter is a class for filtering all bank holidays. 24 | * 25 | * BankHolidaysFilter is a class that returns all holidays that are considered bank holidays of any given holiday 26 | * provider. 27 | * 28 | * Example usage: 29 | * $holidays = Yasumi::create('Netherlands', 2015); 30 | * $bank = new BankHolidaysFilter($holidays->getIterator()); 31 | */ 32 | class BankHolidaysFilter extends AbstractFilter 33 | { 34 | public function accept(): bool 35 | { 36 | return Holiday::TYPE_BANK === $this->getInnerIterator()->current()->getType(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 - 2025 AzuyaLabs 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/Yasumi/Exception/MissingTranslationException.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Exception; 19 | 20 | use Exception as BaseException; 21 | 22 | /** 23 | * Class MissingTranslationException. 24 | */ 25 | class MissingTranslationException extends BaseException implements Exception 26 | { 27 | /** 28 | * Initializes the Exception instance. 29 | * 30 | * @param string $key The holiday key 31 | * @param array $locales The locales that was searched 32 | */ 33 | public function __construct(string $key, array $locales) 34 | { 35 | parent::__construct(\sprintf("Translation for '%s' not found for any locale: '%s'", $key, \implode("', '", $locales))); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Yasumi/Filters/OfficialHolidaysFilter.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Filters; 19 | 20 | use Yasumi\Holiday; 21 | 22 | /** 23 | * OfficialHolidaysFilter is a class for filtering all official holidays. 24 | * 25 | * OfficialHolidaysFilter is a class that returns all holidays that are considered official of any given 26 | * holiday provider. 27 | * 28 | * Example usage: 29 | * $holidays = Yasumi::create('Netherlands', 2015); 30 | * $official = new OfficialHolidaysFilter($holidays->getIterator()); 31 | */ 32 | class OfficialHolidaysFilter extends AbstractFilter 33 | { 34 | public function accept(): bool 35 | { 36 | return Holiday::TYPE_OFFICIAL === $this->getInnerIterator()->current()->getType(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Yasumi/Filters/OtherHolidaysFilter.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Filters; 19 | 20 | use Yasumi\Holiday; 21 | 22 | /** 23 | * OtherHolidaysFilter is a class for filtering all other type of holidays. 24 | * 25 | * OtherHolidaysFilter is a class that returns all holidays that are considered another type of holiday of any given 26 | * holiday provider. 27 | * 28 | * Example usage: 29 | * $holidays = Yasumi::create('Netherlands', 2015); 30 | * $other = new OtherHolidaysFilter($holidays->getIterator()); 31 | */ 32 | class OtherHolidaysFilter extends AbstractFilter 33 | { 34 | public function accept(): bool 35 | { 36 | return Holiday::TYPE_OTHER === $this->getInnerIterator()->current()->getType(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Yasumi/Filters/SeasonalHolidaysFilter.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Filters; 19 | 20 | use Yasumi\Holiday; 21 | 22 | /** 23 | * SeasonalHolidaysFilter is a class for filtering all seasonal holidays. 24 | * 25 | * OfficialHolidaysFilter is a class that returns all holidays that are considered seasonal of any given holiday 26 | * provider. 27 | * 28 | * Example usage: 29 | * $holidays = Yasumi::create('Netherlands', 2015); 30 | * $seasonal = new SeasonalHolidaysFilter($holidays->getIterator()); 31 | */ 32 | class SeasonalHolidaysFilter extends AbstractFilter 33 | { 34 | public function accept(): bool 35 | { 36 | return Holiday::TYPE_SEASON === $this->getInnerIterator()->current()->getType(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Yasumi/Filters/ObservedHolidaysFilter.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Filters; 19 | 20 | use Yasumi\Holiday; 21 | 22 | /** 23 | * ObservedHolidaysFilter is a class for filtering all observed holidays. 24 | * 25 | * ObservedHolidaysFilter is a class that returns all holidays that are considered observed of any given holiday 26 | * provider. 27 | * 28 | * Example usage: 29 | * $holidays = Yasumi::create('Netherlands', 2015); 30 | * $observed = new ObservedHolidaysFilter($holidays->getIterator()); 31 | */ 32 | class ObservedHolidaysFilter extends AbstractFilter 33 | { 34 | public function accept(): bool 35 | { 36 | return Holiday::TYPE_OBSERVANCE === $this->getInnerIterator()->current()->getType(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/DateTimeZoneFactory.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider; 19 | 20 | /** 21 | * This factory keep references to already instantiated DateTimeZone to save CPU time resources. 22 | * 23 | * @author Pierrick VIGNAND 24 | */ 25 | final class DateTimeZoneFactory 26 | { 27 | /** @var array */ 28 | private static array $dateTimeZones = []; 29 | 30 | public static function getDateTimeZone(string $timezone): \DateTimeZone 31 | { 32 | if (! isset(self::$dateTimeZones[$timezone])) { 33 | self::$dateTimeZones[$timezone] = new \DateTimeZone($timezone); 34 | } 35 | 36 | return self::$dateTimeZones[$timezone]; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Yasumi/TranslationsInterface.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi; 19 | 20 | interface TranslationsInterface 21 | { 22 | /** 23 | * Returns translation for holiday in specific locale. 24 | * 25 | * @param string $key holiday key 26 | * @param string $locale locale 27 | * 28 | * @return string|null translated holiday name 29 | */ 30 | public function getTranslation(string $key, string $locale): ?string; 31 | 32 | /** 33 | * Returns all available translations for holiday. 34 | * 35 | * @param string $key holiday key 36 | * 37 | * @return array holiday name translations ['' => '', ...] 38 | */ 39 | public function getTranslations(string $key): array; 40 | } 41 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/pentecost.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Whitsunday 19 | return [ 20 | 'da' => 'pinsedag', 21 | 'de' => 'Pfingstsonntag', 22 | 'de_AT' => 'Pfingsten', 23 | 'de_CH' => 'Pfingsten', 24 | 'el' => 'Πεντηκοστή', 25 | 'en' => 'Whitsunday', 26 | 'et' => 'Nelipühade 1. püha', 27 | 'fi' => 'Helluntaipäivä', 28 | 'fr' => 'Pentecôte', 29 | 'ga' => 'Domhnach Cincíse', 30 | 'hu' => 'Pünkösd', 31 | 'it' => 'Pentecoste', 32 | 'lv' => 'Vasarsvētkus', 33 | 'nb' => 'første pinsedag', 34 | 'nl' => 'eerste pinksterdag', 35 | 'pl' => 'Zielone Świątki', 36 | 'ro' => 'Rusaliile', 37 | 'ru' => 'Троица', 38 | 'sl' => 'Binkoštna nedelja', 39 | 'sv' => 'pingstdagen', 40 | 'uk' => 'Трійця', 41 | ]; 42 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/assumptionOfMary.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Assumption of Mary 19 | return [ 20 | 'ca' => 'l’Assumpció', 21 | 'de' => 'Mariä Himmelfahrt', 22 | 'el' => 'Κοίμηση της Θεοτόκου', 23 | 'en' => 'Assumption of Mary', 24 | 'es' => 'Asunción de la Virgen María', 25 | 'fr' => 'Assomption', 26 | 'hr' => 'Velika Gospa', 27 | 'it' => 'Assunzione di Maria Vergine', 28 | 'it_CH' => 'Assunzione', 29 | 'lt' => 'Žolinė (Švč. Mergelės Marijos ėmimo į dangų diena)', 30 | 'nl' => 'Onze Lieve Vrouw hemelvaart', 31 | 'pl' => 'Wniebowzięcie Najświętszej Marii Panny', 32 | 'pt' => 'Assunção de Nossa Senhora', 33 | 'ro' => 'Adormirea Maicii Domnului', 34 | 'sk' => 'Nanebovzatie Panny Márie', 35 | 'sl' => 'Marijino vnebovzetje', 36 | ]; 37 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/allSaintsDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for All Saints' Day 19 | return [ 20 | 'ca' => 'Dia de Tots Sants', 21 | 'de' => 'Allerheiligen', 22 | 'el' => 'Άγιοι Πάντες', 23 | 'en' => 'All Saints’ Day', 24 | 'es' => 'Día de todos los Santos', 25 | 'fi' => 'Pyhäinpäivä', 26 | 'fr' => 'Toussaint', 27 | 'fr_BE' => 'La Toussaint', 28 | 'hr' => 'Dan svih svetih', 29 | 'hu' => 'Mindenszentek', 30 | 'it' => 'Festa di Tutti i Santi', 31 | 'it_CH' => 'Ognissanti', 32 | 'lt' => 'Visų šventųjų diena (Vėlinės)', 33 | 'nl' => 'Allerheiligen', 34 | 'pl' => 'Uroczystość Wszystkich Świętych', 35 | 'pt' => 'Dia de todos os Santos', 36 | 'ro' => 'Ziua tuturor sfinților', 37 | 'sk' => 'Sviatok Všetkých svätých', 38 | 'sv' => 'alla helgons dag', 39 | ]; 40 | -------------------------------------------------------------------------------- /src/Yasumi/Filters/AbstractFilter.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Filters; 19 | 20 | use Yasumi\SubstituteHoliday; 21 | 22 | abstract class AbstractFilter extends \FilterIterator implements \Countable 23 | { 24 | /** 25 | * Returns the number of holidays returned by this iterator. 26 | * 27 | * In case a holiday is substituted (e.g. observed), the holiday is only counted once. 28 | * 29 | * @return int number of unique holidays 30 | */ 31 | public function count(): int 32 | { 33 | $names = []; 34 | 35 | foreach ($this as $holiday) { 36 | $key = $holiday instanceof SubstituteHoliday 37 | ? $holiday->getSubstitutedHoliday()->getKey() 38 | : $holiday->getKey(); 39 | 40 | $names[$key] = true; 41 | } 42 | 43 | return count($names); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/goodFriday.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Good Friday 19 | return [ 20 | 'ca' => 'Divendres Sant', 21 | 'cs' => 'Velký pátek', 22 | 'cy' => 'Gwener y Groglith', 23 | 'da' => 'langfredag', 24 | 'de' => 'Karfreitag', 25 | 'el' => 'Μεγάλη Παρασκευή', 26 | 'en' => 'Good Friday', 27 | 'es' => 'Viernes Santo', 28 | 'et' => 'Suur Reede', 29 | 'fi' => 'Pitkäperjantai', 30 | 'fr' => 'Vendredi Saint', 31 | 'ga' => 'Aoine an Chéasta', 32 | 'hu' => 'Nagypéntek', 33 | 'it' => 'Venerdi Santo', 34 | 'ja' => 'グッドフライデー', 35 | 'lv' => 'Lielā Piektdiena', 36 | 'nb' => 'langfredag', 37 | 'nl' => 'Goede Vrijdag', 38 | 'pl' => 'Wielki Piątek', 39 | 'pt' => 'Sexta feira santa', 40 | 'pt_PT' => 'Sexta-feira Santa', 41 | 'sk' => 'Veľký piatok', 42 | 'sv' => 'långfredagen', 43 | ]; 44 | -------------------------------------------------------------------------------- /examples/between_filter.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // This file demonstrates the use of the `between` filter, selecting only a number of holidays 19 | // that fall in the given date range. 20 | 21 | require 'vendor/autoload.php'; 22 | 23 | $year = (int) date('Y'); 24 | 25 | // Use the factory to create a new holiday provider instance 26 | $holidays = Yasumi\Yasumi::create('Italy', $year); 27 | $holidaysInDecember = $holidays->between( 28 | new DateTime("12/01/{$year}"), 29 | new DateTime("12/31/{$year}") 30 | ); 31 | 32 | // Show all holidays in Italy for December 33 | echo 'List of all the holidays in December: ' . PHP_EOL; 34 | foreach ($holidaysInDecember as $holiday) { 35 | echo $holiday . ' - ' . $holiday->getName() . PHP_EOL; 36 | } 37 | echo PHP_EOL; 38 | 39 | // Show the number of filtered holidays 40 | echo "Number of filtered holidays: {$holidaysInDecember->count()}" . PHP_EOL; 41 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Austria/Vienna.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Austria; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Provider\Austria; 22 | 23 | /** 24 | * Provider for all holidays in Vienna (Austria). 25 | * 26 | * @see https://en.wikipedia.org/wiki/Vienna 27 | */ 28 | class Vienna extends Austria 29 | { 30 | /** 31 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 32 | * country or sub-region. 33 | */ 34 | public const ID = 'AT-9'; 35 | 36 | /** 37 | * Initialize holidays for Vienna (Austria). 38 | * 39 | * @throws \InvalidArgumentException 40 | * @throws UnknownLocaleException 41 | * @throws \Exception 42 | */ 43 | public function initialize(): void 44 | { 45 | parent::initialize(); 46 | 47 | // Add custom holidays. 48 | $this->calculateStLeopoldsDay(); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/easter.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Easter Sunday 19 | return [ 20 | 'bs_Latn' => 'Uskrs', 21 | 'ca' => 'Pasqua', 22 | 'cy' => 'Sul y Pasg', 23 | 'da' => 'påskedag', 24 | 'de' => 'Ostersonntag', 25 | 'de_CH' => 'Ostern', 26 | 'el' => 'Κυριακή του Πάσχα', 27 | 'en' => 'Easter Sunday', 28 | 'es' => 'Pascua de Resurrección', 29 | 'et' => 'Ülestõusmispühade 1. püha', 30 | 'fi' => 'Pääsiäispäivä', 31 | 'fr' => 'Pâques', 32 | 'ga' => 'Domhnach Cásca', 33 | 'hr' => 'Uskrs', 34 | 'hu' => 'Húsvét', 35 | 'it' => 'Pasqua', 36 | 'ka' => 'აღდგომა', 37 | 'lt' => 'Velykos', 38 | 'lv' => 'Lieldienas', 39 | 'nb' => 'første påskedag', 40 | 'nl' => 'eerste paasdag', 41 | 'pl' => 'Wielkanoc', 42 | 'pt' => 'Páscoa', 43 | 'ro' => 'Paștele', 44 | 'ru' => 'Пасха', 45 | 'sl' => 'Velika noč', 46 | 'sv' => 'påskdagen', 47 | 'uk' => 'Великдень', 48 | ]; 49 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Austria/LowerAustria.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Austria; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Provider\Austria; 22 | 23 | /** 24 | * Provider for all holidays in Lower Austria (Austria). 25 | * 26 | * @see https://en.wikipedia.org/wiki/Lower_Austria 27 | */ 28 | class LowerAustria extends Austria 29 | { 30 | /** 31 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 32 | * country or sub-region. 33 | */ 34 | public const ID = 'AT-3'; 35 | 36 | /** 37 | * Initialize holidays for Lower Austria (Austria). 38 | * 39 | * @throws \InvalidArgumentException 40 | * @throws UnknownLocaleException 41 | * @throws \Exception 42 | */ 43 | public function initialize(): void 44 | { 45 | parent::initialize(); 46 | 47 | // Add custom holidays. 48 | $this->calculateStLeopoldsDay(); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/easterMonday.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Easter Monday 19 | return [ 20 | 'ca' => 'dilluns de Pasqua', 21 | 'cs' => 'Velikonoční pondělí', 22 | 'cy' => 'Llun y Pasg', 23 | 'da' => '2. påskedag', 24 | 'de' => 'Ostermontag', 25 | 'el' => 'Δευτέρα του Πάσχα', 26 | 'en' => 'Easter Monday', 27 | 'es' => 'Lunes de Pascua', 28 | 'fi' => '2. pääsiäispäivä', 29 | 'fr' => 'Lundi de Pâques', 30 | 'ga' => 'Luan Cásca', 31 | 'hr' => 'Uskršnji ponedjeljak', 32 | 'hu' => 'Húsvéthétfő', 33 | 'it' => 'Lunedì dell’Angelo', 34 | 'it_CH' => 'Lunedi di Pasqua', 35 | 'lt' => 'Antroji Velykų diena', 36 | 'lv' => 'Otrās Lieldienas', 37 | 'nb' => 'andre påskedag', 38 | 'nl' => 'tweede paasdag', 39 | 'nl_BE' => 'paasmaandag', 40 | 'pl' => 'Poniedziałek Wielkanocny', 41 | 'ro' => 'A doua zi de Paște', 42 | 'sk' => 'Veľkonočný pondelok', 43 | 'sl' => 'Velikonočni ponedeljek', 44 | 'sv' => 'annandag påsk', 45 | ]; 46 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Austria/Styria.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Austria; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Provider\Austria; 22 | 23 | /** 24 | * Provider for all holidays in Styria (Austria). 25 | * 26 | * @see https://en.wikipedia.org/wiki/Styria 27 | */ 28 | class Styria extends Austria 29 | { 30 | /** 31 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 32 | * country or sub-region. 33 | */ 34 | public const ID = 'AT-6'; 35 | 36 | /** 37 | * Initialize holidays for Styria (Austria). 38 | * 39 | * @throws \InvalidArgumentException 40 | * @throws UnknownLocaleException 41 | * @throws \Exception 42 | */ 43 | public function initialize(): void 44 | { 45 | parent::initialize(); 46 | 47 | // Add custom Common holidays. 48 | $this->addHoliday($this->stJosephsDay($this->year, $this->timezone, $this->locale)); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Austria/Tyrol.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Austria; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Provider\Austria; 22 | 23 | /** 24 | * Provider for all holidays in Tyrol (Austria). 25 | * 26 | * @see https://en.wikipedia.org/wiki/Tyrol_(state) 27 | */ 28 | class Tyrol extends Austria 29 | { 30 | /** 31 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 32 | * country or sub-region. 33 | */ 34 | public const ID = 'AT-7'; 35 | 36 | /** 37 | * Initialize holidays for Tyrol (Austria). 38 | * 39 | * @throws \InvalidArgumentException 40 | * @throws UnknownLocaleException 41 | * @throws \Exception 42 | */ 43 | public function initialize(): void 44 | { 45 | parent::initialize(); 46 | 47 | // Add custom Common holidays. 48 | $this->addHoliday($this->stJosephsDay($this->year, $this->timezone, $this->locale)); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/secondChristmasDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Second Christmas Day 19 | return [ 20 | 'bg' => 'Втори ден на Коледа', 21 | 'cs' => '2. svátek vánoční', 22 | 'da' => '2. juledag', 23 | 'de' => '2. Weihnachtsfeiertag', 24 | 'de_AT' => 'Stefanitag', 25 | 'el' => 'Σύναξις Υπεραγίας Θεοτόκου Μαρίας', 26 | 'en' => 'Boxing Day', 27 | 'en_US' => 'Second Christmas Day', 28 | 'en_ZA' => 'Day of Goodwill', 29 | 'et' => 'Teine Jõulupüha', 30 | 'fi' => '2. joulupäivä', 31 | 'fr' => 'Saint-Étienne', 32 | 'fr_CA' => 'Lendemain de Noël', 33 | 'fr_LU' => 'Deuxième jour de Noël', 34 | 'hu' => 'Karácsony másnapja', 35 | 'ko' => '성탄절 연휴', 36 | 'lt' => 'Kalėdos (antra diena)', 37 | 'lv' => 'Otrie Ziemassvētki', 38 | 'nb' => 'andre juledag', 39 | 'nl' => 'tweede kerstdag', 40 | 'pl' => 'drugi dzień Bożego Narodzenia', 41 | 'ro' => 'A doua zi de Crăciun', 42 | 'sk' => 'Druhý sviatok vianočný', 43 | 'sv' => 'annandag jul', 44 | ]; 45 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Austria/Burgenland.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Austria; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Provider\Austria; 22 | 23 | /** 24 | * Provider for all holidays in Burgenland (Austria). 25 | * 26 | * @see https://en.wikipedia.org/wiki/Burgenland 27 | */ 28 | class Burgenland extends Austria 29 | { 30 | /** 31 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 32 | * country or sub-region. 33 | */ 34 | public const ID = 'AT-1'; 35 | 36 | /** 37 | * Initialize holidays for Burgenland (Austria). 38 | * 39 | * @throws \InvalidArgumentException 40 | * @throws UnknownLocaleException 41 | * @throws \Exception 42 | */ 43 | public function initialize(): void 44 | { 45 | parent::initialize(); 46 | 47 | // Add custom Common holidays. 48 | $this->addHoliday($this->stMartinsDay($this->year, $this->timezone, $this->locale)); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Austria/Vorarlberg.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Austria; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Provider\Austria; 22 | 23 | /** 24 | * Provider for all holidays in Vorarlberg (Austria). 25 | * 26 | * @see https://en.wikipedia.org/wiki/Vorarlberg 27 | */ 28 | class Vorarlberg extends Austria 29 | { 30 | /** 31 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 32 | * country or sub-region. 33 | */ 34 | public const ID = 'AT-8'; 35 | 36 | /** 37 | * Initialize holidays for Vorarlberg (Austria). 38 | * 39 | * @throws \InvalidArgumentException 40 | * @throws UnknownLocaleException 41 | * @throws \Exception 42 | */ 43 | public function initialize(): void 44 | { 45 | parent::initialize(); 46 | 47 | // Add custom Common holidays. 48 | $this->addHoliday($this->stJosephsDay($this->year, $this->timezone, $this->locale)); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /DCO: -------------------------------------------------------------------------------- 1 | Developer Certificate of Origin 2 | Version 1.1 3 | 4 | Copyright (C) 2004, 2006 The Linux Foundation and its contributors. 5 | 6 | Everyone is permitted to copy and distribute verbatim copies of this 7 | license document, but changing it is not allowed. 8 | 9 | 10 | Developer's Certificate of Origin 1.1 11 | 12 | By making a contribution to this project, I certify that: 13 | 14 | (a) The contribution was created in whole or in part by me and I 15 | have the right to submit it under the open source license 16 | indicated in the file; or 17 | 18 | (b) The contribution is based upon previous work that, to the best 19 | of my knowledge, is covered under an appropriate open source 20 | license and I have the right under that license to submit that 21 | work with modifications, whether created in whole or in part 22 | by me, under the same open source license (unless I am 23 | permitted to submit under a different license), as indicated 24 | in the file; or 25 | 26 | (c) The contribution was provided directly to me by some other 27 | person who certified (a), (b) or (c) and I have not modified 28 | it. 29 | 30 | (d) I understand and agree that this project and the contribution 31 | are public and that a record of the contribution (including all 32 | personal information I submit with it, including my sign-off) is 33 | maintained indefinitely and may be redistributed consistent with 34 | this project or the open source license(s) involved. 35 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Canada/Ontario.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Canada; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Provider\Canada; 22 | 23 | /** 24 | * Provider for all holidays in Ontario (Canada). 25 | * 26 | * Ontario is a province of Canada. 27 | * 28 | * @see https://en.wikipedia.org/wiki/Ontario 29 | */ 30 | class Ontario extends Canada 31 | { 32 | /** 33 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 34 | * country or sub-region. 35 | */ 36 | public const ID = 'CA-ON'; 37 | 38 | /** 39 | * Initialize holidays for Ontario (Canada). 40 | * 41 | * @throws \InvalidArgumentException 42 | * @throws UnknownLocaleException 43 | * @throws \Exception 44 | */ 45 | public function initialize(): void 46 | { 47 | parent::initialize(); 48 | 49 | $this->timezone = 'America/Toronto'; 50 | 51 | $this->calculateCivicHoliday(); 52 | $this->calculateFamilyDay(); 53 | $this->calculateVictoriaDay(); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Canada/NewBrunswick.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Canada; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Provider\Canada; 22 | 23 | /** 24 | * Provider for all holidays in New Brunswick (Canada). 25 | * 26 | * New Brunswick is a province of Canada. 27 | * 28 | * @see https://en.wikipedia.org/wiki/New_Brunswick 29 | */ 30 | class NewBrunswick extends Canada 31 | { 32 | /** 33 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 34 | * country or sub-region. 35 | */ 36 | public const ID = 'CA-NB'; 37 | 38 | /** 39 | * Initialize holidays for New Brunswick (Canada). 40 | * 41 | * @throws \InvalidArgumentException 42 | * @throws UnknownLocaleException 43 | * @throws \Exception 44 | */ 45 | public function initialize(): void 46 | { 47 | parent::initialize(); 48 | 49 | $this->timezone = 'America/Halifax'; 50 | 51 | $this->calculateCivicHoliday(); 52 | $this->calculateFamilyDay(); 53 | $this->calculateVictoriaDay(); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/christmasDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for Christmas 19 | return [ 20 | 'bg' => 'Рождество Христово', 21 | 'bs_Latn' => 'Božić', 22 | 'ca' => 'Nadal', 23 | 'cs' => '1. svátek vánoční', 24 | 'cy' => 'Nadolig', 25 | 'da' => 'juledag', 26 | 'de' => '1. Weihnachtsfeiertag', 27 | 'de_AT' => 'Christtag', 28 | 'de_CH' => 'Weihnachtstag', 29 | 'el' => 'Χριστούγεννα', 30 | 'en' => 'Christmas Day', 31 | 'en_US' => 'Christmas', 32 | 'es' => 'Navidad', 33 | 'et' => 'Esimene jõulupüha', 34 | 'fi' => 'Joulupäivä', 35 | 'fr' => 'Noël', 36 | 'hr' => 'Božić', 37 | 'hu' => 'Karácsony', 38 | 'it' => 'Natale', 39 | 'ko' => '기독탄신일', 40 | 'lt' => 'Šv. Kalėdos', 41 | 'lv' => 'Ziemassvētki', 42 | 'nb' => 'første juledag', 43 | 'nl' => 'eerste kerstdag', 44 | 'nl_BE' => 'Kerstmis', 45 | 'pl' => 'pierwszy dzień Bożego Narodzenia', 46 | 'pt' => 'Natal', 47 | 'ro' => 'Crăciunul', 48 | 'ru' => 'Рождество', 49 | 'sk' => 'Prvý sviatok vianočný', 50 | 'sl' => 'Božič', 51 | 'sv' => 'juldagen', 52 | 'uk' => 'Різдво', 53 | ]; 54 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | The following versions are supported with security updates: 6 | 7 | | Version | Supported | 8 | | ------- | ------------------ | 9 | | 2.8.0 | :white_check_mark: | 10 | | 2.7.0 | :white_check_mark: | 11 | | 2.6.0 | :x: | 12 | | 2.5.0 | :x: | 13 | | <2.4 | :x: | 14 | 15 | As for supported PHP versions, this project only supports the actively supported versions of PHP and versions of PHP 16 | that only receive critical security updates. Currently, that is PHP 8.1, 8.2, 8.3 and 8.4. 17 | Please refer to the [supported versions](https://www.php.net/supported-versions.php) page, to find more details. 18 | When a version of PHP becomes EOL, generally a new release of this project will be issued that sunsets the 19 | support of that retired PHP version. 20 | 21 | ## Reporting a Vulnerability 22 | 23 | If you would like to report a vulnerability or have any security concerns with this project, 24 | please [open an issue](https://github.com/azuyalabs/yasumi/issues/new?labels=security). 25 | 26 | To investigate your request as good as possible, please include any of the following when reporting: 27 | 28 | - Proof of concept / Code example 29 | - Any tools, including versions used 30 | - Any relevant output 31 | 32 | I will take all disclosures very seriously and will do my best to rapidly respond and verify the vulnerability before 33 | taking the necessary steps to fix it. After my initial reply to your disclosure, which should be directly after 34 | receiving it, I will periodically update you with the status of the fix. 35 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Canada/BritishColumbia.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Canada; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Provider\Canada; 22 | 23 | /** 24 | * Provider for all holidays in British Columbia (Canada). 25 | * 26 | * British Columbia is a province of Canada. 27 | * 28 | * @see https://en.wikipedia.org/wiki/British_Columbia 29 | */ 30 | class BritishColumbia extends Canada 31 | { 32 | /** 33 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 34 | * country or sub-region. 35 | */ 36 | public const ID = 'CA-BC'; 37 | 38 | /** 39 | * Initialize holidays for British Columbia (Canada). 40 | * 41 | * @throws \InvalidArgumentException 42 | * @throws UnknownLocaleException 43 | * @throws \Exception 44 | */ 45 | public function initialize(): void 46 | { 47 | parent::initialize(); 48 | 49 | $this->timezone = 'America/Vancouver'; 50 | 51 | $this->calculateCivicHoliday(); 52 | $this->calculateFamilyDay(); 53 | $this->calculateVictoriaDay(); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/UnitedKingdom/England.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\UnitedKingdom; 19 | 20 | use Yasumi\Holiday; 21 | use Yasumi\Provider\UnitedKingdom; 22 | 23 | /** 24 | * Provider for all holidays in England (United Kingdom). 25 | * 26 | * England is a country that is part of the United Kingdom. It covers an area of 130,279 square kilometres 27 | * (50,301 sq mi), and has a population of 5,619,400. London, England's capital, is also the capital of 28 | * and the largest city in the United Kingdom. 29 | * 30 | * @see https://en.wikipedia.org/wiki/England 31 | */ 32 | class England extends UnitedKingdom 33 | { 34 | /** 35 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 36 | * country or sub-region. 37 | */ 38 | public const ID = 'GB-ENG'; 39 | 40 | /** 41 | * Initialize holidays for England (United Kingdom).. 42 | */ 43 | public function initialize(): void 44 | { 45 | parent::initialize(); 46 | 47 | $this->addHoliday($this->easterMonday($this->year, $this->timezone, $this->locale, Holiday::TYPE_BANK)); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/newYearsDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for New Year's Day 19 | return [ 20 | 'bs_Latn' => 'Nova godina', 21 | 'bg' => 'Нова година', 22 | 'ca' => 'Cap d’any', 23 | 'cs' => 'Nový rok', 24 | 'cy' => 'Dydd Calan', 25 | 'da' => 'nytårsdag', 26 | 'de' => 'Neujahr', 27 | 'el' => 'Πρωτοχρονιά', 28 | 'en' => 'New Year’s Day', 29 | 'es' => 'Año Nuevo', 30 | 'et' => 'Uusaasta', 31 | 'fi' => 'Uudenvuodenpäivä', 32 | 'fr' => 'Jour de l’An', 33 | 'fr_BE' => 'Nouvel An', 34 | 'fr_CH' => 'Nouvel An', 35 | 'ga' => 'Lá Caille', 36 | 'hr' => 'Nova godina', 37 | 'hu' => 'Újév', 38 | 'it' => 'Capodanno', 39 | 'ja' => '元日', 40 | 'ka' => 'ახალი წელი', 41 | 'ko' => '새해', 42 | 'lt' => 'Naujųjų metų diena', 43 | 'lv' => 'Jaunais Gads', 44 | 'nb' => 'første nyttårsdag', 45 | 'nl' => 'Nieuwjaar', 46 | 'pl' => 'Nowy Rok', 47 | 'pt' => 'Ano novo', 48 | 'pt_PT' => 'Dia de Ano Novo', 49 | 'ro' => 'Anul Nou', 50 | 'ru' => 'Новый год', 51 | 'sk' => 'Nový rok', 52 | 'sl' => 'Novo leto', 53 | 'sv' => 'nyårsdagen', 54 | 'tr' => 'Yılbaşı', 55 | 'uk' => 'Новий Рік', 56 | ]; 57 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Canada/NorthwestTerritories.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Canada; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Provider\Canada; 22 | 23 | /** 24 | * Provider for all holidays in Northwest Territories (Canada). 25 | * 26 | * Northwest Territories is a province of Canada. 27 | * 28 | * @see https://en.wikipedia.org/wiki/Northwest_Territories 29 | */ 30 | class NorthwestTerritories extends Canada 31 | { 32 | /** 33 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 34 | * country or sub-region. 35 | */ 36 | public const ID = 'CA-NT'; 37 | 38 | /** 39 | * Initialize holidays for Northwest Territories (Canada). 40 | * 41 | * @throws \InvalidArgumentException 42 | * @throws UnknownLocaleException 43 | * @throws \Exception 44 | */ 45 | public function initialize(): void 46 | { 47 | parent::initialize(); 48 | 49 | $this->timezone = 'America/Yellowknife'; 50 | 51 | $this->calculateCivicHoliday(); 52 | $this->calculateNationalIndigenousPeoplesDay(); 53 | $this->calculateVictoriaDay(); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/Yasumi/Filters/OnFilter.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Filters; 19 | 20 | use Yasumi\ProviderInterface; 21 | 22 | /** 23 | * OnFilter is a class used for filtering holidays based on a given date. 24 | * 25 | * Filters for all holidays that happen on the given date. 26 | * 27 | * Note: this class can be used separately, however is implemented by the AbstractProvider::on method. 28 | */ 29 | class OnFilter extends AbstractFilter 30 | { 31 | private const DATE_FORMAT = 'Y-m-d'; 32 | 33 | /** date to check for holidays */ 34 | private readonly string $date; 35 | 36 | /** 37 | * Construct the On FilterIterator Object. 38 | * 39 | * @param \Iterator $iterator Iterator object of the Holidays Provider 40 | * @param \DateTimeInterface $date Start date of the time frame to check against 41 | */ 42 | public function __construct( 43 | \Iterator $iterator, 44 | \DateTimeInterface $date, 45 | ) { 46 | parent::__construct($iterator); 47 | $this->date = $date->format(self::DATE_FORMAT); 48 | } 49 | 50 | public function accept(): bool 51 | { 52 | return $this->getInnerIterator()->current()->format(self::DATE_FORMAT) === $this->date; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/UnitedKingdom/Wales.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\UnitedKingdom; 19 | 20 | use Yasumi\Holiday; 21 | use Yasumi\Provider\UnitedKingdom; 22 | 23 | /** 24 | * Provider for all holidays in Wales (United Kingdom). 25 | * 26 | * Wales is a country that is part of the United Kingdom. It covers an area of 20,779 square kilometres 27 | * (8,023 sq mi), and has a population of 3,125,000. Cardiff, Wales's capital and largest city, is the 28 | * eleventh largest city in the United Kingdom. 29 | * 30 | * @see https://en.wikipedia.org/wiki/Wales 31 | */ 32 | class Wales extends UnitedKingdom 33 | { 34 | /** 35 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 36 | * country or sub-region. 37 | */ 38 | public const ID = 'GB-WLS'; 39 | 40 | /** 41 | * Initialize holidays for Wales (United Kingdom). 42 | */ 43 | public function initialize(): void 44 | { 45 | parent::initialize(); 46 | 47 | $this->addHoliday($this->easterMonday($this->year, $this->timezone, $this->locale, Holiday::TYPE_BANK)); 48 | } 49 | 50 | public function getSources(): array 51 | { 52 | return [ 53 | 'https://en.wikipedia.org/wiki/Holidays_in_Wales', 54 | ]; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/Yasumi/data/translations/internationalWorkersDay.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // Translations for International Workers' Day 19 | return [ 20 | 'bg' => 'Ден на труда и на международната работническа солидарност', 21 | 'bs_Latn' => 'Praznik rada', 22 | 'ca' => 'Dia del Treball', 23 | 'cs' => 'Svátek práce', 24 | 'da' => 'første maj', 25 | 'de' => 'Tag der Arbeit', 26 | 'de_AT' => 'Staatsfeiertag', 27 | 'el' => 'Εργατική Πρωτομαγιά', 28 | 'en_US' => 'International Workers’ Day', 29 | 'en_ZA' => 'Workers’ Day', 30 | 'es' => 'Día del Trabajador', 31 | 'et' => 'Kevadpüha', 32 | 'fi' => 'Vappu', 33 | 'fr' => 'Fête du Travail', 34 | 'hr' => 'Praznik rada', 35 | 'hu' => 'A munka ünnepe', 36 | 'it' => 'Festa del Lavoro', 37 | 'it_CH' => 'Festa dei lavoratori', 38 | 'ja' => '労働の日', 39 | 'ko' => '노동절', 40 | 'lt' => 'Tarptautinė darbo diena', 41 | 'lv' => 'Darba svētki', 42 | 'nb' => 'arbeidernes dag', 43 | 'nl' => 'Dag van de arbeid', 44 | 'pl' => 'Święto Pracy', 45 | 'pt' => 'Dia internacional do trabalhador', 46 | 'pt_PT' => 'Dia do Trabalhador', 47 | 'ro' => 'Ziua internațională a muncii', 48 | 'ru' => 'День международной солидарности трудящихся', 49 | 'sk' => 'Sviatok práce', 50 | 'sl' => 'Praznik dela', 51 | 'sv' => 'första maj', 52 | 'uk' => 'День міжнародної солідарності трудящих', 53 | ]; 54 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Switzerland/Aargau.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Switzerland; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Holiday; 22 | use Yasumi\Provider\ChristianHolidays; 23 | use Yasumi\Provider\Switzerland; 24 | 25 | /** 26 | * Provider for all holidays in Aargau (Switzerland). 27 | * 28 | * @see https://en.wikipedia.org/wiki/Aargau 29 | */ 30 | class Aargau extends Switzerland 31 | { 32 | use ChristianHolidays; 33 | 34 | /** 35 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 36 | * country or sub-region. 37 | */ 38 | public const ID = 'CH-AG'; 39 | 40 | /** 41 | * Initialize holidays for Aargau (Switzerland). 42 | * 43 | * @throws \InvalidArgumentException 44 | * @throws UnknownLocaleException 45 | * @throws \Exception 46 | */ 47 | public function initialize(): void 48 | { 49 | parent::initialize(); 50 | 51 | $this->addHoliday($this->goodFriday($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 52 | $this->addHoliday($this->newYearsDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 53 | $this->addHoliday($this->christmasDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 54 | $this->addHoliday($this->ascensionDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /examples/basic.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // This file demonstrates the general use of Yasumi and its basic methods. 19 | 20 | require 'vendor/autoload.php'; 21 | 22 | // Use the factory to create a new holiday provider instance 23 | $holidays = Yasumi\Yasumi::create('USA', (int) date('Y')); 24 | 25 | // Show the number of defined holidays 26 | echo "Number of defined holidays: {$holidays->count()}" . PHP_EOL; 27 | echo PHP_EOL; 28 | 29 | // Display a list all of the holiday names (short names) 30 | echo 'List of all the holiday names: ' . PHP_EOL; 31 | foreach ($holidays->getHolidayNames() as $name) { 32 | echo $name . PHP_EOL; 33 | } 34 | echo PHP_EOL; 35 | 36 | // Display a list all of the holiday dates 37 | echo 'List of all the holiday dates:' . PHP_EOL; 38 | foreach ($holidays->getHolidayDates() as $date) { 39 | echo $date . PHP_EOL; 40 | } 41 | echo PHP_EOL; 42 | 43 | // Get a holiday instance for Independence Day 44 | $independenceDay = $holidays->getHoliday('independenceDay'); 45 | 46 | // Show the localized name 47 | echo 'Name of the holiday : ' . $independenceDay->getName() . PHP_EOL; 48 | 49 | // Show the date 50 | echo "Date of the holiday : {$independenceDay}" . PHP_EOL; 51 | 52 | // Show the type of holiday 53 | echo 'Type of holiday : ' . $independenceDay->getType() . PHP_EOL; 54 | echo PHP_EOL; 55 | 56 | // Dump the holiday as a JSON object 57 | echo 'Holiday as a JSON object:' . PHP_EOL; 58 | echo json_encode($independenceDay, JSON_PRETTY_PRINT); 59 | 60 | echo PHP_EOL; 61 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Germany/RhinelandPalatinate.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Germany; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Holiday; 22 | use Yasumi\Provider\Germany; 23 | 24 | /** 25 | * Provider for all holidays in Rhineland Palatinate (Germany). 26 | * 27 | * Rhineland-Palatinate (German: Rheinland-Pfalz) is one of the 16 states (German: Bundesländer) of the Federal Republic 28 | * of Germany. It has an area of 19,846 square kilometres (7,663 sq mi) and about four million inhabitants. The city of 29 | * Mainz functions as the state capital. 30 | * 31 | * @see https://en.wikipedia.org/wiki/Rhineland-Palatinate 32 | */ 33 | class RhinelandPalatinate extends Germany 34 | { 35 | /** 36 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 37 | * country or sub-region. 38 | */ 39 | public const ID = 'DE-RP'; 40 | 41 | /** 42 | * Initialize holidays for Rhineland Palatinate (Germany). 43 | * 44 | * @throws \InvalidArgumentException 45 | * @throws UnknownLocaleException 46 | * @throws \Exception 47 | */ 48 | public function initialize(): void 49 | { 50 | parent::initialize(); 51 | 52 | // Add custom Christian holidays 53 | $this->addHoliday($this->corpusChristi($this->year, $this->timezone, $this->locale, Holiday::TYPE_OFFICIAL)); 54 | $this->addHoliday($this->allSaintsDay($this->year, $this->timezone, $this->locale)); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/France/BasRhin.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\France; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Provider\ChristianHolidays; 22 | use Yasumi\Provider\France; 23 | 24 | /** 25 | * Provider for all holidays in Bas-Rhin (France). 26 | * 27 | * Bas-Rhin is a department in the Alsace-Champagne-Ardenne-Lorraine region of France. The name means "Lower Rhine". 28 | * It is the more populous and densely populated of the two departments of the traditional Alsace region, with 1,109,460 29 | * inhabitants in 2013. The prefecture and the General Council are based in Strasbourg. 30 | * 31 | * @see https://en.wikipedia.org/wiki/Bas-Rhin 32 | */ 33 | class BasRhin extends France 34 | { 35 | use ChristianHolidays; 36 | 37 | /** 38 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 39 | * country or sub-region. 40 | */ 41 | public const ID = 'FR-67'; 42 | 43 | /** 44 | * Initialize holidays for Bas-Rhin (France). 45 | * 46 | * @throws \InvalidArgumentException 47 | * @throws UnknownLocaleException 48 | * @throws \Exception 49 | */ 50 | public function initialize(): void 51 | { 52 | parent::initialize(); 53 | 54 | // Add custom Christian holidays 55 | $this->addHoliday($this->goodFriday($this->year, $this->timezone, $this->locale)); 56 | $this->addHoliday($this->stStephensDay($this->year, $this->timezone, $this->locale)); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/France/HautRhin.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\France; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Provider\ChristianHolidays; 22 | use Yasumi\Provider\France; 23 | 24 | /** 25 | * Provider for all holidays in Haut-Rhin (France). 26 | * 27 | * Haut-Rhin is a department in the Alsace-Champagne-Ardenne-Lorraine region of France, named after the Rhine river. 28 | * Its name means Upper Rhine. Haut-Rhin is the smaller and less populated of the two departments of the traditional 29 | * Alsace region, although it is still densely populated compared to the rest of France. 30 | * 31 | * @see https://en.wikipedia.org/wiki/Haut-Rhin 32 | */ 33 | class HautRhin extends France 34 | { 35 | use ChristianHolidays; 36 | 37 | /** 38 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 39 | * country or sub-region. 40 | */ 41 | public const ID = 'FR-68'; 42 | 43 | /** 44 | * Initialize holidays for Haut-Rhin (France). 45 | * 46 | * @throws \InvalidArgumentException 47 | * @throws UnknownLocaleException 48 | * @throws \Exception 49 | */ 50 | public function initialize(): void 51 | { 52 | parent::initialize(); 53 | 54 | // Add custom Christian holidays 55 | $this->addHoliday($this->goodFriday($this->year, $this->timezone, $this->locale)); 56 | $this->addHoliday($this->stStephensDay($this->year, $this->timezone, $this->locale)); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Switzerland/Solothurn.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Switzerland; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Holiday; 22 | use Yasumi\Provider\ChristianHolidays; 23 | use Yasumi\Provider\Switzerland; 24 | 25 | /** 26 | * Provider for all holidays in Solothurn (Switzerland). 27 | * 28 | * @see https://en.wikipedia.org/wiki/Canton_of_Solothurn 29 | */ 30 | class Solothurn extends Switzerland 31 | { 32 | use ChristianHolidays; 33 | 34 | /** 35 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 36 | * country or sub-region. 37 | */ 38 | public const ID = 'CH-SO'; 39 | 40 | /** 41 | * Initialize holidays for Solothurn (Switzerland). 42 | * 43 | * @throws \InvalidArgumentException 44 | * @throws UnknownLocaleException 45 | * @throws \Exception 46 | */ 47 | public function initialize(): void 48 | { 49 | parent::initialize(); 50 | 51 | $this->addHoliday($this->goodFriday($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 52 | $this->addHoliday($this->newYearsDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 53 | $this->addHoliday($this->christmasDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 54 | $this->addHoliday($this->ascensionDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 55 | 56 | $this->calculateBerchtoldsTag(); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /examples/custom_provider.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | // This file demonstrates the use of a custom Holiday provider. A custom holiday provider can be used for 19 | // those scenarios where you would need only a subset of holidays of an existing provider. Or, if you like to 20 | // extend an existing provider with additional, non-standard holidays. 21 | 22 | require 'vendor/autoload.php'; 23 | 24 | /** Provider for all observed holidays by the NYSE (New York Stock Exchange) */ 25 | class NYSE extends Yasumi\Provider\USA 26 | { 27 | /** 28 | * Initialize holidays for the NYSE. 29 | * 30 | * @throws Exception 31 | */ 32 | public function initialize(): void 33 | { 34 | parent::initialize(); 35 | 36 | // Add Good Friday 37 | $this->addHoliday($this->goodFriday($this->year, $this->timezone, $this->locale)); 38 | 39 | // Remove Columbus Day and Veterans Day 40 | $this->removeHoliday('columbusDay'); 41 | $this->removeHoliday('veteransDay'); 42 | } 43 | } 44 | 45 | // Use the factory method to create a new holiday provider instance 46 | $NYSEHolidays = Yasumi\Yasumi::create(NYSE::class, (int) date('Y')); 47 | 48 | // We then can retrieve the NYSE observed holidays in the usual manner: 49 | echo 'List of all the holiday names: ' . PHP_EOL; 50 | foreach ($NYSEHolidays->getHolidayNames() as $day) { 51 | echo $day . PHP_EOL; 52 | } 53 | echo PHP_EOL; 54 | 55 | // Use the count() method to show how many holidays are returned 56 | echo "Number of defined holidays: {$NYSEHolidays->count()}" . PHP_EOL; 57 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Spain/Navarre.php: -------------------------------------------------------------------------------- 1 | 14 | */ 15 | 16 | namespace Yasumi\Provider\Spain; 17 | 18 | use Yasumi\Exception\UnknownLocaleException; 19 | use Yasumi\Holiday; 20 | use Yasumi\Provider\ChristianHolidays; 21 | use Yasumi\Provider\Spain; 22 | 23 | /** 24 | * Provider for all holidays in Navarre (Spain). 25 | * 26 | * Navarre, officially the Chartered Community of Navarre, is an autonomous community in northern Spain, bordering the 27 | * Basque Country, La Rioja, and Aragon in Spain and Aquitaine in France. The capital city is Pamplona (or Iruña in 28 | * Basque). 29 | * 30 | * @see https://en.wikipedia.org/wiki/Navarre 31 | */ 32 | class Navarre extends Spain 33 | { 34 | use ChristianHolidays; 35 | 36 | /** 37 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 38 | * country or sub-region. 39 | */ 40 | public const ID = 'ES-NC'; 41 | 42 | /** 43 | * Initialize holidays for Navarre (Spain). 44 | * 45 | * @throws \InvalidArgumentException 46 | * @throws UnknownLocaleException 47 | * @throws \Exception 48 | */ 49 | public function initialize(): void 50 | { 51 | parent::initialize(); 52 | 53 | // Add custom Christian holidays 54 | $this->addHoliday($this->stJosephsDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OBSERVANCE)); 55 | $this->addHoliday($this->maundyThursday($this->year, $this->timezone, $this->locale, Holiday::TYPE_OBSERVANCE)); 56 | $this->addHoliday($this->easterMonday($this->year, $this->timezone, $this->locale, Holiday::TYPE_OBSERVANCE)); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Australia/Tasmania/Northwest.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Australia\Tasmania; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Holiday; 22 | use Yasumi\Provider\Australia\Tasmania; 23 | use Yasumi\Provider\DateTimeZoneFactory; 24 | 25 | /** 26 | * Provider for all holidays in northwestern Tasmania (Australia). 27 | */ 28 | class Northwest extends Tasmania 29 | { 30 | /** 31 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 32 | * country or sub-region. This one is not a proper ISO3166 code, but there aren't any for areas within Tasmania, 33 | * and I believe it to be a logical extension. 34 | */ 35 | public const ID = 'AU-TAS-NW'; 36 | 37 | /** 38 | * Initialize holidays for northwestern Tasmania (Australia). 39 | * 40 | * @throws \InvalidArgumentException 41 | * @throws UnknownLocaleException 42 | * @throws \Exception 43 | */ 44 | public function initialize(): void 45 | { 46 | parent::initialize(); 47 | 48 | $this->calculateBurnieShow(); 49 | } 50 | 51 | /** 52 | * Burnie Show. 53 | * 54 | * @throws \Exception 55 | */ 56 | protected function calculateBurnieShow(): void 57 | { 58 | $date = new \DateTime("first saturday of october {$this->year}", DateTimeZoneFactory::getDateTimeZone($this->timezone)); 59 | $date = $date->sub(new \DateInterval('P1D')); 60 | $this->addHoliday(new Holiday('burnieShow', ['en' => 'Burnie Show'], $date, $this->locale)); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Australia/Tasmania/Northwest/CircularHead.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Australia\Tasmania\Northwest; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Holiday; 22 | use Yasumi\Provider\Australia\Tasmania\Northwest; 23 | use Yasumi\Provider\DateTimeZoneFactory; 24 | 25 | /** 26 | * Provider for all holidays in Circular Head (Australia). 27 | */ 28 | class CircularHead extends Northwest 29 | { 30 | /** 31 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 32 | * country or sub-region. This one is not a proper ISO3166 code, but there aren't any for areas within Tasmania, 33 | * and I believe it to be a logical extension. 34 | */ 35 | public const ID = 'AU-TAS-NW-CH'; 36 | 37 | /** 38 | * Initialize holidays for Circular Head (Australia). 39 | * 40 | * @throws \InvalidArgumentException 41 | * @throws UnknownLocaleException 42 | * @throws \Exception 43 | */ 44 | public function initialize(): void 45 | { 46 | parent::initialize(); 47 | 48 | $this->calculateAGFEST(); 49 | } 50 | 51 | /** 52 | * AGFEST. 53 | * 54 | * @throws \Exception 55 | */ 56 | protected function calculateAGFEST(): void 57 | { 58 | $date = new \DateTime("first thursday of may {$this->year}", DateTimeZoneFactory::getDateTimeZone($this->timezone)); 59 | $date = $date->add(new \DateInterval('P1D')); 60 | $this->addHoliday(new Holiday('agfest', ['en' => 'AGFEST'], $date, $this->locale)); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Australia/Tasmania/South.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Australia\Tasmania; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Holiday; 22 | use Yasumi\Provider\Australia\Tasmania; 23 | use Yasumi\Provider\DateTimeZoneFactory; 24 | 25 | /** 26 | * Provider for all holidays in southern Tasmania (Australia). 27 | */ 28 | class South extends Tasmania 29 | { 30 | /** 31 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 32 | * country or sub-region. This one is not a proper ISO3166 code, but there aren't any for areas within Tasmania, 33 | * and I believe it to be a logical extension. 34 | */ 35 | public const ID = 'AU-TAS-SOU'; 36 | 37 | /** 38 | * Initialize holidays for southern Tasmania (Australia). 39 | * 40 | * @throws \InvalidArgumentException 41 | * @throws UnknownLocaleException 42 | * @throws \Exception 43 | */ 44 | public function initialize(): void 45 | { 46 | parent::initialize(); 47 | 48 | $this->calculateHobartShow(); 49 | } 50 | 51 | /** 52 | * Royal Hobart Show. 53 | * 54 | * @throws \Exception 55 | */ 56 | protected function calculateHobartShow(): void 57 | { 58 | $date = new \DateTime("fourth saturday of october {$this->year}", DateTimeZoneFactory::getDateTimeZone($this->timezone)); 59 | $date = $date->sub(new \DateInterval('P2D')); 60 | $this->addHoliday(new Holiday('hobartShow', ['en' => 'Royal Hobart Show'], $date, $this->locale)); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "azuyalabs/yasumi", 3 | "description": "The easy PHP Library for calculating holidays", 4 | "license": "MIT", 5 | "type": "library", 6 | "keywords": [ 7 | "holiday", 8 | "holidays", 9 | "calendar", 10 | "calculation", 11 | "celebration", 12 | "date", 13 | "time", 14 | "bank", 15 | "national" 16 | ], 17 | "readme": "README.md", 18 | "authors": [ 19 | { 20 | "name": "Sacha Telgenhof", 21 | "email": "me@sachatelgenhof.com", 22 | "homepage": "https://www.sachatelgenhof.com", 23 | "role": "Maintainer" 24 | } 25 | ], 26 | "homepage": "https://www.yasumi.dev", 27 | "support": { 28 | "issues": "https://github.com/azuyalabs/yasumi/issues", 29 | "source": "https://github.com/azuyalabs/yasumi", 30 | "docs": "https://www.yasumi.dev" 31 | }, 32 | "funding": [ 33 | { 34 | "type": "other", 35 | "url": "https://www.buymeacoffee.com/sachatelgenhof" 36 | } 37 | ], 38 | "require": { 39 | "php": ">=8.1", 40 | "ext-json": "*" 41 | }, 42 | "require-dev": { 43 | "ext-intl": "*", 44 | "azuyalabs/php-cs-fixer-config": "^0.3", 45 | "mikey179/vfsstream": "^1.6", 46 | "phpstan/phpstan": "^2.1", 47 | "phpstan/phpstan-deprecation-rules": "^2.0", 48 | "phpunit/phpunit": "^8.5 || ^9.6" 49 | }, 50 | "suggest": { 51 | "ext-calendar": "For calculating the date of Easter" 52 | }, 53 | "prefer-stable": true, 54 | "autoload": { 55 | "psr-4": { 56 | "Yasumi\\": "src/Yasumi/" 57 | } 58 | }, 59 | "autoload-dev": { 60 | "psr-4": { 61 | "Yasumi\\tests\\": "tests/" 62 | } 63 | }, 64 | "config": { 65 | "allow-plugins": { 66 | "composer/package-versions-deprecated": true 67 | }, 68 | "sort-packages": true 69 | }, 70 | "scripts": { 71 | "cs": "vendor/bin/php-cs-fixer fix -v --diff --dry-run", 72 | "cs-fix": "vendor/bin/php-cs-fixer fix -v", 73 | "phpstan": "vendor/bin/phpstan analyse", 74 | "test": "vendor/bin/phpunit" 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/France/Moselle.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\France; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Provider\ChristianHolidays; 22 | use Yasumi\Provider\France; 23 | 24 | /** 25 | * Provider for all holidays in Moselle (France). 26 | * 27 | * Moselle is one of the original 83 departments created during the French Revolution on March 4, 1790. It was created 28 | * from the former province of Lorraine. In 1793 France annexed the German enclaves of Manderen, Lixing-lès-Rouhling, 29 | * Momerstroff, and Créhange (Kriechingen) - all possessions of princes of the German Holy Roman Empire - and 30 | * incorporated them into the Moselle département. 31 | * 32 | * @see https://en.wikipedia.org/wiki/Moselle_(department) 33 | */ 34 | class Moselle extends France 35 | { 36 | use ChristianHolidays; 37 | 38 | /** 39 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 40 | * country or sub-region. 41 | */ 42 | public const ID = 'FR-57'; 43 | 44 | /** 45 | * Initialize holidays for Moselle (France). 46 | * 47 | * @throws \InvalidArgumentException 48 | * @throws UnknownLocaleException 49 | * @throws \Exception 50 | */ 51 | public function initialize(): void 52 | { 53 | parent::initialize(); 54 | 55 | // Add custom Christian holidays 56 | $this->addHoliday($this->goodFriday($this->year, $this->timezone, $this->locale)); 57 | $this->addHoliday($this->stStephensDay($this->year, $this->timezone, $this->locale)); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Germany/BadenWurttemberg.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Germany; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Holiday; 22 | use Yasumi\Provider\Germany; 23 | 24 | /** 25 | * Provider for all holidays in Baden-Württemberg (Germany). 26 | * 27 | * Baden-Württemberg is a state in Germany located in the southwest, east of the Upper Rhine. It is Germany’s 28 | * third-largest state in terms of size and population, with an area of 36,410 square kilometres (14,060 sq mi) and 10.7 29 | * million inhabitants. The state capital and largest city is Stuttgart. 30 | * 31 | * @see https://en.wikipedia.org/wiki/Baden-W%C3%BCrttemberg 32 | */ 33 | class BadenWurttemberg extends Germany 34 | { 35 | /** 36 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 37 | * country or sub-region. 38 | */ 39 | public const ID = 'DE-BW'; 40 | 41 | /** 42 | * Initialize holidays for Baden-Württemberg (Germany). 43 | * 44 | * @throws \InvalidArgumentException 45 | * @throws UnknownLocaleException 46 | * @throws \Exception 47 | */ 48 | public function initialize(): void 49 | { 50 | parent::initialize(); 51 | 52 | // Add custom Christian holidays 53 | $this->addHoliday($this->epiphany($this->year, $this->timezone, $this->locale)); 54 | $this->addHoliday($this->corpusChristi($this->year, $this->timezone, $this->locale, Holiday::TYPE_OFFICIAL)); 55 | $this->addHoliday($this->allSaintsDay($this->year, $this->timezone, $this->locale)); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Spain/Melilla.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Spain; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Holiday; 22 | use Yasumi\Provider\ChristianHolidays; 23 | use Yasumi\Provider\Spain; 24 | 25 | /** 26 | * Provider for all holidays in Melilla (Spain). 27 | * 28 | * Melilla is a Spanish city located on the north coast of Africa, sharing a border with Morocco with an area of 12.3 29 | * square kilometres (4.7 sq mi). Melilla, along with Ceuta, is one of two permanently inhabited Spanish cities in 30 | * mainland Africa. It was part of Málaga province until 14 March 1995, when the city's Statute of Autonomy was passed. 31 | * 32 | * @see https://en.wikipedia.org/wiki/Melilla 33 | */ 34 | class Melilla extends Spain 35 | { 36 | use ChristianHolidays; 37 | 38 | /** 39 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 40 | * country or sub-region. 41 | */ 42 | public const ID = 'ES-ML'; 43 | 44 | /** 45 | * Initialize holidays for Melilla (Spain). 46 | * 47 | * @throws \InvalidArgumentException 48 | * @throws UnknownLocaleException 49 | * @throws \Exception 50 | */ 51 | public function initialize(): void 52 | { 53 | parent::initialize(); 54 | 55 | // Add custom Christian holidays 56 | $this->addHoliday($this->stJosephsDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OBSERVANCE)); 57 | $this->addHoliday($this->maundyThursday($this->year, $this->timezone, $this->locale, Holiday::TYPE_OBSERVANCE)); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Australia/Tasmania/Northeast.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Australia\Tasmania; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Holiday; 22 | use Yasumi\Provider\Australia\Tasmania; 23 | use Yasumi\Provider\DateTimeZoneFactory; 24 | 25 | /** 26 | * Provider for all holidays in northeastern Tasmania (Australia). 27 | */ 28 | class Northeast extends Tasmania 29 | { 30 | /** 31 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 32 | * country or sub-region. This one is not a proper ISO3166 code, but there aren't any for areas within Tasmania, 33 | * and I believe it to be a logical extension. 34 | */ 35 | public const ID = 'AU-TAS-NE'; 36 | 37 | /** 38 | * Initialize holidays for northeastern Tasmania (Australia). 39 | * 40 | * @throws \InvalidArgumentException 41 | * @throws UnknownLocaleException 42 | * @throws \Exception 43 | */ 44 | public function initialize(): void 45 | { 46 | parent::initialize(); 47 | 48 | $this->calculateLauncestonShow(); 49 | } 50 | 51 | /** 52 | * Royal Launceston Show. 53 | * 54 | * @throws \Exception 55 | */ 56 | protected function calculateLauncestonShow(): void 57 | { 58 | $date = new \DateTime("second saturday of october {$this->year}", DateTimeZoneFactory::getDateTimeZone($this->timezone)); 59 | $date = $date->sub(new \DateInterval('P2D')); 60 | $this->addHoliday(new Holiday('launcestonShow', ['en' => 'Royal Launceston Show'], $date, $this->locale)); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Germany/Bavaria.php: -------------------------------------------------------------------------------- 1 | 14 | */ 15 | 16 | namespace Yasumi\Provider\Germany; 17 | 18 | use Yasumi\Exception\UnknownLocaleException; 19 | use Yasumi\Holiday; 20 | use Yasumi\Provider\Germany; 21 | 22 | /** 23 | * Provider for all holidays in Bavaria (Germany). 24 | * 25 | * Bavaria is a federal state of Germany. In the southeast of the country with an area of 70,548 square kilometres 26 | * (27,200 sq mi), it is the largest state, making up almost a fifth of the total land area of Germany, and, with 12.6 27 | * million inhabitants, Germany's second most populous state. Munich, Bavaria's capital and largest city, is the 28 | * third-largest city in Germany. 29 | * 30 | * @see https://en.wikipedia.org/wiki/Bavaria 31 | */ 32 | class Bavaria extends Germany 33 | { 34 | /** 35 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 36 | * country or sub-region. 37 | */ 38 | public const ID = 'DE-BY'; 39 | 40 | /** 41 | * @throws \InvalidArgumentException 42 | * @throws UnknownLocaleException 43 | * @throws \Exception 44 | */ 45 | public function initialize(): void 46 | { 47 | parent::initialize(); 48 | 49 | // Add custom Christian holidays 50 | $this->addHoliday($this->epiphany($this->year, $this->timezone, $this->locale)); 51 | $this->addHoliday($this->corpusChristi($this->year, $this->timezone, $this->locale, Holiday::TYPE_OFFICIAL)); 52 | $this->addHoliday($this->allSaintsDay($this->year, $this->timezone, $this->locale)); 53 | $this->addHoliday($this->assumptionOfMary($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Australia/Tasmania/FlindersIsland.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Australia\Tasmania; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Holiday; 22 | use Yasumi\Provider\Australia\Tasmania; 23 | use Yasumi\Provider\DateTimeZoneFactory; 24 | 25 | /** 26 | * Provider for all holidays in Flinders Island (Australia). 27 | */ 28 | class FlindersIsland extends Tasmania 29 | { 30 | /** 31 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 32 | * country or sub-region. This one is not a proper ISO3166 code, but there aren't any for areas within Tasmania, 33 | * and I believe it to be a logical extension. 34 | */ 35 | public const ID = 'AU-TAS-FI'; 36 | 37 | /** 38 | * Initialize holidays for Flinders Island (Australia). 39 | * 40 | * @throws \InvalidArgumentException 41 | * @throws UnknownLocaleException 42 | * @throws \Exception 43 | */ 44 | public function initialize(): void 45 | { 46 | parent::initialize(); 47 | 48 | $this->calculateFlindersIslandShow(); 49 | } 50 | 51 | /** 52 | * Flinders Island Show. 53 | * 54 | * @throws \Exception 55 | */ 56 | protected function calculateFlindersIslandShow(): void 57 | { 58 | $date = new \DateTime("third saturday of october {$this->year}", DateTimeZoneFactory::getDateTimeZone($this->timezone)); 59 | $date = $date->sub(new \DateInterval('P1D')); 60 | $this->addHoliday(new Holiday('flindersIslandShow', ['en' => 'Flinders Island Show'], $date, $this->locale)); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Australia/Tasmania/KingIsland.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Australia\Tasmania; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Holiday; 22 | use Yasumi\Provider\Australia\Tasmania; 23 | use Yasumi\Provider\DateTimeZoneFactory; 24 | 25 | /** 26 | * Provider for all holidays in King Island (Australia). 27 | */ 28 | class KingIsland extends Tasmania 29 | { 30 | /** 31 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 32 | * country or sub-region. This one is not a proper ISO3166 code, but there aren't any for areas within Tasmania, 33 | * and I believe it to be a logical extension. 34 | */ 35 | public const ID = 'AU-TAS-KI'; 36 | 37 | /** 38 | * Initialize holidays for King Island (Australia). 39 | * 40 | * @throws \InvalidArgumentException 41 | * @throws UnknownLocaleException 42 | * @throws \Exception 43 | */ 44 | public function initialize(): void 45 | { 46 | parent::initialize(); 47 | 48 | $this->calculateKingIslandShow(); 49 | } 50 | 51 | /** 52 | * King Island Show. 53 | * 54 | * @throws \Exception 55 | */ 56 | protected function calculateKingIslandShow(): void 57 | { 58 | $this->addHoliday(new Holiday( 59 | 'kingIslandShow', 60 | ['en' => 'King Island Show'], 61 | new \DateTime("first tuesday of march {$this->year}", DateTimeZoneFactory::getDateTimeZone($this->timezone)), 62 | $this->locale, 63 | Holiday::TYPE_OFFICIAL 64 | )); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Germany/Hesse.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Germany; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Holiday; 22 | use Yasumi\Provider\Germany; 23 | 24 | /** 25 | * Provider for all holidays in Hesse (Germany). 26 | * 27 | * Hesse is a federal state (Land) of the Federal Republic of Germany, with just over six million inhabitants. The state 28 | * capital is Wiesbaden; the largest city is Frankfurt am Main. Until the formation of the German Reich in 1871, Hesse 29 | * was an independent country ruled by a Grand Duke (Grand Duchy of Hesse). Due to divisions after World War II, the 30 | * modern federal state does not cover the entire cultural region of Hesse which includes both the State of Hesse and 31 | * the area known as Rhenish Hesse (Rheinhessen) in the neighbouring state of Rhineland-Palatinate. 32 | * 33 | * @see https://en.wikipedia.org/wiki/Hesse 34 | */ 35 | class Hesse extends Germany 36 | { 37 | /** 38 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 39 | * country or sub-region. 40 | */ 41 | public const ID = 'DE-HE'; 42 | 43 | /** 44 | * Initialize holidays for Hesse (Germany). 45 | * 46 | * @throws \InvalidArgumentException 47 | * @throws UnknownLocaleException 48 | * @throws \Exception 49 | */ 50 | public function initialize(): void 51 | { 52 | parent::initialize(); 53 | 54 | // Add custom Christian holidays 55 | $this->addHoliday($this->corpusChristi($this->year, $this->timezone, $this->locale, Holiday::TYPE_OFFICIAL)); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Spain/Aragon.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Spain; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Holiday; 22 | use Yasumi\Provider\ChristianHolidays; 23 | use Yasumi\Provider\Spain; 24 | 25 | /** 26 | * Provider for all holidays in Aragon (Spain). 27 | * 28 | * Aragon is an autonomous community in Spain, coextensive with the medieval Kingdom of Aragon. Located in northeastern 29 | * Spain, the Aragonese autonomous community comprises three provinces (from north to south): Huesca, Zaragoza, and 30 | * Teruel. Its capital is Zaragoza (also called Saragossa in English). The current Statute of Autonomy declares Aragon a 31 | * nationality of Spain. 32 | * 33 | * @see https://en.wikipedia.org/wiki/Aragon 34 | */ 35 | class Aragon extends Spain 36 | { 37 | use ChristianHolidays; 38 | 39 | /** 40 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 41 | * country or sub-region. 42 | */ 43 | public const ID = 'ES-AR'; 44 | 45 | /** 46 | * Initialize holidays for Aragon (Spain). 47 | * 48 | * @throws \InvalidArgumentException 49 | * @throws UnknownLocaleException 50 | * @throws \Exception 51 | */ 52 | public function initialize(): void 53 | { 54 | parent::initialize(); 55 | 56 | // Add custom Christian holidays 57 | $this->addHoliday($this->maundyThursday($this->year, $this->timezone, $this->locale, Holiday::TYPE_OBSERVANCE)); 58 | $this->addHoliday($this->stGeorgesDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OBSERVANCE)); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Germany/Saarland.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Germany; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Holiday; 22 | use Yasumi\Provider\Germany; 23 | 24 | /** 25 | * Provider for all holidays in Saarland (Germany). 26 | * 27 | * The Saarland (German: das Saarland) is one of the sixteen federal states (or Bundesländer) of Germany. With its 28 | * capital at Saarbrücken, it has an area of 2,570 km² and its population (as of 30 April 2012) is approximately 29 | * 1,012,000. In terms of both area and population size – apart from the city-states of Berlin, Bremen and Hamburg – it 30 | * is Germany's smallest federal state. 31 | * 32 | * @see https://en.wikipedia.org/wiki/Saarland 33 | */ 34 | class Saarland extends Germany 35 | { 36 | /** 37 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 38 | * country or sub-region. 39 | */ 40 | public const ID = 'DE-SL'; 41 | 42 | /** 43 | * Initialize holidays for Saarland (Germany). 44 | * 45 | * @throws \InvalidArgumentException 46 | * @throws UnknownLocaleException 47 | * @throws \Exception 48 | */ 49 | public function initialize(): void 50 | { 51 | parent::initialize(); 52 | 53 | // Add custom Christian holidays 54 | $this->addHoliday($this->corpusChristi($this->year, $this->timezone, $this->locale, Holiday::TYPE_OFFICIAL)); 55 | $this->addHoliday($this->allSaintsDay($this->year, $this->timezone, $this->locale)); 56 | $this->addHoliday($this->assumptionOfMary($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Germany/NorthRhineWestphalia.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Germany; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Holiday; 22 | use Yasumi\Provider\Germany; 23 | 24 | /** 25 | * Provider for all holidays in North Rhine-Westphalia (Germany). 26 | * 27 | * North Rhine-Westphalia (German: Nordrhein-Westfalen), commonly shortened NRW) is the most populous state of Germany, 28 | * with a population of approximately 18 million, and the fourth-largest by area. Its capital is Düsseldorf; the biggest 29 | * city is Cologne. Four of Germany's ten biggest cities—Cologne, Düsseldorf, Dortmund, and Essen—are located within the 30 | * state, as well as the biggest metropolitan area of the European continent, Rhine-Ruhr. 31 | * 32 | * @see https://en.wikipedia.org/wiki/North_Rhine-Westphalia 33 | */ 34 | class NorthRhineWestphalia extends Germany 35 | { 36 | /** 37 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 38 | * country or sub-region. 39 | */ 40 | public const ID = 'DE-NW'; 41 | 42 | /** 43 | * Initialize holidays for North Rhine-Westphalia (Germany). 44 | * 45 | * @throws \InvalidArgumentException 46 | * @throws UnknownLocaleException 47 | * @throws \Exception 48 | */ 49 | public function initialize(): void 50 | { 51 | parent::initialize(); 52 | 53 | // Add custom Christian holidays 54 | $this->addHoliday($this->corpusChristi($this->year, $this->timezone, $this->locale, Holiday::TYPE_OFFICIAL)); 55 | $this->addHoliday($this->allSaintsDay($this->year, $this->timezone, $this->locale)); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Australia/Tasmania/South/Southeast.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Australia\Tasmania\South; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Holiday; 22 | use Yasumi\Provider\Australia\Tasmania\South; 23 | use Yasumi\Provider\DateTimeZoneFactory; 24 | 25 | /** 26 | * Provider for all holidays in southeastern Tasmania (Australia). 27 | */ 28 | class Southeast extends South 29 | { 30 | /** 31 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 32 | * country or sub-region. This one is not a proper ISO3166 code, but there aren't any for areas within Tasmania, 33 | * and I believe it to be a logical extension. 34 | */ 35 | public const ID = 'AU-TAS-SOU-SE'; 36 | 37 | public string $timezone = 'Australia/Hobart'; 38 | 39 | /** 40 | * Initialize holidays for southeastern Tasmania (Australia). 41 | * 42 | * @throws \InvalidArgumentException 43 | * @throws UnknownLocaleException 44 | * @throws \Exception 45 | */ 46 | public function initialize(): void 47 | { 48 | parent::initialize(); 49 | 50 | $this->removeHoliday('recreationDay'); 51 | $this->calculateHobartRegatta(); 52 | } 53 | 54 | /** 55 | * Royal Hobart Regatta. 56 | * 57 | * @throws \Exception 58 | */ 59 | protected function calculateHobartRegatta(): void 60 | { 61 | $this->addHoliday(new Holiday( 62 | 'hobartRegatta', 63 | ['en' => 'Royal Hobart Regatta'], 64 | new \DateTime("second monday of february {$this->year}", DateTimeZoneFactory::getDateTimeZone($this->timezone)), 65 | $this->locale, 66 | Holiday::TYPE_OFFICIAL 67 | )); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Australia/Tasmania/CentralNorth.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Australia\Tasmania; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Holiday; 22 | use Yasumi\Provider\Australia\Tasmania; 23 | use Yasumi\Provider\DateTimeZoneFactory; 24 | 25 | /** 26 | * Provider for all holidays in central north Tasmania (Australia). 27 | */ 28 | class CentralNorth extends Tasmania 29 | { 30 | /** 31 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 32 | * country or sub-region. This one is not a proper ISO3166 code, but there aren't any for areas within Tasmania, 33 | * and I believe it to be a logical extension. 34 | */ 35 | public const ID = 'AU-TAS-CN'; 36 | 37 | /** 38 | * Initialize holidays for northeastern Tasmania (Australia). 39 | * 40 | * @throws \InvalidArgumentException 41 | * @throws UnknownLocaleException 42 | * @throws \Exception 43 | */ 44 | public function initialize(): void 45 | { 46 | parent::initialize(); 47 | 48 | $this->calculateDevonportShow(); 49 | } 50 | 51 | /** 52 | * Devonport Show. 53 | * 54 | * @throws \Exception 55 | */ 56 | protected function calculateDevonportShow(): void 57 | { 58 | $date = new \DateTime("{$this->year}-12-02", DateTimeZoneFactory::getDateTimeZone($this->timezone)); 59 | $date = $date->modify('previous friday'); 60 | 61 | if (! $date instanceof \DateTime) { 62 | throw new \RuntimeException(sprintf('unable to perform a date subtraction for %s:%s', self::class, 'devonportShow')); 63 | } 64 | 65 | $this->addHoliday(new Holiday('devonportShow', ['en' => 'Devonport Show'], $date, $this->locale)); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Switzerland/Grisons.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Switzerland; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Holiday; 22 | use Yasumi\Provider\ChristianHolidays; 23 | use Yasumi\Provider\Switzerland; 24 | 25 | /** 26 | * Provider for all holidays in Grisons (Switzerland). 27 | * 28 | * @see https://en.wikipedia.org/wiki/Grisons 29 | */ 30 | class Grisons extends Switzerland 31 | { 32 | use ChristianHolidays; 33 | 34 | /** 35 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 36 | * country or sub-region. 37 | */ 38 | public const ID = 'CH-GR'; 39 | 40 | /** 41 | * Initialize holidays for Grisons (Switzerland). 42 | * 43 | * @throws \InvalidArgumentException 44 | * @throws UnknownLocaleException 45 | * @throws \Exception 46 | */ 47 | public function initialize(): void 48 | { 49 | parent::initialize(); 50 | 51 | $this->addHoliday($this->goodFriday($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 52 | $this->addHoliday($this->stStephensDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 53 | $this->addHoliday($this->newYearsDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 54 | $this->addHoliday($this->christmasDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 55 | $this->addHoliday($this->ascensionDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 56 | $this->addHoliday($this->easterMonday($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 57 | $this->addHoliday($this->pentecostMonday($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Canada/Alberta.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Canada; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Holiday; 22 | use Yasumi\Provider\Canada; 23 | use Yasumi\Provider\DateTimeZoneFactory; 24 | 25 | /** 26 | * Provider for all holidays in Alberta (Canada). 27 | * 28 | * Alberta is a province of Canada. 29 | * 30 | * @see https://en.wikipedia.org/wiki/Alberta 31 | */ 32 | class Alberta extends Canada 33 | { 34 | /** 35 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 36 | * country or sub-region. 37 | */ 38 | public const ID = 'CA-AB'; 39 | 40 | /** 41 | * Initialize holidays for Alberta (Canada). 42 | * 43 | * @throws \InvalidArgumentException 44 | * @throws UnknownLocaleException 45 | * @throws \Exception 46 | */ 47 | public function initialize(): void 48 | { 49 | parent::initialize(); 50 | 51 | $this->timezone = 'America/Edmonton'; 52 | 53 | $this->calculateHeritageDay(); 54 | $this->calculateFamilyDay(); 55 | $this->calculateVictoriaDay(); 56 | } 57 | 58 | /** 59 | * Heritage Day. 60 | * 61 | * @see https://en.wikipedia.org/wiki/Civic_Holiday 62 | * 63 | * @throws \InvalidArgumentException 64 | * @throws UnknownLocaleException 65 | * @throws \Exception 66 | */ 67 | protected function calculateHeritageDay(): void 68 | { 69 | if ($this->year < 1879) { 70 | return; 71 | } 72 | 73 | $this->addHoliday(new Holiday( 74 | 'heritageDay', 75 | [], 76 | new \DateTime("first monday of august {$this->year}", DateTimeZoneFactory::getDateTimeZone($this->timezone)), 77 | $this->locale 78 | )); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Switzerland/Vaud.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Switzerland; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Holiday; 22 | use Yasumi\Provider\ChristianHolidays; 23 | use Yasumi\Provider\Switzerland; 24 | 25 | /** 26 | * Provider for all holidays in Vaud (Switzerland). 27 | * 28 | * @see https://en.wikipedia.org/wiki/Vaud 29 | * @see https://www.vd.ch/themes/formation/jours-feries-et-vacances-scolaires/ 30 | */ 31 | class Vaud extends Switzerland 32 | { 33 | use ChristianHolidays; 34 | 35 | /** 36 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 37 | * country or sub-region. 38 | */ 39 | public const ID = 'CH-VD'; 40 | 41 | /** 42 | * Initialize holidays for Vaud (Switzerland). 43 | * 44 | * @throws \InvalidArgumentException 45 | * @throws UnknownLocaleException 46 | * @throws \Exception 47 | */ 48 | public function initialize(): void 49 | { 50 | parent::initialize(); 51 | 52 | $this->addHoliday($this->goodFriday($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 53 | $this->addHoliday($this->newYearsDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 54 | $this->addHoliday($this->christmasDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 55 | $this->addHoliday($this->ascensionDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 56 | $this->addHoliday($this->easterMonday($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 57 | $this->addHoliday($this->pentecostMonday($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 58 | 59 | $this->calculateBerchtoldsTag(); 60 | $this->calculateBettagsMontag(); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Canada/Saskatchewan.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Canada; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Holiday; 22 | use Yasumi\Provider\Canada; 23 | use Yasumi\Provider\DateTimeZoneFactory; 24 | 25 | /** 26 | * Provider for all holidays in Saskatchewan (Canada). 27 | * 28 | * Saskatchewan is a province of Canada. 29 | * 30 | * @see https://en.wikipedia.org/wiki/Saskatchewan 31 | */ 32 | class Saskatchewan extends Canada 33 | { 34 | /** 35 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 36 | * country or sub-region. 37 | */ 38 | public const ID = 'CA-SK'; 39 | 40 | /** 41 | * Initialize holidays for Saskatchewan (Canada). 42 | * 43 | * @throws \InvalidArgumentException 44 | * @throws UnknownLocaleException 45 | * @throws \Exception 46 | */ 47 | public function initialize(): void 48 | { 49 | parent::initialize(); 50 | 51 | $this->timezone = 'America/Regina'; 52 | 53 | $this->calculateSaskatchewanDay(); 54 | $this->calculateFamilyDay(); 55 | $this->calculateVictoriaDay(); 56 | } 57 | 58 | /** 59 | * Civic Holiday. 60 | * 61 | * @see https://en.wikipedia.org/wiki/Civic_Holiday 62 | * 63 | * @throws \InvalidArgumentException 64 | * @throws UnknownLocaleException 65 | * @throws \Exception 66 | */ 67 | protected function calculateSaskatchewanDay(): void 68 | { 69 | if ($this->year < 1879) { 70 | return; 71 | } 72 | 73 | $this->addHoliday(new Holiday( 74 | 'saskatchewanDay', 75 | [], 76 | new \DateTime("first monday of august {$this->year}", DateTimeZoneFactory::getDateTimeZone($this->timezone)), 77 | $this->locale 78 | )); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Switzerland/AppenzellAusserrhoden.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Switzerland; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Holiday; 22 | use Yasumi\Provider\ChristianHolidays; 23 | use Yasumi\Provider\Switzerland; 24 | 25 | /** 26 | * Provider for all holidays in Appenzell Ausserrhoden (Switzerland). 27 | * 28 | * @see https://en.wikipedia.org/wiki/Appenzell_Ausserrhoden 29 | */ 30 | class AppenzellAusserrhoden extends Switzerland 31 | { 32 | use ChristianHolidays; 33 | 34 | /** 35 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 36 | * country or sub-region. 37 | */ 38 | public const ID = 'CH-AR'; 39 | 40 | /** 41 | * Initialize holidays for Appenzell Ausserrhoden (Switzerland). 42 | * 43 | * @throws \InvalidArgumentException 44 | * @throws UnknownLocaleException 45 | * @throws \Exception 46 | */ 47 | public function initialize(): void 48 | { 49 | parent::initialize(); 50 | 51 | $this->addHoliday($this->goodFriday($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 52 | $this->addHoliday($this->stStephensDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 53 | $this->addHoliday($this->newYearsDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 54 | $this->addHoliday($this->christmasDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 55 | $this->addHoliday($this->ascensionDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 56 | $this->addHoliday($this->easterMonday($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 57 | $this->addHoliday($this->pentecostMonday($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Germany/SchleswigHolstein.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Germany; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Provider\Germany; 22 | 23 | /** 24 | * Provider for all holidays in Schleswig-Holstein (Germany). 25 | * 26 | * Schleswig-Holstein is the northernmost of the 16 states of Germany, comprising most of the historical duchy of 27 | * Holstein and the southern part of the former Duchy of Schleswig. Its capital city is Kiel; other notable cities are 28 | * Lübeck and Flensburg. 29 | * 30 | * @see https://en.wikipedia.org/wiki/Schleswig-Holstein 31 | */ 32 | class SchleswigHolstein extends Germany 33 | { 34 | /** 35 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 36 | * country or sub-region. 37 | */ 38 | public const ID = 'DE-SH'; 39 | 40 | /** 41 | * Initialize holidays for Schleswig-Holstein (Germany). 42 | * 43 | * @throws \InvalidArgumentException 44 | * @throws UnknownLocaleException 45 | * @throws \Exception 46 | */ 47 | public function initialize(): void 48 | { 49 | parent::initialize(); 50 | 51 | // Add custom Christian holidays 52 | $this->calculateReformationDay(); 53 | } 54 | 55 | /** 56 | * For the German state of Schleswig-Holstein, Reformation Day is celebrated since 2018. 57 | * Note: In 2017 all German states will celebrate Reformation Day for its 500th anniversary. 58 | * 59 | * @throws \InvalidArgumentException 60 | * @throws UnknownLocaleException 61 | * @throws \Exception 62 | */ 63 | protected function calculateReformationDay(): void 64 | { 65 | if ($this->year < 2018) { 66 | return; 67 | } 68 | $this->addHoliday($this->reformationDay($this->year, $this->timezone, $this->locale)); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Germany/Bremen.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Germany; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Provider\Germany; 22 | 23 | /** 24 | * Provider for all holidays in Bremen (Germany). 25 | * 26 | * The Free Hanseatic City of Bremen is the smallest of Germany's 16 states. A more informal name, but used in some 27 | * official contexts, is Land Bremen ('State of Bremen'). The state consists of two enclaves with two cities (Bremen 28 | * and Bremerhaven) in the North of Germany, surrounded by the larger state of Lower Saxony. 29 | * 30 | * @see https://en.wikipedia.org/wiki/Bremen_(state) 31 | */ 32 | class Bremen extends Germany 33 | { 34 | /** 35 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 36 | * country or sub-region. 37 | */ 38 | public const ID = 'DE-HB'; 39 | 40 | /** 41 | * Initialize holidays for Bremen (Germany). 42 | * 43 | * @throws \InvalidArgumentException 44 | * @throws UnknownLocaleException 45 | * @throws \Exception 46 | */ 47 | public function initialize(): void 48 | { 49 | parent::initialize(); 50 | 51 | // Add custom Christian holidays 52 | $this->calculateReformationDay(); 53 | } 54 | 55 | /** 56 | * For the German state of Bremen, Reformation Day is celebrated since 2018. 57 | * Note: In 2017 all German states will celebrate Reformation Day for its 500th anniversary. 58 | * 59 | * @throws \InvalidArgumentException 60 | * @throws UnknownLocaleException 61 | * @throws \Exception 62 | */ 63 | protected function calculateReformationDay(): void 64 | { 65 | if ($this->year < 2018) { 66 | return; 67 | } 68 | $this->addHoliday($this->reformationDay($this->year, $this->timezone, $this->locale)); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Switzerland/Bern.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Switzerland; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Holiday; 22 | use Yasumi\Provider\ChristianHolidays; 23 | use Yasumi\Provider\Switzerland; 24 | 25 | /** 26 | * Provider for all holidays in Bern (Switzerland). 27 | * 28 | * @see https://en.wikipedia.org/wiki/Canton_of_Bern 29 | * @see https://www.fin.be.ch/fin/fr/index/personal/personalrecht/wdb.thema.212.html 30 | */ 31 | class Bern extends Switzerland 32 | { 33 | use ChristianHolidays; 34 | 35 | /** 36 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 37 | * country or sub-region. 38 | */ 39 | public const ID = 'CH-BE'; 40 | 41 | /** 42 | * Initialize holidays for Bern (Switzerland). 43 | * 44 | * @throws \InvalidArgumentException 45 | * @throws UnknownLocaleException 46 | * @throws \Exception 47 | */ 48 | public function initialize(): void 49 | { 50 | parent::initialize(); 51 | 52 | $this->addHoliday($this->goodFriday($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 53 | $this->addHoliday($this->stStephensDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 54 | $this->addHoliday($this->newYearsDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 55 | $this->addHoliday($this->christmasDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 56 | $this->addHoliday($this->ascensionDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 57 | $this->addHoliday($this->easterMonday($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 58 | $this->addHoliday($this->pentecostMonday($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 59 | 60 | $this->calculateBerchtoldsTag(); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Switzerland/StGallen.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Switzerland; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Holiday; 22 | use Yasumi\Provider\ChristianHolidays; 23 | use Yasumi\Provider\Switzerland; 24 | 25 | /** 26 | * Provider for all holidays in St. Gallen (Switzerland). 27 | * 28 | * @see https://en.wikipedia.org/wiki/Canton_of_St._Gallen 29 | */ 30 | class StGallen extends Switzerland 31 | { 32 | use ChristianHolidays; 33 | 34 | /** 35 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 36 | * country or sub-region. 37 | */ 38 | public const ID = 'CH-SG'; 39 | 40 | /** 41 | * Initialize holidays for St. Gallen (Switzerland). 42 | * 43 | * @throws \InvalidArgumentException 44 | * @throws UnknownLocaleException 45 | * @throws \Exception 46 | */ 47 | public function initialize(): void 48 | { 49 | parent::initialize(); 50 | 51 | $this->addHoliday($this->goodFriday($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 52 | $this->addHoliday($this->allSaintsDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 53 | $this->addHoliday($this->stStephensDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 54 | $this->addHoliday($this->newYearsDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 55 | $this->addHoliday($this->christmasDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 56 | $this->addHoliday($this->ascensionDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 57 | $this->addHoliday($this->easterMonday($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 58 | $this->addHoliday($this->pentecostMonday($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Switzerland/BaselStadt.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Switzerland; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Holiday; 22 | use Yasumi\Provider\ChristianHolidays; 23 | use Yasumi\Provider\Switzerland; 24 | 25 | /** 26 | * Provider for all holidays in Basel-Stadt (Switzerland). 27 | * 28 | * @see https://en.wikipedia.org/wiki/Basel-Stadt 29 | */ 30 | class BaselStadt extends Switzerland 31 | { 32 | use ChristianHolidays; 33 | 34 | /** 35 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 36 | * country or sub-region. 37 | */ 38 | public const ID = 'CH-BS'; 39 | 40 | /** 41 | * Initialize holidays for Basel-Stadt (Switzerland). 42 | * 43 | * @throws \InvalidArgumentException 44 | * @throws UnknownLocaleException 45 | * @throws \Exception 46 | */ 47 | public function initialize(): void 48 | { 49 | parent::initialize(); 50 | 51 | $this->addHoliday($this->goodFriday($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 52 | $this->addHoliday($this->internationalWorkersDay( 53 | $this->year, 54 | $this->timezone, 55 | $this->locale, 56 | Holiday::TYPE_OTHER 57 | )); 58 | $this->addHoliday($this->stStephensDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 59 | $this->addHoliday($this->newYearsDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 60 | $this->addHoliday($this->christmasDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 61 | $this->addHoliday($this->ascensionDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 62 | $this->addHoliday($this->easterMonday($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 63 | $this->addHoliday($this->pentecostMonday($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Switzerland/Valais.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Switzerland; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Holiday; 22 | use Yasumi\Provider\ChristianHolidays; 23 | use Yasumi\Provider\Switzerland; 24 | 25 | /** 26 | * Provider for all holidays in Valais (Switzerland). 27 | * 28 | * @see https://en.wikipedia.org/wiki/Valais 29 | * @see https://www.vs.ch/web/spt/jours-feries 30 | */ 31 | class Valais extends Switzerland 32 | { 33 | use ChristianHolidays; 34 | 35 | /** 36 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 37 | * country or sub-region. 38 | */ 39 | public const ID = 'CH-VS'; 40 | 41 | /** 42 | * Initialize holidays for Valais (Switzerland). 43 | * 44 | * @throws \InvalidArgumentException 45 | * @throws UnknownLocaleException 46 | * @throws \Exception 47 | */ 48 | public function initialize(): void 49 | { 50 | parent::initialize(); 51 | 52 | $this->addHoliday($this->corpusChristi($this->year, $this->timezone, $this->locale)); 53 | $this->addHoliday($this->assumptionOfMary($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 54 | $this->addHoliday($this->allSaintsDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 55 | $this->addHoliday($this->immaculateConception( 56 | $this->year, 57 | $this->timezone, 58 | $this->locale, 59 | Holiday::TYPE_OTHER 60 | )); 61 | $this->addHoliday($this->stJosephsDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 62 | $this->addHoliday($this->newYearsDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 63 | $this->addHoliday($this->christmasDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 64 | $this->addHoliday($this->ascensionDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Germany/SaxonyAnhalt.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Germany; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Provider\Germany; 22 | 23 | /** 24 | * Provider for all holidays in Saxony-Anhalt (Germany). 25 | * 26 | * Saxony-Anhalt (German: Sachsen-Anhalt) is a landlocked federal state of Germany surrounded by the federal states of 27 | * Lower Saxony, Brandenburg, Saxony and Thuringia. Its capital is Magdeburg and its largest city is Halle (Saale). 28 | * Saxony-Anhalt covers an area of 20,447.7 square kilometres (7,894.9 sq mi)[4] and has a population of 2.34 million. 29 | * 30 | * @see https://en.wikipedia.org/wiki/Saxony-Anhalt 31 | */ 32 | class SaxonyAnhalt extends Germany 33 | { 34 | /** 35 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 36 | * country or sub-region. 37 | */ 38 | public const ID = 'DE-ST'; 39 | 40 | /** 41 | * Initialize holidays for Saxony-Anhalt (Germany). 42 | * 43 | * @throws \InvalidArgumentException 44 | * @throws UnknownLocaleException 45 | * @throws \Exception 46 | */ 47 | public function initialize(): void 48 | { 49 | parent::initialize(); 50 | 51 | // Add custom Christian holidays 52 | $this->addHoliday($this->epiphany($this->year, $this->timezone, $this->locale)); 53 | $this->calculateReformationDay(); 54 | } 55 | 56 | /** 57 | * For the German state of Saxony-Anhalt, Reformation Day was celebrated since 1517. 58 | * Note: In 2017 all German states will celebrate Reformation Day for its 500th anniversary. 59 | * 60 | * @throws \InvalidArgumentException 61 | * @throws UnknownLocaleException 62 | * @throws \Exception 63 | */ 64 | protected function calculateReformationDay(): void 65 | { 66 | if ($this->year < 1517) { 67 | return; 68 | } 69 | 70 | $this->addHoliday($this->reformationDay($this->year, $this->timezone, $this->locale)); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Switzerland/BaselLandschaft.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Switzerland; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Holiday; 22 | use Yasumi\Provider\ChristianHolidays; 23 | use Yasumi\Provider\Switzerland; 24 | 25 | /** 26 | * Provider for all holidays in Basel-Landschaft (Switzerland). 27 | * 28 | * @see https://en.wikipedia.org/wiki/Basel-Landschaft 29 | */ 30 | class BaselLandschaft extends Switzerland 31 | { 32 | use ChristianHolidays; 33 | 34 | /** 35 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 36 | * country or sub-region. 37 | */ 38 | public const ID = 'CH-BL'; 39 | 40 | /** 41 | * Initialize holidays for Basel-Landschaft (Switzerland). 42 | * 43 | * @throws \InvalidArgumentException 44 | * @throws UnknownLocaleException 45 | * @throws \Exception 46 | */ 47 | public function initialize(): void 48 | { 49 | parent::initialize(); 50 | 51 | $this->addHoliday($this->goodFriday($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 52 | $this->addHoliday($this->internationalWorkersDay( 53 | $this->year, 54 | $this->timezone, 55 | $this->locale, 56 | Holiday::TYPE_OTHER 57 | )); 58 | $this->addHoliday($this->stStephensDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 59 | $this->addHoliday($this->newYearsDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 60 | $this->addHoliday($this->christmasDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 61 | $this->addHoliday($this->ascensionDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 62 | $this->addHoliday($this->easterMonday($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 63 | $this->addHoliday($this->pentecostMonday($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Switzerland/Thurgau.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Switzerland; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Holiday; 22 | use Yasumi\Provider\ChristianHolidays; 23 | use Yasumi\Provider\Switzerland; 24 | 25 | /** 26 | * Provider for all holidays in Thurgau (Switzerland). 27 | * 28 | * @see https://en.wikipedia.org/wiki/Thurgau 29 | */ 30 | class Thurgau extends Switzerland 31 | { 32 | use ChristianHolidays; 33 | 34 | /** 35 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 36 | * country or sub-region. 37 | */ 38 | public const ID = 'CH-TG'; 39 | 40 | /** 41 | * Initialize holidays for Thurgau (Switzerland). 42 | * 43 | * @throws \InvalidArgumentException 44 | * @throws UnknownLocaleException 45 | * @throws \Exception 46 | */ 47 | public function initialize(): void 48 | { 49 | parent::initialize(); 50 | 51 | $this->addHoliday($this->goodFriday($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 52 | $this->addHoliday($this->internationalWorkersDay( 53 | $this->year, 54 | $this->timezone, 55 | $this->locale, 56 | Holiday::TYPE_OTHER 57 | )); 58 | $this->addHoliday($this->stStephensDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 59 | $this->addHoliday($this->newYearsDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 60 | $this->addHoliday($this->christmasDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 61 | $this->addHoliday($this->ascensionDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 62 | $this->addHoliday($this->easterMonday($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 63 | $this->addHoliday($this->pentecostMonday($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 64 | 65 | $this->calculateBerchtoldsTag(); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Austria/Carinthia.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Austria; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Holiday; 22 | use Yasumi\Provider\Austria; 23 | 24 | /** 25 | * Provider for all holidays in Carinthia (Austria). 26 | * 27 | * @see https://en.wikipedia.org/wiki/Carinthia 28 | */ 29 | class Carinthia extends Austria 30 | { 31 | /** 32 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 33 | * country or sub-region. 34 | */ 35 | public const ID = 'AT-2'; 36 | 37 | /** 38 | * Initialize holidays for Carinthia (Austria). 39 | * 40 | * @throws \InvalidArgumentException 41 | * @throws UnknownLocaleException 42 | * @throws \Exception 43 | */ 44 | public function initialize(): void 45 | { 46 | parent::initialize(); 47 | 48 | // Add custom Common holidays. 49 | $this->addHoliday($this->stJosephsDay($this->year, $this->timezone, $this->locale)); 50 | $this->calculatePlebisciteDay(); 51 | } 52 | 53 | /** 54 | * Plebiscite Day. 55 | * 56 | * The Carinthian plebiscite was held on 10 October 1920 in the area 57 | * predominantly settled by Carinthian Slovenes. It determined the final 58 | * southern border between the Republic of Austria and the newly formed 59 | * Kingdom of Serbs, Croats and Slovenes (Yugoslavia) after World War I. 60 | * 61 | * @see https://en.wikipedia.org/wiki/1920_Carinthian_plebiscite 62 | * 63 | * @throws \InvalidArgumentException 64 | * @throws UnknownLocaleException 65 | * @throws \Exception 66 | */ 67 | protected function calculatePlebisciteDay(): void 68 | { 69 | if ($this->year < 1920) { 70 | return; 71 | } 72 | 73 | $this->addHoliday(new Holiday( 74 | 'plebisciteDay', 75 | [], 76 | new \DateTime("{$this->year}-10-10", new \DateTimeZone($this->timezone)), 77 | $this->locale 78 | )); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Austria/Salzburg.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Austria; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Holiday; 22 | use Yasumi\Provider\Austria; 23 | 24 | /** 25 | * Provider for all holidays in Salzburg (Austria). 26 | * 27 | * @see https://en.wikipedia.org/wiki/Salzburg_(state) 28 | */ 29 | class Salzburg extends Austria 30 | { 31 | /** 32 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 33 | * country or sub-region. 34 | */ 35 | public const ID = 'AT-5'; 36 | 37 | /** 38 | * Initialize holidays for Salzburg (Austria). 39 | * 40 | * @throws \InvalidArgumentException 41 | * @throws UnknownLocaleException 42 | * @throws \Exception 43 | */ 44 | public function initialize(): void 45 | { 46 | parent::initialize(); 47 | 48 | // Add custom holidays. 49 | $this->calculateStRupertsDay(); 50 | } 51 | 52 | /** 53 | * Saint Rupert's Day. 54 | * 55 | * Rupert of Salzburg was Bishop of Worms as well as the first Bishop of 56 | * Salzburg and abbot of St. Peter's in Salzburg. He was a contemporary of 57 | * the Frankish king Childebert III and is venerated as a saint in the 58 | * Roman Catholic and Eastern Orthodox Churches. Rupert is also patron 59 | * saint of the Austrian state of Salzburg. His feast day in Austria is 60 | * September 24 (since 710). 61 | * 62 | * @see https://en.wikipedia.org/wiki/Rupert_of_Salzburg 63 | * 64 | * @throws \InvalidArgumentException 65 | * @throws UnknownLocaleException 66 | * @throws \Exception 67 | */ 68 | protected function calculateStRupertsDay(): void 69 | { 70 | if ($this->year < 710) { 71 | return; 72 | } 73 | 74 | $this->addHoliday(new Holiday( 75 | 'stRupertsDay', 76 | [], 77 | new \DateTime("{$this->year}-9-24", new \DateTimeZone($this->timezone)), 78 | $this->locale 79 | )); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Canada/Nunavut.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Canada; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Holiday; 22 | use Yasumi\Provider\Canada; 23 | use Yasumi\Provider\DateTimeZoneFactory; 24 | 25 | /** 26 | * Provider for all holidays in Nunavut (Canada). 27 | * 28 | * Nunavut is a province of Canada. 29 | * 30 | * @see https://en.wikipedia.org/wiki/Nunavut 31 | */ 32 | class Nunavut extends Canada 33 | { 34 | /** 35 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 36 | * country or sub-region. 37 | */ 38 | public const ID = 'CA-NU'; 39 | 40 | /** 41 | * Initialize holidays for Nunavut (Canada). 42 | * 43 | * @throws \InvalidArgumentException 44 | * @throws UnknownLocaleException 45 | * @throws \Exception 46 | */ 47 | public function initialize(): void 48 | { 49 | parent::initialize(); 50 | 51 | $this->timezone = 'America/Iqaluit'; 52 | 53 | $this->calculateCivicHoliday(); 54 | $this->calculateVictoriaDay(); 55 | $this->calculateNunavutDay(); 56 | } 57 | 58 | /** 59 | * Nunavut Day – July 9, originated as a paid holiday for Nunavut Tunngavik Incorporated 60 | * and regional Inuit associations. It became a half-day holiday for government employees 61 | * in 1999 and a full day in 2001. 62 | * 63 | * @see https://en.wikipedia.org/wiki/Nunavut_Day 64 | * 65 | * @throws \InvalidArgumentException 66 | * @throws UnknownLocaleException 67 | * @throws \Exception 68 | */ 69 | protected function calculateNunavutDay(): void 70 | { 71 | if ($this->year < 1999) { 72 | return; 73 | } 74 | 75 | $this->addHoliday(new Holiday( 76 | 'nunavutDay', 77 | ['en' => 'Nunavut Day'], 78 | new \DateTime("{$this->year}-07-09", DateTimeZoneFactory::getDateTimeZone($this->timezone)), 79 | $this->locale, 80 | Holiday::TYPE_OBSERVANCE 81 | )); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Switzerland/Schaffhausen.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Switzerland; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Holiday; 22 | use Yasumi\Provider\ChristianHolidays; 23 | use Yasumi\Provider\Switzerland; 24 | 25 | /** 26 | * Provider for all holidays in Schaffhausen (Switzerland). 27 | * 28 | * @see https://en.wikipedia.org/wiki/Canton_of_Schaffhausen 29 | */ 30 | class Schaffhausen extends Switzerland 31 | { 32 | use ChristianHolidays; 33 | 34 | /** 35 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 36 | * country or sub-region. 37 | */ 38 | public const ID = 'CH-SH'; 39 | 40 | /** 41 | * Initialize holidays for Schaffhausen (Switzerland). 42 | * 43 | * @throws \InvalidArgumentException 44 | * @throws UnknownLocaleException 45 | * @throws \Exception 46 | */ 47 | public function initialize(): void 48 | { 49 | parent::initialize(); 50 | 51 | $this->addHoliday($this->goodFriday($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 52 | $this->addHoliday($this->internationalWorkersDay( 53 | $this->year, 54 | $this->timezone, 55 | $this->locale, 56 | Holiday::TYPE_OTHER 57 | )); 58 | $this->addHoliday($this->stStephensDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 59 | $this->addHoliday($this->newYearsDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 60 | $this->addHoliday($this->christmasDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 61 | $this->addHoliday($this->ascensionDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 62 | $this->addHoliday($this->easterMonday($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 63 | $this->addHoliday($this->pentecostMonday($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 64 | 65 | $this->calculateBerchtoldsTag(); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Germany/LowerSaxony.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Germany; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Provider\Germany; 22 | 23 | /** 24 | * Provider for all holidays in Lower Saxony (Germany). 25 | * 26 | * Lower Saxony (German: Niedersachsen) is a German state (Bundesland) situated in northwestern Germany and is second 27 | * in area, with 47,624 square kilometres (18,388 sq mi), and fourth in population (8 million) among the sixteen Länder 28 | * of Germany. In rural areas Northern Low Saxon, a dialect of Low German, and Saterland Frisian, a variety of Frisian, 29 | * are still spoken, but the number of speakers is declining. 30 | * 31 | * @see https://en.wikipedia.org/wiki/Lower_Saxony 32 | */ 33 | class LowerSaxony extends Germany 34 | { 35 | /** 36 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 37 | * country or sub-region. 38 | */ 39 | public const ID = 'DE-NI'; 40 | 41 | /** 42 | * Initialize holidays for Lower Saxony (Germany). 43 | * 44 | * @throws \InvalidArgumentException 45 | * @throws UnknownLocaleException 46 | * @throws \Exception 47 | */ 48 | public function initialize(): void 49 | { 50 | parent::initialize(); 51 | 52 | // Add custom Christian holidays 53 | $this->calculateReformationDay(); 54 | } 55 | 56 | /** 57 | * For the German state of Lower Saxony, Reformation Day is celebrated since 2018. 58 | * Note: In 2017 all German states will celebrate Reformation Day for its 500th anniversary. 59 | * 60 | * @see https://www.zeit.de/gesellschaft/zeitgeschehen/2018-06/reformationstag-niedersachsen-neuer-feiertag 61 | * 62 | * @throws \InvalidArgumentException 63 | * @throws UnknownLocaleException 64 | * @throws \Exception 65 | */ 66 | protected function calculateReformationDay(): void 67 | { 68 | if ($this->year < 2018) { 69 | return; 70 | } 71 | $this->addHoliday($this->reformationDay($this->year, $this->timezone, $this->locale)); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/Yasumi/Provider/Switzerland/Zurich.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Provider\Switzerland; 19 | 20 | use Yasumi\Exception\UnknownLocaleException; 21 | use Yasumi\Holiday; 22 | use Yasumi\Provider\ChristianHolidays; 23 | use Yasumi\Provider\Switzerland; 24 | 25 | /** 26 | * Provider for all holidays in Zürich (Switzerland). 27 | * 28 | * @see https://en.wikipedia.org/wiki/Canton_of_Z%C3%BCrich 29 | * @see https://www.zh.ch/de/wirtschaft-arbeit/arbeitsbedingungen/arbeitsssicherheit-gesundheitsschutz/arbeits-ruhezeiten/feiertage.html 30 | */ 31 | class Zurich extends Switzerland 32 | { 33 | use ChristianHolidays; 34 | 35 | /** 36 | * Code to identify this Holiday Provider. Typically, this is the ISO3166 code corresponding to the respective 37 | * country or sub-region. 38 | */ 39 | public const ID = 'CH-ZH'; 40 | 41 | /** 42 | * Initialize holidays for Zürich (Switzerland). 43 | * 44 | * @throws \InvalidArgumentException 45 | * @throws UnknownLocaleException 46 | * @throws \Exception 47 | */ 48 | public function initialize(): void 49 | { 50 | parent::initialize(); 51 | 52 | $this->addHoliday($this->goodFriday($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 53 | $this->addHoliday($this->internationalWorkersDay( 54 | $this->year, 55 | $this->timezone, 56 | $this->locale, 57 | Holiday::TYPE_OTHER 58 | )); 59 | $this->addHoliday($this->stStephensDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 60 | $this->addHoliday($this->newYearsDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 61 | $this->addHoliday($this->christmasDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 62 | $this->addHoliday($this->ascensionDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 63 | $this->addHoliday($this->easterMonday($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 64 | $this->addHoliday($this->pentecostMonday($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER)); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/Yasumi/Filters/BetweenFilter.php: -------------------------------------------------------------------------------- 1 | 16 | */ 17 | 18 | namespace Yasumi\Filters; 19 | 20 | use Yasumi\ProviderInterface; 21 | 22 | /** 23 | * BetweenFilter is a class used for filtering holidays based on given date range. 24 | * 25 | * Filters all holidays between the given start and end date. An additional parameter can be used to identify if the 26 | * start and end date need to be included in the comparison. 27 | * 28 | * Note: this class can be used separately, however is implemented by the AbstractProvider::between method. 29 | */ 30 | class BetweenFilter extends AbstractFilter 31 | { 32 | private const DATE_FORMAT = 'Y-m-d'; 33 | 34 | /** start date of the time frame to check against. */ 35 | private readonly string $startDate; 36 | 37 | /** end date of the time frame to check against */ 38 | private readonly string $endDate; 39 | 40 | /** 41 | * Construct the Between FilterIterator Object. 42 | * 43 | * @param \Iterator $iterator Iterator object of the Holidays Provider 44 | * @param \DateTimeInterface $startDate Start date of the time frame to check against 45 | * @param \DateTimeInterface $endDate End date of the time frame to check against 46 | * @param bool $equal Indicate whether the start and end dates should be included in the 47 | * comparison 48 | */ 49 | public function __construct( 50 | \Iterator $iterator, 51 | \DateTimeInterface $startDate, 52 | \DateTimeInterface $endDate, 53 | private readonly bool $equal = true, 54 | ) { 55 | parent::__construct($iterator); 56 | $this->startDate = $startDate->format(self::DATE_FORMAT); 57 | $this->endDate = $endDate->format(self::DATE_FORMAT); 58 | } 59 | 60 | public function accept(): bool 61 | { 62 | $holiday = $this->getInnerIterator()->current()->format(self::DATE_FORMAT); 63 | 64 | return $this->equal 65 | ? $holiday >= $this->startDate && $holiday <= $this->endDate 66 | : $holiday > $this->startDate && $holiday < $this->endDate; 67 | } 68 | } 69 | --------------------------------------------------------------------------------