Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Holiday providers for states of Austria #182

Merged
merged 16 commits into from
Nov 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions src/Yasumi/Provider/Austria.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,34 @@ private function calculateNationalDay(): void
$this->locale
));
}

/**
* Saint Leopold's Day.
*
* Saint Leopold III, known as Leopold the Good, was the Margrave of Austria
* from 1095 to his death in 1136. He was a member of the House of
* Babenberg. He was canonized on 6 January 1485 and became the patron saint
* of Austria, Lower Austria, Upper Austria, and Vienna. His feast day is 15
* November.
*
* @link https://en.wikipedia.org/wiki/Leopold_III,_Margrave_of_Austria
*
* @throws InvalidDateException
* @throws \InvalidArgumentException
* @throws UnknownLocaleException
* @throws \Exception
*/
protected function calculateStLeopoldsDay(): void
{
if ($this->year < 1136) {
return;
}

$this->addHoliday(new Holiday(
'stLeopoldsDay',
[],
new DateTime($this->year . '-11-15', new \DateTimeZone($this->timezone)),
$this->locale
));
}
}
47 changes: 47 additions & 0 deletions src/Yasumi/Provider/Austria/Burgenland.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php declare(strict_types=1);
/**
* This file is part of the Yasumi package.
*
* Copyright (c) 2015 - 2019 AzuyaLabs
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @author Sacha Telgenhof <me@sachatelgenhof.com>
*/

namespace Yasumi\Provider\Austria;

use Yasumi\Exception\InvalidDateException;
use Yasumi\Exception\UnknownLocaleException;
use Yasumi\Provider\Austria;

/**
* Provider for all holidays in Burgenland (Austria).
*
* @link https://en.wikipedia.org/wiki/Burgenland
*/
class Burgenland extends Austria
{
/**
* Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective
* country or sub-region.
*/
public const ID = 'AT-1';

/**
* Initialize holidays for Burgenland (Austria).
*
* @throws InvalidDateException
* @throws \InvalidArgumentException
* @throws UnknownLocaleException
* @throws \Exception
*/
public function initialize(): void
{
parent::initialize();

// Add custom Common holidays.
$this->addHoliday($this->stMartinsDay($this->year, $this->timezone, $this->locale));
}
}
79 changes: 79 additions & 0 deletions src/Yasumi/Provider/Austria/Carinthia.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
<?php declare(strict_types=1);
/**
* This file is part of the Yasumi package.
*
* Copyright (c) 2015 - 2019 AzuyaLabs
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @author Sacha Telgenhof <me@sachatelgenhof.com>
*/

namespace Yasumi\Provider\Austria;

use DateTime;
use Yasumi\Exception\InvalidDateException;
use Yasumi\Exception\UnknownLocaleException;
use Yasumi\Holiday;
use Yasumi\Provider\Austria;

/**
* Provider for all holidays in Carinthia (Austria).
*
* @link https://en.wikipedia.org/wiki/Carinthia
*/
class Carinthia extends Austria
{
/**
* Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective
* country or sub-region.
*/
public const ID = 'AT-2';

/**
* Initialize holidays for Carinthia (Austria).
*
* @throws InvalidDateException
* @throws \InvalidArgumentException
* @throws UnknownLocaleException
* @throws \Exception
*/
public function initialize(): void
{
parent::initialize();

// Add custom Common holidays.
$this->addHoliday($this->stJosephsDay($this->year, $this->timezone, $this->locale));
$this->calculatePlebisciteDay();
}

/**
* Plebiscite Day.
*
* The Carinthian plebiscite was held on 10 October 1920 in the area
* predominantly settled by Carinthian Slovenes. It determined the final
* southern border between the Republic of Austria and the newly formed
* Kingdom of Serbs, Croats and Slovenes (Yugoslavia) after World War I.
*
* @link https://en.wikipedia.org/wiki/1920_Carinthian_plebiscite
*
* @throws InvalidDateException
* @throws \InvalidArgumentException
* @throws UnknownLocaleException
* @throws \Exception
*/
private function calculatePlebisciteDay(): void
{
if ($this->year < 1920) {
return;
}

$this->addHoliday(new Holiday(
'plebisciteDay',
[],
new DateTime($this->year . '-10-10', new \DateTimeZone($this->timezone)),
$this->locale
));
}
}
47 changes: 47 additions & 0 deletions src/Yasumi/Provider/Austria/LowerAustria.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php declare(strict_types=1);
/**
* This file is part of the Yasumi package.
*
* Copyright (c) 2015 - 2019 AzuyaLabs
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @author Sacha Telgenhof <me@sachatelgenhof.com>
*/

namespace Yasumi\Provider\Austria;

use Yasumi\Exception\InvalidDateException;
use Yasumi\Exception\UnknownLocaleException;
use Yasumi\Provider\Austria;

