forked from azuyalabs/yasumi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added filters feature. Using Yasumi you can filter holiday providers …
…to only show official holidays, observed holidays, bank holidays, seasonal holidays or other type of holidays.
- Loading branch information
1 parent
d48ffc8
commit 74e89c0
Showing
7 changed files
with
410 additions
and
9 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,40 @@ | ||
<?php | ||
/* | ||
* This file is part of the Yasumi package. | ||
* | ||
* Copyright (c) 2015 AzuyaLabs | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @author Sacha Telgenhof <[email protected]> | ||
*/ | ||
namespace Yasumi\Filters; | ||
|
||
use FilterIterator; | ||
use Yasumi\Holiday; | ||
|
||
/** | ||
* BankHolidaysFilter is a class for filtering all bank holidays | ||
* | ||
* BankHolidaysFilter is a class that returns all holidays that are considered bank holidays of any given holiday | ||
* provider. | ||
* | ||
* Example usage: | ||
* $holidays = Yasumi::create('Netherlands', 2015); | ||
* $bank = new BankHolidaysFilter($holidays->getIterator()); | ||
* | ||
* @package Yasumi | ||
*/ | ||
class BankHolidaysFilter extends FilterIterator | ||
{ | ||
/** | ||
* Checks whether the current element of the iterator is an observed holiday | ||
* | ||
* @return bool | ||
*/ | ||
public function accept() | ||
{ | ||
return ($this->getInnerIterator()->current()->getType() === Holiday::TYPE_BANK) ? true : false; | ||
} | ||
} |
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,40 @@ | ||
<?php | ||
/* | ||
* This file is part of the Yasumi package. | ||
* | ||
* Copyright (c) 2015 AzuyaLabs | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @author Sacha Telgenhof <[email protected]> | ||
*/ | ||
namespace Yasumi\Filters; | ||
|
||
use FilterIterator; | ||
use Yasumi\Holiday; | ||
|
||
/** | ||
* ObservedHolidaysFilter is a class for filtering all observed holidays | ||
* | ||
* ObservedHolidaysFilter is a class that returns all holidays that are considered observed of any given holiday | ||
* provider. | ||
* | ||
* Example usage: | ||
* $holidays = Yasumi::create('Netherlands', 2015); | ||
* $observed = new ObservedHolidaysFilter($holidays->getIterator()); | ||
* | ||
* @package Yasumi | ||
*/ | ||
class ObservedHolidaysFilter extends FilterIterator | ||
{ | ||
/** | ||
* Checks whether the current element of the iterator is an observed holiday | ||
* | ||
* @return bool | ||
*/ | ||
public function accept() | ||
{ | ||
return ($this->getInnerIterator()->current()->getType() === Holiday::TYPE_OBSERVANCE) ? true : false; | ||
} | ||
} |
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,40 @@ | ||
<?php | ||
/* | ||
* This file is part of the Yasumi package. | ||
* | ||
* Copyright (c) 2015 AzuyaLabs | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @author Sacha Telgenhof <[email protected]> | ||
*/ | ||
namespace Yasumi\Filters; | ||
|
||
use FilterIterator; | ||
use Yasumi\Holiday; | ||
|
||
/** | ||
* 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 | ||
* holiday provider. | ||
* | ||
* Example usage: | ||
* $holidays = Yasumi::create('Netherlands', 2015); | ||
* $official = new OfficialHolidaysFilter($holidays->getIterator()); | ||
* | ||
* @package Yasumi | ||
*/ | ||
class OfficialHolidaysFilter extends FilterIterator | ||
{ | ||
/** | ||
* Checks whether the current element of the iterator is a national/official holiday | ||
* | ||
* @return bool | ||
*/ | ||
public function accept() | ||
{ | ||
return ($this->getInnerIterator()->current()->getType() === Holiday::TYPE_NATIONAL) ? true : false; | ||
} | ||
} |
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,40 @@ | ||
<?php | ||
/* | ||
* This file is part of the Yasumi package. | ||
* | ||
* Copyright (c) 2015 AzuyaLabs | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @author Sacha Telgenhof <[email protected]> | ||
*/ | ||
namespace Yasumi\Filters; | ||
|
||
use FilterIterator; | ||
use Yasumi\Holiday; | ||
|
||
/** | ||
* OtherHolidaysFilter is a class for filtering all other type of holidays | ||
* | ||
* OtherHolidaysFilter is a class that returns all holidays that are considered an other type of holiday of any given | ||
* holiday provider. | ||
* | ||
* Example usage: | ||
* $holidays = Yasumi::create('Netherlands', 2015); | ||
* $other = new OtherHolidaysFilter($holidays->getIterator()); | ||
* | ||
* @package Yasumi | ||
*/ | ||
class OtherHolidaysFilter extends FilterIterator | ||
{ | ||
/** | ||
* Checks whether the current element of the iterator is an other type of holiday | ||
* | ||
* @return bool | ||
*/ | ||
public function accept() | ||
{ | ||
return ($this->getInnerIterator()->current()->getType() === Holiday::TYPE_OTHER) ? true : false; | ||
} | ||
} |
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,40 @@ | ||
<?php | ||
/* | ||
* This file is part of the Yasumi package. | ||
* | ||
* Copyright (c) 2015 AzuyaLabs | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @author Sacha Telgenhof <[email protected]> | ||
*/ | ||
namespace Yasumi\Filters; | ||
|
||
use FilterIterator; | ||
use Yasumi\Holiday; | ||
|
||
/** | ||
* SeasonalHolidaysFilter is a class for filtering all seasonal holidays | ||
* | ||
* OfficialHolidaysFilter is a class that returns all holidays that are considered seasonal of any given holiday | ||
* provider. | ||
* | ||
* Example usage: | ||
* $holidays = Yasumi::create('Netherlands', 2015); | ||
* $seasonal = new SeasonalHolidaysFilter($holidays->getIterator()); | ||
* | ||
* @package Yasumi | ||
*/ | ||
class SeasonalHolidaysFilter extends FilterIterator | ||
{ | ||
/** | ||
* Checks whether the current element of the iterator is a seasonal holiday | ||
* | ||
* @return bool | ||
*/ | ||
public function accept() | ||
{ | ||
return ($this->getInnerIterator()->current()->getType() === Holiday::TYPE_SEASON) ? true : false; | ||
} | ||
} |
Oops, something went wrong.