Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
379 additions
and
48 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
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,27 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: Galek | ||
* Date: 9.3.2018 | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Galek\Utils\Calendar\Enum; | ||
|
||
|
||
class Country | ||
{ | ||
public const CZ = 'CzechRepublic', | ||
SK = 'Slovakia', | ||
PL = 'Poland', | ||
DE = 'Germany', | ||
AT = 'Austria'; | ||
|
||
public static $list = [ | ||
self::CZ, | ||
self::SK, | ||
self::PL, | ||
self::DE, | ||
self::AT, | ||
]; | ||
} |
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,23 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: Galek | ||
* Date: 9.3.2018 | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Galek\Utils\Calendar\Enum; | ||
|
||
|
||
class Localization | ||
{ | ||
public const CZ = 'cs', | ||
SK = 'sk', | ||
PL = 'en'; | ||
|
||
public static $list = [ | ||
self::CZ, | ||
self::SK, | ||
self::PL, | ||
]; | ||
} |
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,63 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: Galek | ||
* Date: 9.3.2018 | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Galek\Utils; | ||
|
||
|
||
use Galek\Utils\Calendar\Validators\CountryValidator; | ||
use Nette\Neon\Neon; | ||
|
||
|
||
class Holidays | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
private $country; | ||
|
||
|
||
public function __construct(string $country) | ||
{ | ||
$this->setCountry($country); | ||
} | ||
|
||
|
||
public function setCountry(string $country) | ||
{ | ||
CountryValidator::validate($country); | ||
$this->country = $country; | ||
} | ||
|
||
|
||
/** | ||
* @return array | ||
*/ | ||
public function getHolidays() | ||
{ | ||
return $this->loadConfig()['holidays']; | ||
} | ||
|
||
|
||
public function allowedEaster() | ||
{ | ||
return $this->loadConfig()['easter']; | ||
} | ||
|
||
|
||
public function allowedGoodFriday() | ||
{ | ||
return $this->loadConfig()['goodFriday']; | ||
} | ||
|
||
|
||
private function loadConfig() | ||
{ | ||
$file = __DIR__ . '/Holidays/' . $this->country . '.neon'; | ||
return Neon::decode(file_get_contents($file), Neon::BLOCK); | ||
} | ||
} |
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,20 @@ | ||
holidays: | ||
# měsíc - den | ||
- '01-01' | ||
- '01-06' | ||
- '05-01' | ||
- '05-10' | ||
- '05-20' | ||
- '05-21' | ||
- '05-31' | ||
- '08-15' | ||
- '09-24' | ||
- '10-26' | ||
- '11-01' | ||
- '11-15' | ||
- '12-08' | ||
- '12-25' | ||
- '12-26' | ||
|
||
easter: true | ||
goodFriday: true |
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,16 @@ | ||
holidays: | ||
# měsíc - den | ||
- '01-01' | ||
- '05-01' | ||
- '05-08' | ||
- '07-05' | ||
- '07-06' | ||
- '09-28' | ||
- '10-28' | ||
- '11-17' | ||
- '12-24' | ||
- '12-25' | ||
- '12-26' | ||
|
||
easter: true | ||
goodFriday: true |
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,18 @@ | ||
holidays: | ||
# měsíc - den | ||
- '01-01' | ||
- '01-06' | ||
- '05-01' | ||
- '05-10' | ||
- '05-21' | ||
- '05-31' | ||
- '08-15' | ||
- '10-03' | ||
- '10-31' | ||
- '11-01' | ||
- '11-21' | ||
- '12-25' | ||
- '12-26' | ||
|
||
easter: true | ||
goodFriday: true |
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,16 @@ | ||
holidays: | ||
# měsíc - den | ||
- '01-01' | ||
- '01-06' | ||
- '05-01' | ||
- '05-03' | ||
- '05-20' | ||
- '05-31' | ||
- '08-15' | ||
- '11-01' | ||
- '11-11' | ||
- '12-25' | ||
- '12-26' | ||
|
||
easter: true | ||
goodFriday: true |
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,18 @@ | ||
holidays: | ||
# měsíc - den | ||
- '01-01' | ||
- '01-06' | ||
- '05-01' | ||
- '05-08' | ||
- '07-05' | ||
- '08-29' | ||
- '09-01' | ||
- '09-15' | ||
- '11-01' | ||
- '11-17' | ||
- '12-24' | ||
- '12-25' | ||
- '12-26' | ||
|
||
easter: true | ||
goodFriday: true |
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
Oops, something went wrong.