/**
* Provider for all holidays in Lower Austria (Austria).
*
* @link https://en.wikipedia.org/wiki/Lower_Austria
*/
class LowerAustria extends Austria
{
/**
* Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective
* country or sub-region.
*/
public const ID = 'AT-3';

/**
* Initialize holidays for Lower Austria (Austria).
*
* @throws InvalidDateException
* @throws \InvalidArgumentException
* @throws UnknownLocaleException
* @throws \Exception
*/
public function initialize(): void
{
parent::initialize();

// Add custom holidays.
$this->calculateStLeopoldsDay();
}
}
80 changes: 80 additions & 0 deletions src/Yasumi/Provider/Austria/Salzburg.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?php declare(strict_types=1);
/**
* This file is part of the Yasumi package.
*
* Copyright (c) 2015 - 2019 AzuyaLabs
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @author Sacha Telgenhof <me@sachatelgenhof.com>
*/

namespace Yasumi\Provider\Austria;

use DateTime;
use Yasumi\Exception\InvalidDateException;
use Yasumi\Exception\UnknownLocaleException;
use Yasumi\Holiday;
use Yasumi\Provider\Austria;

/**
* Provider for all holidays in Salzburg (Austria).
*
* @link https://en.wikipedia.org/wiki/Salzburg_(state)
*/
class Salzburg extends Austria
{
/**
* Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective
* country or sub-region.
*/
public const ID = 'AT-5';

/**
* Initialize holidays for Salzburg (Austria).
*
* @throws InvalidDateException
* @throws \InvalidArgumentException
* @throws UnknownLocaleException
* @throws \Exception
*/
public function initialize(): void
{
parent::initialize();

// Add custom holidays.
$this->calculateStRupertsDay();
}

/**
* Saint Rupert's Day.
*
* Rupert of Salzburg was Bishop of Worms as well as the first Bishop of
* Salzburg and abbot of St. Peter's in Salzburg. He was a contemporary of
* the Frankish king Childebert III and is venerated as a saint in the
* Roman Catholic and Eastern Orthodox Churches. Rupert is also patron
* saint of the Austrian state of Salzburg. His feast day in Austria is
* September 24 (since 710).
*
* @link https://en.wikipedia.org/wiki/Rupert_of_Salzburg
*
* @throws InvalidDateException
* @throws \InvalidArgumentException
* @throws UnknownLocaleException
* @throws \Exception
*/
private function calculateStRupertsDay(): void
{
if ($this->year < 710) {
return;
}

$this->addHoliday(new Holiday(
'stRupertsDay',
[],
new DateTime($this->year . '-9-24', new \DateTimeZone($this->timezone)),
$this->locale
));
}
}
47 changes: 47 additions & 0 deletions src/Yasumi/Provider/Austria/Styria.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php declare(strict_types=1);
/**
* This file is part of the Yasumi package.
*
* Copyright (c) 2015 - 2019 AzuyaLabs
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @author Sacha Telgenhof <me@sachatelgenhof.com>
*/

namespace Yasumi\Provider\Austria;

use Yasumi\Exception\InvalidDateException;
use Yasumi\Exception\UnknownLocaleException;
use Yasumi\Provider\Austria;

/**
* Provider for all holidays in Styria (Austria).
*
* @link https://en.wikipedia.org/wiki/Styria
*/
class Styria extends Austria
{
/**
* Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective
* country or sub-region.
*/
public const ID = 'AT-6';

/**
* Initialize holidays for Styria (Austria).
*
* @throws InvalidDateException
* @throws \InvalidArgumentException
* @throws UnknownLocaleException
* @throws \Exception
*/
public function initialize(): void
{
parent::initialize();

// Add custom Common holidays.
$this->addHoliday($this->stJosephsDay($this->year, $this->timezone, $this->locale));
}
}
47 changes: 47 additions & 0 deletions src/Yasumi/Provider/Austria/Tyrol.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php declare(strict_types=1);
/**
* This file is part of the Yasumi package.
*
* Copyright (c) 2015 - 2019 AzuyaLabs
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @author Sacha Telgenhof <me@sachatelgenhof.com>
*/

namespace Yasumi\Provider\Austria;

use Yasumi\Exception\InvalidDateException;
use Yasumi\Exception\UnknownLocaleException;
use Yasumi\Provider\Austria;

/**
* Provider for all holidays in Tyrol (Austria).
*
* @link https://en.wikipedia.org/wiki/Tyrol_(state)
*/
class Tyrol extends Austria
{
/**
* Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective
* country or sub-region.
*/
public const ID = 'AT-7';

/**
* Initialize holidays for Tyrol (Austria).
*
* @throws InvalidDateException
* @throws \InvalidArgumentException
* @throws UnknownLocaleException
* @throws \Exception
*/
public function initialize(): void
{
parent::initialize();

// Add custom Common holidays.
$this->addHoliday($this->stJosephsDay($this->year, $this->timezone, $this->locale));
}
}
Loading