-
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.
Merge pull request #17 from Danubio/master
Portugal Holidays
- Loading branch information
Showing
2 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
namespace Checkdomain\Holiday\Provider; | ||
|
||
/** | ||
* Portugal holiday provider | ||
* | ||
* @author Tiago Carvalho <[email protected]> | ||
*/ | ||
class PT extends AbstractEaster | ||
{ | ||
|
||
/** | ||
* @param int $year | ||
* | ||
* @return mixed | ||
*/ | ||
public function getHolidaysByYear($year) | ||
{ | ||
$easter = $this->getEasterDates($year); | ||
|
||
$holidays = array( | ||
'01-01' => $this->createData('Ano Novo'), | ||
'04-25' => $this->createData('25 de Abril'), | ||
'05-01' => $this->createData('Dia do Trabalhador'), | ||
'06-10' => $this->createData('Dia de Portugal'), | ||
'08-15' => $this->createData('Assunção de Nossa Senhora'), | ||
'12-08' => $this->createData('Dia da Imaculada Conceição'), | ||
'12-25' => $this->createData('Natal'), | ||
// Variable dates | ||
$easter['goodFriday']->format(self::DATE_FORMAT) => $this->createData('Sexta-Feira Santa'), | ||
$easter['easterSunday']->format(self::DATE_FORMAT) => $this->createData('Páscoa'), | ||
); | ||
//add holidays post 2015 | ||
if ($year >= 2016) { | ||
$holidays['05-26'] = $this->createData('Corpo de Deus'); | ||
$holidays['10-05'] = $this->createData('Implantação da República'); | ||
$holidays['11-01'] = $this->createData('Dia de Todos os Santos'); | ||
$holidays['12-01'] = $this->createData('Restauração da Independência'); | ||
} | ||
|
||
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,50 @@ | ||
<?php | ||
/** | ||
* Portuguese holiday provider | ||
* | ||
* @author Tiago Carvalho <[email protected]> | ||
*/ | ||
namespace Checkdomain\Holiday\Provider; | ||
|
||
/** | ||
* Class PTTest | ||
*/ | ||
class PTTest extends AbstractTest | ||
{ | ||
/** | ||
* {@inheritDoc} | ||
*/ | ||
public function setUp() | ||
{ | ||
$this->provider = new PT(); | ||
} | ||
|
||
/** | ||
* Provides some test dates and the expectation | ||
* | ||
* @return array | ||
*/ | ||
public function dateProvider() | ||
{ | ||
return array( | ||
array('01.01.2010', null, array('name' => 'Ano Novo')), | ||
|
||
array('26.05.2013', null, null), | ||
array('25.04.2013', null, array('name' => '25 de Abril')), | ||
|
||
array('05.10.2014', null, null), | ||
array('01.05.2014', null, array('name' => 'Dia do Trabalhador')), | ||
|
||
array('01.12.2015', null, null), | ||
array('15.08.2015', null, array('name' => 'Assunção de Nossa Senhora')), | ||
|
||
array('02.01.2016', null, null), | ||
array('01.11.2016', null, array('name' => 'Dia de Todos os Santos')), | ||
array('25.12.2016', null, array('name' => 'Natal')), | ||
|
||
array('03.09.2017', null, null), | ||
array('01.12.2017', null, array('name' => 'Restauração da Independência')), | ||
array('10.06.2017', null, array('name' => 'Dia de Portugal')), | ||
); | ||
} | ||
} |