-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added 5 countries: RO, LV, LT, EE, HU
Added flags to README.md Added running specific tests comment to tests section of README.md
- Loading branch information
Showing
11 changed files
with
543 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
namespace Checkdomain\Holiday\Provider; | ||
|
||
/** | ||
* Estonian non-working holidays provider | ||
* | ||
* @author Roman Agilov <[email protected]> | ||
* @since 2018-03-27 | ||
* @see https://en.wikipedia.org/wiki/Public_holidays_in_Estonia | ||
*/ | ||
class EE extends AbstractEaster | ||
{ | ||
/** | ||
* Getting non-working holidays | ||
* | ||
* @param int $year | ||
* | ||
* @return mixed | ||
*/ | ||
public function getHolidaysByYear($year) | ||
{ | ||
$easter = $this->getEasterDates($year); | ||
|
||
$holidays = array( | ||
|
||
'01-01' => $this->createData('uusaasta'), | ||
'02-24' => $this->createData('iseseisvuspäev'), | ||
'05-01' => $this->createData('kevadpüha'), | ||
'06-23' => $this->createData('võidupüha and jaanilaupäev'), | ||
'06-24' => $this->createData('võidupüha and jaanilaupäev'), | ||
'08-20' => $this->createData('taasiseseisvumispäev'), | ||
'12-24' => $this->createData('jõululaupäev'), | ||
'12-25' => $this->createData('esimene jõulupüha'), | ||
'12-26' => $this->createData('teine jõulupüha'), | ||
|
||
// Easter dates | ||
$easter['goodFriday']->format(self::DATE_FORMAT) => $this->createData('suur reede'), | ||
$easter['easterSunday']->format(self::DATE_FORMAT) => $this->createData('ülestõusmispühade 1. püha'), | ||
|
||
$easter['pentecostSunday']->format(self::DATE_FORMAT) => $this->createData('nelipühade 1. püha'), | ||
); | ||
|
||
return $holidays; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
namespace Checkdomain\Holiday\Provider; | ||
|
||
/** | ||
* Hungarian non-working holidays provider | ||
* | ||
* @author Roman Agilov <[email protected]> | ||
* @since 2018-03-27 | ||
* @see https://en.wikipedia.org/wiki/Public_holidays_in_Hungary | ||
*/ | ||
class HU extends AbstractEaster | ||
{ | ||
/** | ||
* | ||
* | ||
* Getting non-working holidays | ||
* | ||
* @param int $year | ||
* | ||
* @return mixed | ||
*/ | ||
public function getHolidaysByYear($year) | ||
{ | ||
$easter = $this->getEasterDates($year); | ||
|
||
$holidays = array( | ||
'01-01' => $this->createData('Újév'), | ||
'03-15' => $this->createData('Nemzeti ünnep'), | ||
'05-01' => $this->createData('A munka ünnepe'), | ||
'08-20' => $this->createData('Az államalapítás ünnepe'), | ||
'10-23' => $this->createData('Nemzeti ünnep'), | ||
'11-01' => $this->createData('Mindenszentek'), | ||
'12-25' => $this->createData('Karácsony'), | ||
'12-26' => $this->createData('Karácsony'), | ||
|
||
// Easter dates | ||
$easter['easterSunday']->format(self::DATE_FORMAT) => $this->createData('Húsvétvasárnap'), | ||
$easter['easterMonday']->format(self::DATE_FORMAT) => $this->createData('Húsvéthétfő'), | ||
|
||
$easter['pentecostSunday']->format(self::DATE_FORMAT) => $this->createData('Pünkösdvasárnap'), | ||
$easter['pentecostMonday']->format(self::DATE_FORMAT) => $this->createData('Pünkösdhétfő'), | ||
); | ||
|
||
//add holidays post 2017 | ||
if ($year >= 2017) { | ||
$holidays[$easter['goodFriday']->format(self::DATE_FORMAT)] = $this->createData('Nagypéntek'); | ||
} | ||
|
||
return $holidays; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
|
||
namespace Checkdomain\Holiday\Provider; | ||
|
||
/** | ||
* Lithuanian non-working holidays provider | ||
* | ||
* @author Roman Agilov <[email protected]> | ||
* @since 2018-03-27 | ||
* @see https://en.wikipedia.org/wiki/Public_holidays_in_Lithuania | ||
*/ | ||
class LT extends AbstractEaster | ||
{ | ||
/** | ||
* Getting non-working holidays | ||
* | ||
* @param int $year | ||
* | ||
* @return mixed | ||
*/ | ||
public function getHolidaysByYear($year) | ||
{ | ||
$easter = $this->getEasterDates($year); | ||
|
||
$mothersDay = date('m-d', strtotime('first Sunday of May '. $year)); | ||
$fathersDay = date('m-d', strtotime('first Sunday of June '. $year)); | ||
|
||
$holidays = array( | ||
'01-01' => $this->createData('Naujieji metai'), | ||
'02-16' => $this->createData('Lietuvos valstybės atkūrimo diena'), | ||
'03-11' => $this->createData('Lietuvos nepriklausomybės atkūrimo diena'), | ||
'05-01' => $this->createData('Tarptautinė darbo diena'), | ||
'06-24' => $this->createData('Joninės, Rasos'), | ||
'07-06' => $this->createData('Valstybės (Lietuvos karaliaus Mindaugo karūnavimo) diena'), | ||
'08-15' => $this->createData('Žolinė (Švč. Mergelės Marijos ėmimo į dangų diena)'), | ||
'11-01' => $this->createData('Visų šventųjų diena (Vėlinės)'), | ||
'12-24' => $this->createData('Šv. Kūčios'), | ||
'12-25' => $this->createData('Šv. Kalėdos'), | ||
'12-26' => $this->createData('Šv. Kalėdos'), | ||
|
||
// floating days | ||
$mothersDay => $this->createData('Motinos diena'), | ||
$fathersDay => $this->createData('Tėvo diena'), | ||
|
||
// Easter dates | ||
$easter['easterSunday']->format(self::DATE_FORMAT) => $this->createData('Velykos'), | ||
); | ||
|
||
return $holidays; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
|
||
namespace Checkdomain\Holiday\Provider; | ||
|
||
/** | ||
* Latvian non-working holidays provider | ||
* | ||
* @author Roman Agilov <[email protected]> | ||
* @since 2018-03-27 | ||
* @see https://en.wikipedia.org/wiki/Public_holidays_in_Latvia | ||
*/ | ||
class LV extends AbstractEaster | ||
{ | ||
/** | ||
* Getting non-working holidays | ||
* | ||
* @param int $year | ||
* | ||
* @return mixed | ||
*/ | ||
public function getHolidaysByYear($year) | ||
{ | ||
$easter = $this->getEasterDates($year); | ||
|
||
$mothersDay = date('m-d', strtotime('second Sunday of May '. $year)); | ||
|
||
$holidays = array( | ||
'01-01' => $this->createData('Jaunais Gads'), | ||
'05-01' => $this->createData('Darba svētki'), | ||
'05-04' => $this->createData('Latvijas Republikas Neatkarības atjaunošanas diena'), | ||
$mothersDay => $this->createData('Mātes diena'), | ||
'06-23' => $this->createData('Līgo Diena'), | ||
'06-24' => $this->createData('Jāņi'), | ||
'11-18' => $this->createData('Latvijas Republikas proklamēšanas diena'), | ||
'12-24' => $this->createData('Ziemassvētku vakars'), | ||
'12-25' => $this->createData('Ziemassvētki'), | ||
'12-26' => $this->createData('Otrie Ziemassvētki'), | ||
'12-31' => $this->createData('Vecgada vakars'), | ||
|
||
// Easter dates | ||
$easter['goodFriday']->format(self::DATE_FORMAT) => $this->createData('Lielā Piektdiena'), | ||
$easter['easterSunday']->format(self::DATE_FORMAT) => $this->createData('Lieldienas'), | ||
$easter['easterMonday']->format(self::DATE_FORMAT) => $this->createData('Otrās Lieldienas'), | ||
); | ||
|
||
return $holidays; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
namespace Checkdomain\Holiday\Provider; | ||
|
||
/** | ||
* Romanian non-working holidays provider | ||
* | ||
* @author Roman Agilov <[email protected]> | ||
* @since 2018-03-27 | ||
* @see https://en.wikipedia.org/wiki/Public_holidays_in_Romania | ||
*/ | ||
class RO extends AbstractEaster | ||
{ | ||
/** | ||
* Getting non-working holidays | ||
* | ||
* @param int $year | ||
* | ||
* @return mixed | ||
*/ | ||
public function getHolidaysByYear($year) | ||
{ | ||
$easter = $this->getEasterDates($year); | ||
|
||
$holidays = array( | ||
'01-01' => $this->createData('Anul Nou'), | ||
'01-02' => $this->createData('Anul Nou'), | ||
'01-24' => $this->createData('Unirea Principatelor Române/Mica Unire'), | ||
'05-01' => $this->createData('Ziua Muncii'), | ||
'08-15' => $this->createData('Adormirea Maicii Domnului/Sfânta Maria Mare'), | ||
|
||
'11-30' => $this->createData('Sfântul Andrei'), | ||
'12-01' => $this->createData('Ziua Națională/Ziua Marii Uniri'), | ||
'12-25' => $this->createData('Crăciunul'), | ||
'12-26' => $this->createData('Crăciunul'), | ||
|
||
// Easter dates | ||
$easter['easterSunday']->format(self::DATE_FORMAT) => $this->createData('Paștele'), | ||
$easter['easterMonday']->format(self::DATE_FORMAT) => $this->createData('Paștele'), | ||
|
||
$easter['pentecostSunday']->format(self::DATE_FORMAT) => $this->createData('Rusaliile'), | ||
$easter['pentecostMonday']->format(self::DATE_FORMAT) => $this->createData('Rusaliile'), | ||
); | ||
|
||
//add holidays post 2017 | ||
if ($year >= 2017) { | ||
$holidays['06-01'] = $this->createData('Ziua Copilului'); | ||
} | ||
|
||
return $holidays; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
namespace Checkdomain\Holiday\Provider; | ||
|
||
/** | ||
* Class EETest | ||
*/ | ||
class EETest extends AbstractTest | ||
{ | ||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function setUp() | ||
{ | ||
$this->provider = new EE(); | ||
} | ||
|
||
/** | ||
* Provides some test dates and the expectation | ||
* | ||
* vendor/bin/phpunit --filter EETest | ||
* | ||
* @return array | ||
*/ | ||
public function dateProvider() | ||
{ | ||
return array( | ||
array('2018-01-03', null, null), | ||
array('2018-03-21', null, null), | ||
array('2018-03-22', null, null), | ||
array('2018-12-27', null, null), | ||
|
||
array('2018-01-01', null, array('name' => 'uusaasta')), | ||
array('2018-02-24', null, array('name' => 'iseseisvuspäev')), | ||
array('2018-05-01', null, array('name' => 'kevadpüha')), | ||
array('2018-06-23', null, array('name' => 'võidupüha and jaanilaupäev')), | ||
array('2018-06-24', null, array('name' => 'võidupüha and jaanilaupäev')), | ||
array('2018-08-20', null, array('name' => 'taasiseseisvumispäev')), | ||
array('2018-12-24', null, array('name' => 'jõululaupäev')), | ||
array('2018-12-25', null, array('name' => 'esimene jõulupüha')), | ||
array('2018-12-26', null, array('name' => 'teine jõulupüha')), | ||
|
||
// Easter dates 2018 | ||
array('2018-03-30', null, array('name' => 'suur reede')), | ||
array('2018-04-01', null, array('name' => 'ülestõusmispühade 1. püha')), | ||
array('2018-05-20', null, array('name' => 'nelipühade 1. püha')), | ||
|
||
// Easter dates 2019 | ||
array('2019-04-19', null, array('name' => 'suur reede')), | ||
array('2019-04-21', null, array('name' => 'ülestõusmispühade 1. püha')), | ||
array('2019-06-09', null, array('name' => 'nelipühade 1. püha')), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
|
||
namespace Checkdomain\Holiday\Provider; | ||
|
||
/** | ||
* Class HUTest | ||
*/ | ||
class HUTest extends AbstractTest | ||
{ | ||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function setUp() | ||
{ | ||
$this->provider = new HU(); | ||
} | ||
|
||
/** | ||
* Provides some test dates and the expectation | ||
* | ||
* vendor/bin/phpunit --filter HUTest | ||
* | ||
* @return array | ||
*/ | ||
public function dateProvider() | ||
{ | ||
return array( | ||
array('2018-01-03', null, null), | ||
array('2018-03-21', null, null), | ||
array('2018-03-22', null, null), | ||
array('2018-12-27', null, null), | ||
|
||
array('2018-01-01', null, array('name' => 'Újév')), | ||
array('2018-03-15', null, array('name' => 'Nemzeti ünnep')), | ||
array('2018-05-01', null, array('name' => 'A munka ünnepe')), | ||
array('2018-08-20', null, array('name' => 'Az államalapítás ünnepe')), | ||
array('2018-10-23', null, array('name' => 'Nemzeti ünnep')), | ||
array('2018-11-01', null, array('name' => 'Mindenszentek')), | ||
array('2018-12-25', null, array('name' => 'Karácsony')), | ||
array('2018-12-26', null, array('name' => 'Karácsony')), | ||
|
||
|
||
// Easter dates 2018 | ||
array('2018-04-01', null, array('name' => 'Húsvétvasárnap')), | ||
array('2018-04-02', null, array('name' => 'Húsvéthétfő')), | ||
array('2018-05-20', null, array('name' => 'Pünkösdvasárnap')), | ||
array('2018-05-21', null, array('name' => 'Pünkösdhétfő')), | ||
|
||
// Easter dates 2019 | ||
array('2019-04-21', null, array('name' => 'Húsvétvasárnap')), | ||
array('2019-04-22', null, array('name' => 'Húsvéthétfő')), | ||
array('2019-06-09', null, array('name' => 'Pünkösdvasárnap')), | ||
array('2019-06-10', null, array('name' => 'Pünkösdhétfő')), | ||
); | ||
} | ||
} |
Oops, something went wrong.