Skip to content

Commit

Permalink
Formatting fixes.
Browse files Browse the repository at this point in the history
Signed-off-by: Sacha Telgenhof <[email protected]>
  • Loading branch information
stelgenhof committed Jan 24, 2018
1 parent d870a8a commit 54f873c
Show file tree
Hide file tree
Showing 65 changed files with 261 additions and 307 deletions.
22 changes: 16 additions & 6 deletions src/Yasumi/Provider/Australia.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,10 @@ public function calculateHoliday(
$moveFromSaturday = true,
$moveFromSunday = true
) {
$holidayDate = $date instanceof \DateTimeInterface ? $date : new \DateTime($date,
new \DateTimeZone($this->timezone));
$holidayDate = $date instanceof \DateTimeInterface ? $date : new \DateTime(
$date,
new \DateTimeZone($this->timezone)
);

$day = (int)$holidayDate->format('w');
if (($day === 0 && $moveFromSunday) || ($day === 6 && $moveFromSaturday)) {
Expand All @@ -127,8 +129,11 @@ public function calculateHoliday(
*/
public function calculateNewYearHolidays()
{
$this->calculateHoliday('newYearsDay', [],
new DateTime("$this->year-01-01", new DateTimeZone($this->timezone)));
$this->calculateHoliday(
'newYearsDay',
[],
new DateTime("$this->year-01-01", new DateTimeZone($this->timezone))
);
}

/**
Expand Down Expand Up @@ -206,8 +211,13 @@ public function calculateChristmasDay()
*/
public function calculateQueensBirthday()
{
$this->calculateHoliday('queensBirthday', ['en_AU' => 'Queens Birthday'],
'second monday of june ' . $this->year, false, false);
$this->calculateHoliday(
'queensBirthday',
['en_AU' => 'Queens Birthday'],
'second monday of june ' . $this->year,
false,
false
);
}

/**
Expand Down
18 changes: 9 additions & 9 deletions src/Yasumi/Provider/Estonia.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ private function addIndependenceDay()
{
if ($this->year >= self::DECLARATION_OF_INDEPENDENCE_YEAR) {
$this->addHoliday(new Holiday('independenceDay', [
'en_US' => 'Independence Day',
'et_EE' => 'Iseseisvuspäev'
], new \DateTime("{$this->year}-02-24", new \DateTimeZone($this->timezone))));
'en_US' => 'Independence Day',
'et_EE' => 'Iseseisvuspäev'
], new \DateTime("{$this->year}-02-24", new \DateTimeZone($this->timezone))));
}
}

Expand All @@ -81,9 +81,9 @@ private function addVictoryDay()
{
if ($this->year >= self::VICTORY_DAY_START_YEAR) {
$this->addHoliday(new Holiday('victoryDay', [
'en_US' => 'Victory Day',
'et_EE' => 'Võidupüha'
], new \DateTime("{$this->year}-06-23", new \DateTimeZone($this->timezone))));
'en_US' => 'Victory Day',
'et_EE' => 'Võidupüha'
], new \DateTime("{$this->year}-06-23", new \DateTimeZone($this->timezone))));
}
}

Expand All @@ -94,9 +94,9 @@ private function addRestorationOfIndependenceDay()
{
if ($this->year >= self::RESTORATION_OF_INDEPENDENCE_YEAR) {
$this->addHoliday(new Holiday('restorationOfIndependenceDay', [
'en_US' => 'Day of Restoration of Independence',
'et_EE' => 'Tasiseseisvumispäev'
], new \DateTime("{$this->year}-08-20", new \DateTimeZone($this->timezone))));
'en_US' => 'Day of Restoration of Independence',
'et_EE' => 'Tasiseseisvumispäev'
], new \DateTime("{$this->year}-08-20", new \DateTimeZone($this->timezone))));
}
}
}
24 changes: 12 additions & 12 deletions src/Yasumi/Provider/Latvia.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ private function addRestorationOfIndependenceDay()
}

$this->addHoliday(new Holiday('restorationOfIndependenceOfLatviaDay', [
'en_US' => 'Restoration of Independence day',
'lv_LV' => 'Latvijas Republikas Neatkarības atjaunošanas diena'
], $date));
'en_US' => 'Restoration of Independence day',
'lv_LV' => 'Latvijas Republikas Neatkarības atjaunošanas diena'
], $date));
}
}

Expand All @@ -88,9 +88,9 @@ private function addRestorationOfIndependenceDay()
private function addMidsummerEveDay()
{
$this->addHoliday(new Holiday('midsummerEveDay', [
'en_US' => 'Midsummer Eve',
'lv_LV' => 'Līgo Diena'
], new \DateTime("{$this->year}-06-23", new \DateTimeZone($this->timezone))));
'en_US' => 'Midsummer Eve',
'lv_LV' => 'Līgo Diena'
], new \DateTime("{$this->year}-06-23", new \DateTimeZone($this->timezone))));
}

/**
Expand All @@ -109,9 +109,9 @@ private function addProclamationDay()
}

$this->addHoliday(new Holiday('proclamationOfTheRepublicOfLatviaDay', [
'en_US' => 'Proclamation Day of the Republic of Latvia',
'lv_LV' => 'Latvijas Republikas proklamēšanas diena'
], $date));
'en_US' => 'Proclamation Day of the Republic of Latvia',
'lv_LV' => 'Latvijas Republikas proklamēšanas diena'
], $date));
}
}

Expand All @@ -121,8 +121,8 @@ private function addProclamationDay()
private function addNewYearsEve()
{
$this->addHoliday(new Holiday('newYearsEve', [
'en_US' => 'New Year\'s Eve',
'lv_LV' => 'Vecgada vakars'
], new \DateTime("{$this->year}-12-31", new \DateTimeZone($this->timezone))));
'en_US' => 'New Year\'s Eve',
'lv_LV' => 'Vecgada vakars'
], new \DateTime("{$this->year}-12-31", new \DateTimeZone($this->timezone))));
}
}
18 changes: 9 additions & 9 deletions src/Yasumi/Provider/Lithuania.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ private function addRestorationOfTheStateDay()
{
if ($this->year >= self::RESTORATION_OF_THE_STATE_YEAR) {
$this->addHoliday(new Holiday('restorationOfTheStateOfLithuaniaDay', [
'en_US' => 'Day of Restoration of the State of Lithuania',
'lt_LT' => 'Lietuvos valstybės atkūrimo diena'
], new \DateTime("{$this->year}-02-16", new \DateTimeZone($this->timezone))));
'en_US' => 'Day of Restoration of the State of Lithuania',
'lt_LT' => 'Lietuvos valstybės atkūrimo diena'
], new \DateTime("{$this->year}-02-16", new \DateTimeZone($this->timezone))));
}
}

Expand All @@ -95,9 +95,9 @@ private function addRestorationOfIndependenceDay()
{
if ($this->year >= self::RESTORATION_OF_INDEPENDENCE_YEAR) {
$this->addHoliday(new Holiday('restorationOfIndependenceOfLithuaniaDay', [
'en_US' => 'Day of Restoration of Independence of Lithuania',
'lt_LT' => 'Lietuvos nepriklausomybės atkūrimo diena'
], new \DateTime("{$this->year}-03-11", new \DateTimeZone($this->timezone))));
'en_US' => 'Day of Restoration of Independence of Lithuania',
'lt_LT' => 'Lietuvos nepriklausomybės atkūrimo diena'
], new \DateTime("{$this->year}-03-11", new \DateTimeZone($this->timezone))));
}
}

Expand All @@ -111,9 +111,9 @@ private function addStatehoodDay()
{
if ($this->year >= self::STATEHOOD_YEAR) {
$this->addHoliday(new Holiday('statehoodDay', [
'en_US' => 'Statehood Day (Lithuania)',
'lt_LT' => 'Valstybės (Lietuvos karaliaus Mindaugo karūnavimo) diena'
], new \DateTime("{$this->year}-07-06", new \DateTimeZone($this->timezone)), $this->locale));
'en_US' => 'Statehood Day (Lithuania)',
'lt_LT' => 'Valstybės (Lietuvos karaliaus Mindaugo karūnavimo) diena'
], new \DateTime("{$this->year}-07-06", new \DateTimeZone($this->timezone)), $this->locale));
}
}
}
48 changes: 24 additions & 24 deletions src/Yasumi/Provider/Russia.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ private function addNewYearsHolidays()

foreach ($holidayDays as $day) {
$this->addHoliday(new Holiday('newYearHolidaysDay' . $day, [
'en_US' => 'New Year\'s holidays',
'ru_RU' => 'Новогодние каникулы'
], new \DateTime("{$this->year}-01-{$day}", new \DateTimeZone($this->timezone))));
'en_US' => 'New Year\'s holidays',
'ru_RU' => 'Новогодние каникулы'
], new \DateTime("{$this->year}-01-{$day}", new \DateTimeZone($this->timezone))));
}
}

Expand All @@ -77,9 +77,9 @@ private function addNewYearsHolidays()
private function addOrthodoxChristmasDay()
{
$this->addHoliday(new Holiday('orthodoxChristmasDay', [
'en_US' => 'Orthodox Christmas Day',
'ru_RU' => 'Рождество'
], new \DateTime("{$this->year}-01-07", new \DateTimeZone($this->timezone))));
'en_US' => 'Orthodox Christmas Day',
'ru_RU' => 'Рождество'
], new \DateTime("{$this->year}-01-07", new \DateTimeZone($this->timezone))));
}

/**
Expand All @@ -92,9 +92,9 @@ private function addDefenceOfTheFatherlandDay()
}

$this->addHoliday(new Holiday('defenceOfTheFatherlandDay', [
'en_US' => 'Defence of the Fatherland Day',
'ru_RU' => 'День защитника Отечества'
], new \DateTime("{$this->year}-02-23", new \DateTimeZone($this->timezone))));
'en_US' => 'Defence of the Fatherland Day',
'ru_RU' => 'День защитника Отечества'
], new \DateTime("{$this->year}-02-23", new \DateTimeZone($this->timezone))));
}

/**
Expand All @@ -103,9 +103,9 @@ private function addDefenceOfTheFatherlandDay()
private function addInternationalWomensDay()
{
$this->addHoliday(new Holiday('internationalWomensDay', [
'en_US' => 'International Women\'s Day',
'ru_RU' => 'Международный женский день'
], new \DateTime("{$this->year}-03-08", new \DateTimeZone($this->timezone))));
'en_US' => 'International Women\'s Day',
'ru_RU' => 'Международный женский день'
], new \DateTime("{$this->year}-03-08", new \DateTimeZone($this->timezone))));
}

/**
Expand All @@ -114,9 +114,9 @@ private function addInternationalWomensDay()
private function addSpringAndLabourDay()
{
$this->addHoliday(new Holiday('springAndLabourDay', [
'en_US' => 'Spring and Labour Day',
'ru_RU' => 'Праздник Весны и Труда'
], new \DateTime("{$this->year}-05-01", new \DateTimeZone($this->timezone))));
'en_US' => 'Spring and Labour Day',
'ru_RU' => 'Праздник Весны и Труда'
], new \DateTime("{$this->year}-05-01", new \DateTimeZone($this->timezone))));
}

/**
Expand All @@ -125,9 +125,9 @@ private function addSpringAndLabourDay()
private function addVictoryDay()
{
$this->addHoliday(new Holiday('victoryDay', [
'en_US' => 'Victory Day',
'ru_RU' => 'День Победы'
], new \DateTime("{$this->year}-05-09", new \DateTimeZone($this->timezone))));
'en_US' => 'Victory Day',
'ru_RU' => 'День Победы'
], new \DateTime("{$this->year}-05-09", new \DateTimeZone($this->timezone))));
}

/**
Expand All @@ -140,9 +140,9 @@ private function addRussiaDay()
}

$this->addHoliday(new Holiday('russiaDay', [
'en_US' => 'Russia Day',
'ru_RU' => 'День России'
], new \DateTime("{$this->year}-06-12", new \DateTimeZone($this->timezone))));
'en_US' => 'Russia Day',
'ru_RU' => 'День России'
], new \DateTime("{$this->year}-06-12", new \DateTimeZone($this->timezone))));
}

/**
Expand All @@ -155,8 +155,8 @@ private function addUnityDay()
}

$this->addHoliday(new Holiday('unityDay', [
'en_US' => 'Unity Day',
'ru_RU' => 'День народного единства'
], new \DateTime("{$this->year}-11-04", new \DateTimeZone($this->timezone))));
'en_US' => 'Unity Day',
'ru_RU' => 'День народного единства'
], new \DateTime("{$this->year}-11-04", new \DateTimeZone($this->timezone))));
}
}
2 changes: 1 addition & 1 deletion tests/CzechRepublic/CzechRepublicTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function testOfficialHolidays()
*/
public function testObservedHolidays()
{
$this->assertDefinedHolidays(['christmasEve', ], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE);
$this->assertDefinedHolidays(['christmasEve',], self::REGION, $this->year, Holiday::TYPE_OBSERVANCE);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/Ireland/ChristmasDayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function testHoliday($year, $expected)
$date = new DateTime($expected, new DateTimeZone(self::TIMEZONE));
$this->assertHoliday(self::REGION, self::HOLIDAY, $year, $date);

if (in_array((int) $date->format('w'), [0, 6], true)) {
if (in_array((int)$date->format('w'), [0, 6], true)) {
$date->modify('next tuesday');
$this->assertHoliday(self::REGION, 'substituteHoliday:' . self::HOLIDAY, $year, $date);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Ireland/NewYearsDayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function testHoliday($year, $expected)
$date = new DateTime($expected, new DateTimeZone(self::TIMEZONE));
$this->assertHoliday(self::REGION, self::HOLIDAY, $year, $date);

if (0 === (int) $date->format('w')) {
if (0 === (int)$date->format('w')) {
$date->modify('next monday');
$this->assertHoliday(self::REGION, 'substituteHoliday:' . self::HOLIDAY, $year, $date);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Ireland/StPatricksDayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function testHoliday($year, $expected)
$date = new DateTime($expected, new DateTimeZone(self::TIMEZONE));
$this->assertHoliday(self::REGION, self::HOLIDAY, $year, $date);

if (in_array((int) $date->format('w'), [0, 6], true)) {
if (in_array((int)$date->format('w'), [0, 6], true)) {
$date->modify('next monday');
$this->assertHoliday(self::REGION, 'substituteHoliday:' . self::HOLIDAY, $year, $date);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Ireland/StStephensDayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function testHoliday($year, $expected)
$date = new DateTime($expected, new DateTimeZone(self::TIMEZONE));
$this->assertHoliday(self::REGION, self::HOLIDAY, $year, $date);

if (in_array((int) $date->format('w'), [0, 6], true)) {
if (in_array((int)$date->format('w'), [0, 6], true)) {
$date->modify('next monday');
$this->assertHoliday(self::REGION, 'substituteHoliday:' . self::HOLIDAY, $year, $date);
}
Expand Down
9 changes: 4 additions & 5 deletions tests/Japan/PublicBridgeDayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,14 @@
*/
class PublicBridgeDayTest extends JapanBaseTestCase implements YasumiTestCaseInterface
{
/**
* @var number representing the calendar year to be tested against
*/
private $year;

/**
* The name of the holiday
*/
const HOLIDAY = 'bridgeDay';
/**
* @var number representing the calendar year to be tested against
*/
private $year;

/**
* Tests public bridge days.
Expand Down
2 changes: 1 addition & 1 deletion tests/Latvia/ProclamationOfTheRepublicOfLatviaDayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function testTranslation()
$this->generateRandomYear(Latvia::PROCLAMATION_OF_INDEPENDENCE_YEAR),
[
self::LOCALE => 'Latvijas Republikas proklamēšanas diena',
'en_US' => 'Proclamation Day of the Republic of Latvia'
'en_US' => 'Proclamation Day of the Republic of Latvia'
]
);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Latvia/RestorationOfIndependenceDayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function testTranslation()
$this->generateRandomYear(Latvia::RESTORATION_OF_INDEPENDENCE_YEAR),
[
self::LOCALE => 'Latvijas Republikas Neatkarības atjaunošanas diena',
'en_US' => 'Restoration of Independence day'
'en_US' => 'Restoration of Independence day'
]
);
}
Expand Down
19 changes: 6 additions & 13 deletions tests/NewZealand/AnzacDayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,12 @@ public function testNotHoliday()
*/
public function HolidayDataProvider()
{
return $this->generateRandomDatesWithModifier(
4,
25,
function ($year, \DateTime $date) {
// in 2015 some policy was introduced to make sure this holiday was celebrated during the working week.
if ($year >= 2015 && $this->isWeekend($date)) {
$date->modify('next monday');
}
},
self::TIMEZONE,
100,
self::ESTABLISHMENT_YEAR
);
return $this->generateRandomDatesWithModifier(4, 25, function ($year, \DateTime $date) {
// in 2015 some policy was introduced to make sure this holiday was celebrated during the working week.
if ($year >= 2015 && $this->isWeekend($date)) {
$date->modify('next monday');
}
}, self::TIMEZONE, 100, self::ESTABLISHMENT_YEAR);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/NewZealand/BoxingDayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function HolidayDataProvider()
$year = $this->generateRandomYear();
$date = new DateTime("$year-12-26", new DateTimeZone(self::TIMEZONE));

if (in_array((int) $date->format('w'), [0, 6], true)) {
if (in_array((int)$date->format('w'), [0, 6], true)) {
$date->add(new DateInterval('P2D'));
}

Expand Down
Loading

0 comments on commit 54f873c

Please sign in to comment.