Skip to content

Commit

Permalink
Renaming 'National' type to 'Official' (#65)
Browse files Browse the repository at this point in the history
Renamed the holiday type NATIONAL to OFFICIAL. Subregions may have official holidays and the name NATIONAL doesn't suit these situations.

* Updated CHANGELOG
  • Loading branch information
stelgenhof authored Sep 13, 2017
1 parent d9b5e8e commit cf51971
Show file tree
Hide file tree
Showing 454 changed files with 838 additions and 838 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- Added Holiday Provider for Switzerland. [\#56](https://github.com/azuyalabs/yasumi/pull/56) ([qligier](https://github.com/qligier))

### Changed
- Renamed the holiday type NATIONAL to OFFICIAL. Subregions may have official holidays and the name NATIONAL doesn't suit these situations.
- Upgraded PHP-CS-Fixer to version 2.4

### Fixed
Expand Down
6 changes: 3 additions & 3 deletions src/Yasumi/Filters/OfficialHolidaysFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/**
* OfficialHolidaysFilter is a class for filtering all official holidays.
*
* OfficialHolidaysFilter is a class that returns all holidays that are considered official (i.e. national) of any given
* OfficialHolidaysFilter is a class that returns all holidays that are considered official of any given
* holiday provider.
*
* Example usage:
Expand All @@ -28,12 +28,12 @@
class OfficialHolidaysFilter extends FilterIterator
{
/**
* Checks whether the current element of the iterator is a national/official holiday.
* Checks whether the current element of the iterator is an official holiday.
*
* @return bool
*/
public function accept()
{
return $this->getInnerIterator()->current()->getType() === Holiday::TYPE_NATIONAL;
return $this->getInnerIterator()->current()->getType() === Holiday::TYPE_OFFICIAL;
}
}
14 changes: 7 additions & 7 deletions src/Yasumi/Holiday.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
class Holiday extends DateTime implements JsonSerializable
{
/**
* Type definition for National/Federal holidays.
* Type definition for Official (i.e. National/Federal) holidays.
*/
const TYPE_NATIONAL = 'national';
const TYPE_OFFICIAL = 'official';

/**
* Type definition for Observance holidays.
Expand Down Expand Up @@ -89,9 +89,9 @@ class Holiday extends DateTime implements JsonSerializable
* @param DateTime $date A DateTime instance representing the date of the holiday
* @param string $displayLocale Locale (i.e. language) in which the holiday information needs to be
* displayed in. (Default 'en_US')
* @param string $type The type of holiday. Use the following constants: TYPE_NATIONAL,
* TYPE_OBSERVANCE, TYPE_SEASON, TYPE_BANK or TYPE_OTHER. By default a
* national holiday is considered.
* @param string $type The type of holiday. Use the following constants: TYPE_OFFICIAL,
* TYPE_OBSERVANCE, TYPE_SEASON, TYPE_BANK or TYPE_OTHER. By default an
* official holiday is considered.
*
* @throws UnknownLocaleException
* @throws \InvalidArgumentException
Expand All @@ -101,7 +101,7 @@ public function __construct(
array $names,
$date,
$displayLocale = self::DEFAULT_LOCALE,
$type = self::TYPE_NATIONAL
$type = self::TYPE_OFFICIAL
) {
// Validate if short name is not empty
if (empty($shortName)) {
Expand Down Expand Up @@ -136,7 +136,7 @@ public function __construct(
/**
* Returns what type this holiday is.
*
* @return string the type of holiday (national, observance, season or bank).
* @return string the type of holiday (official, observance, season, bank or other).
*/
public function getType()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Yasumi/Provider/Australia.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class Australia extends AbstractProvider
*/
public function initialize()
{
// National Holidays
// Official Holidays
$this->calculateAustraliaDay();
$this->calculateNewYearHolidays();
$this->calculateAnzacDay();
Expand Down
2 changes: 1 addition & 1 deletion src/Yasumi/Provider/Austria.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function initialize()
$this->addHoliday($this->ascensionDay($this->year, $this->timezone, $this->locale));
$this->addHoliday($this->pentecost($this->year, $this->timezone, $this->locale, Holiday::TYPE_OBSERVANCE));
$this->addHoliday($this->pentecostMonday($this->year, $this->timezone, $this->locale));
$this->addHoliday($this->corpusChristi($this->year, $this->timezone, $this->locale, Holiday::TYPE_NATIONAL));
$this->addHoliday($this->corpusChristi($this->year, $this->timezone, $this->locale, Holiday::TYPE_OFFICIAL));
$this->addHoliday($this->allSaintsDay($this->year, $this->timezone, $this->locale));
$this->addHoliday($this->immaculateConception($this->year, $this->timezone, $this->locale));
$this->addHoliday($this->christmasDay($this->year, $this->timezone, $this->locale));
Expand Down
124 changes: 62 additions & 62 deletions src/Yasumi/Provider/ChristianHolidays.php

Large diffs are not rendered by default.

54 changes: 27 additions & 27 deletions src/Yasumi/Provider/CommonHolidays.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ trait CommonHolidays
* @param int $year the year for which New Year's Day need to be created
* @param string $timezone the timezone in which New Year's Day is celebrated
* @param string $locale the locale for which New Year's Day need to be displayed in.
* @param string $type The type of holiday. Use the following constants: TYPE_NATIONAL, TYPE_OBSERVANCE,
* TYPE_SEASON, TYPE_BANK or TYPE_OTHER. By default a national holiday is considered.
* @param string $type The type of holiday. Use the following constants: TYPE_OFFICIAL, TYPE_OBSERVANCE,
* TYPE_SEASON, TYPE_BANK or TYPE_OTHER. By default an official holiday is considered.
*
* @return \Yasumi\Holiday
*
* @throws \Yasumi\Exception\UnknownLocaleException
* @throws \InvalidArgumentException
*/
public function newYearsDay($year, $timezone, $locale, $type = Holiday::TYPE_NATIONAL)
public function newYearsDay($year, $timezone, $locale, $type = Holiday::TYPE_OFFICIAL)
{
return new Holiday('newYearsDay', [], new DateTime("$year-1-1", new DateTimeZone($timezone)), $locale, $type);
}
Expand All @@ -65,15 +65,15 @@ public function newYearsDay($year, $timezone, $locale, $type = Holiday::TYPE_NAT
* @param int $year the year for which International Workers' Day need to be created
* @param string $timezone the timezone in which International Workers' Day is celebrated
* @param string $locale the locale for which International Workers' Day need to be displayed in.
* @param string $type The type of holiday. Use the following constants: TYPE_NATIONAL, TYPE_OBSERVANCE,
* TYPE_SEASON, TYPE_BANK or TYPE_OTHER. By default a national holiday is considered.
* @param string $type The type of holiday. Use the following constants: TYPE_OFFICIAL, TYPE_OBSERVANCE,
* TYPE_SEASON, TYPE_BANK or TYPE_OTHER. By default an official holiday is considered.
*
* @return \Yasumi\Holiday
*
* @throws \Yasumi\Exception\UnknownLocaleException
* @throws \InvalidArgumentException
*/
public function internationalWorkersDay($year, $timezone, $locale, $type = Holiday::TYPE_NATIONAL)
public function internationalWorkersDay($year, $timezone, $locale, $type = Holiday::TYPE_OFFICIAL)
{
return new Holiday(
'internationalWorkersDay',
Expand All @@ -98,15 +98,15 @@ public function internationalWorkersDay($year, $timezone, $locale, $type = Holid
* @param int $year the year for which Valentine's Day need to be created
* @param string $timezone the timezone in which Valentine's Day is celebrated
* @param string $locale the locale for which Valentine's Day need to be displayed in.
* @param string $type The type of holiday. Use the following constants: TYPE_NATIONAL, TYPE_OBSERVANCE,
* TYPE_SEASON, TYPE_BANK or TYPE_OTHER. By default a national holiday is considered.
* @param string $type The type of holiday. Use the following constants: TYPE_OFFICIAL, TYPE_OBSERVANCE,
* TYPE_SEASON, TYPE_BANK or TYPE_OTHER. By default an official holiday is considered.
*
* @return \Yasumi\Holiday
*
* @throws \Yasumi\Exception\UnknownLocaleException
* @throws \InvalidArgumentException
*/
public function valentinesDay($year, $timezone, $locale, $type = Holiday::TYPE_NATIONAL)
public function valentinesDay($year, $timezone, $locale, $type = Holiday::TYPE_OFFICIAL)
{
return new Holiday(
'valentinesDay',
Expand All @@ -129,15 +129,15 @@ public function valentinesDay($year, $timezone, $locale, $type = Holiday::TYPE_N
* @param int $year the year for which World Animal Day need to be created
* @param string $timezone the timezone in which World Animal Day is celebrated
* @param string $locale the locale for which World Animal Day need to be displayed in.
* @param string $type The type of holiday. Use the following constants: TYPE_NATIONAL, TYPE_OBSERVANCE,
* TYPE_SEASON, TYPE_BANK or TYPE_OTHER. By default a national holiday is considered.
* @param string $type The type of holiday. Use the following constants: TYPE_OFFICIAL, TYPE_OBSERVANCE,
* TYPE_SEASON, TYPE_BANK or TYPE_OTHER. By default an official holiday is considered.
*
* @return \Yasumi\Holiday
*
* @throws \Yasumi\Exception\UnknownLocaleException
* @throws \InvalidArgumentException
*/
public function worldAnimalDay($year, $timezone, $locale, $type = Holiday::TYPE_NATIONAL)
public function worldAnimalDay($year, $timezone, $locale, $type = Holiday::TYPE_OFFICIAL)
{
return new Holiday(
'worldAnimalDay',
Expand All @@ -162,15 +162,15 @@ public function worldAnimalDay($year, $timezone, $locale, $type = Holiday::TYPE_
* @param int $year the year for which St. Martin's Day need to be created
* @param string $timezone the timezone in which St. Martin's Day is celebrated
* @param string $locale the locale for which St. Martin's Day need to be displayed in.
* @param string $type The type of holiday. Use the following constants: TYPE_NATIONAL, TYPE_OBSERVANCE,
* TYPE_SEASON, TYPE_BANK or TYPE_OTHER. By default a national holiday is considered.
* @param string $type The type of holiday. Use the following constants: TYPE_OFFICIAL, TYPE_OBSERVANCE,
* TYPE_SEASON, TYPE_BANK or TYPE_OTHER. By default an official holiday is considered.
*
* @return \Yasumi\Holiday
*
* @throws \Yasumi\Exception\UnknownLocaleException
* @throws \InvalidArgumentException
*/
public function stMartinsDay($year, $timezone, $locale, $type = Holiday::TYPE_NATIONAL)
public function stMartinsDay($year, $timezone, $locale, $type = Holiday::TYPE_OFFICIAL)
{
return new Holiday(
'stMartinsDay',
Expand All @@ -194,15 +194,15 @@ public function stMartinsDay($year, $timezone, $locale, $type = Holiday::TYPE_NA
* @param int $year the year for which Father's Day need to be created
* @param string $timezone the timezone in which Father's Day is celebrated
* @param string $locale the locale for which Father's Day need to be displayed in.
* @param string $type The type of holiday. Use the following constants: TYPE_NATIONAL, TYPE_OBSERVANCE,
* TYPE_SEASON, TYPE_BANK or TYPE_OTHER. By default a national holiday is considered.
* @param string $type The type of holiday. Use the following constants: TYPE_OFFICIAL, TYPE_OBSERVANCE,
* TYPE_SEASON, TYPE_BANK or TYPE_OTHER. By default an official holiday is considered.
*
* @return \Yasumi\Holiday
*
* @throws \Yasumi\Exception\UnknownLocaleException
* @throws \InvalidArgumentException
*/
public function fathersDay($year, $timezone, $locale, $type = Holiday::TYPE_NATIONAL)
public function fathersDay($year, $timezone, $locale, $type = Holiday::TYPE_OFFICIAL)
{
return new Holiday(
'fathersDay',
Expand All @@ -226,15 +226,15 @@ public function fathersDay($year, $timezone, $locale, $type = Holiday::TYPE_NATI
* @param int $year the year for which Mother's Day need to be created
* @param string $timezone the timezone in which Mother's Day is celebrated
* @param string $locale the locale for which Mother's Day need to be displayed in.
* @param string $type The type of holiday. Use the following constants: TYPE_NATIONAL, TYPE_OBSERVANCE,
* TYPE_SEASON, TYPE_BANK or TYPE_OTHER. By default a national holiday is considered.
* @param string $type The type of holiday. Use the following constants: TYPE_OFFICIAL, TYPE_OBSERVANCE,
* TYPE_SEASON, TYPE_BANK or TYPE_OTHER. By default an official holiday is considered.
*
* @return \Yasumi\Holiday
*
* @throws \Yasumi\Exception\UnknownLocaleException
* @throws \InvalidArgumentException
*/
public function mothersDay($year, $timezone, $locale, $type = Holiday::TYPE_NATIONAL)
public function mothersDay($year, $timezone, $locale, $type = Holiday::TYPE_OFFICIAL)
{
return new Holiday(
'mothersDay',
Expand All @@ -258,15 +258,15 @@ public function mothersDay($year, $timezone, $locale, $type = Holiday::TYPE_NATI
* @param int $year the year for which Victory in Europe Day need to be created
* @param string $timezone the timezone in which Victory in Europe Day is celebrated
* @param string $locale the locale for which Victory in Europe Day need to be displayed in.
* @param string $type The type of holiday. Use the following constants: TYPE_NATIONAL, TYPE_OBSERVANCE,
* TYPE_SEASON, TYPE_BANK or TYPE_OTHER. By default a national holiday is considered.
* @param string $type The type of holiday. Use the following constants: TYPE_OFFICIAL, TYPE_OBSERVANCE,
* TYPE_SEASON, TYPE_BANK or TYPE_OTHER. By default an official holiday is considered.
*
* @return \Yasumi\Holiday
*
* @throws \Yasumi\Exception\UnknownLocaleException
* @throws \InvalidArgumentException
*/
public function victoryInEuropeDay($year, $timezone, $locale, $type = Holiday::TYPE_NATIONAL)
public function victoryInEuropeDay($year, $timezone, $locale, $type = Holiday::TYPE_OFFICIAL)
{
return new Holiday(
'victoryInEuropeDay',
Expand All @@ -292,15 +292,15 @@ public function victoryInEuropeDay($year, $timezone, $locale, $type = Holiday::T
* @param int $year the year for which Armistice Day need to be created
* @param string $timezone the timezone in which Armistice Day is celebrated
* @param string $locale the locale for which Armistice Day need to be displayed in.
* @param string $type The type of holiday. Use the following constants: TYPE_NATIONAL, TYPE_OBSERVANCE,
* TYPE_SEASON, TYPE_BANK or TYPE_OTHER. By default a national holiday is considered.
* @param string $type The type of holiday. Use the following constants: TYPE_OFFICIAL, TYPE_OBSERVANCE,
* TYPE_SEASON, TYPE_BANK or TYPE_OTHER. By default an official holiday is considered.
*
* @return \Yasumi\Holiday
*
* @throws \Yasumi\Exception\UnknownLocaleException
* @throws \InvalidArgumentException
*/
public function armisticeDay($year, $timezone, $locale, $type = Holiday::TYPE_NATIONAL)
public function armisticeDay($year, $timezone, $locale, $type = Holiday::TYPE_OFFICIAL)
{
return new Holiday(
'armisticeDay',
Expand Down
2 changes: 1 addition & 1 deletion src/Yasumi/Provider/Croatia.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function initialize()
$this->addHoliday($this->epiphany($this->year, $this->timezone, $this->locale));
$this->addHoliday($this->easter($this->year, $this->timezone, $this->locale));
$this->addHoliday($this->easterMonday($this->year, $this->timezone, $this->locale));
$this->addHoliday($this->corpusChristi($this->year, $this->timezone, $this->locale, Holiday::TYPE_NATIONAL));
$this->addHoliday($this->corpusChristi($this->year, $this->timezone, $this->locale, Holiday::TYPE_OFFICIAL));
$this->addHoliday($this->assumptionOfMary($this->year, $this->timezone, $this->locale));
$this->addHoliday($this->allSaintsDay($this->year, $this->timezone, $this->locale));
$this->addHoliday($this->christmasDay($this->year, $this->timezone, $this->locale));
Expand Down
2 changes: 1 addition & 1 deletion src/Yasumi/Provider/NewZealand.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function initialize()
{
$this->timezone = 'Pacific/Auckland';

// National Holidays
// Official Holidays
$this->calculateNewYearHolidays();
$this->calculateWaitangiDay();
$this->calculateAnzacDay();
Expand Down
4 changes: 2 additions & 2 deletions src/Yasumi/Provider/Portugal.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function calculateCarnationRevolutionDay()
['pt_PT' => 'Dia da Liberdade'],
new DateTime("$this->year-04-25", new DateTimeZone($this->timezone)),
$this->locale,
Holiday::TYPE_NATIONAL
Holiday::TYPE_OFFICIAL
));
}
}
Expand Down Expand Up @@ -208,7 +208,7 @@ public function calculateRestorationOfIndependenceDay()
['pt_PT' => 'Restauração da Independência'],
new DateTime("$this->year-12-01", new DateTimeZone($this->timezone)),
$this->locale,
Holiday::TYPE_NATIONAL
Holiday::TYPE_OFFICIAL
));
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/Yasumi/Provider/Slovakia.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function initialize()
$this->timezone = 'Europe/Bratislava';

// 1.1.
$this->addHoliday($this->newYearsDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_NATIONAL));
$this->addHoliday($this->newYearsDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OFFICIAL));
// 6.1.
$this->addHoliday($this->epiphany($this->year, $this->timezone, $this->locale, Holiday::TYPE_BANK));
// 1.5.
Expand Down Expand Up @@ -123,7 +123,7 @@ public function calculateSaintsCyrilAndMethodiusDay()
],
new DateTime($this->year . '-07-05', new DateTimeZone($this->timezone)),
$this->locale,
Holiday::TYPE_NATIONAL
Holiday::TYPE_OFFICIAL
));
}

Expand All @@ -145,7 +145,7 @@ public function calculateSlovakNationalUprisingDay()
],
new DateTime($this->year . '-08-29', new DateTimeZone($this->timezone)),
$this->locale,
Holiday::TYPE_NATIONAL
Holiday::TYPE_OFFICIAL
));
}

Expand All @@ -167,7 +167,7 @@ public function calculateSlovakConstitutionDay()
],
new DateTime($this->year . '-09-01', new DateTimeZone($this->timezone)),
$this->locale,
Holiday::TYPE_NATIONAL
Holiday::TYPE_OFFICIAL
));
}

Expand Down Expand Up @@ -210,7 +210,7 @@ public function calculateStruggleForFreedomAndDemocracyDay()
],
new DateTime($this->year . '-11-17', new DateTimeZone($this->timezone)),
$this->locale,
Holiday::TYPE_NATIONAL
Holiday::TYPE_OFFICIAL
));
}
}
2 changes: 1 addition & 1 deletion src/Yasumi/Provider/Sweden.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function initialize()
$this->addHoliday($this->pentecost($this->year, $this->timezone, $this->locale));
$this->calculatestJohnsDay(); // aka Midsummer's Day
$this->calculateAllSaintsDay();
$this->addHoliday($this->christmasEve($this->year, $this->timezone, $this->locale, Holiday::TYPE_NATIONAL));
$this->addHoliday($this->christmasEve($this->year, $this->timezone, $this->locale, Holiday::TYPE_OFFICIAL));
$this->addHoliday($this->christmasDay($this->year, $this->timezone, $this->locale));
$this->addHoliday($this->secondChristmasDay($this->year, $this->timezone, $this->locale));

Expand Down
2 changes: 1 addition & 1 deletion src/Yasumi/Provider/Switzerland.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function calculateNationalDay()
$translations,
new DateTime($this->year . '-08-01', new DateTimeZone($this->timezone)),
$this->locale,
Holiday::TYPE_NATIONAL
Holiday::TYPE_OFFICIAL
));
} elseif ($this->year >= 1899 || $this->year === 1891) {
$this->addHoliday(new Holiday(
Expand Down
Loading

0 comments on commit cf51971

Please sign in to comment.