Bern   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 12
c 1
b 0
f 0
dl 0
loc 31
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A initialize() 0 13 1
1
<?php declare(strict_types=1);
2
/**
3
 * This file is part of the Yasumi package.
4
 *
5
 * Copyright (c) 2015 - 2020 AzuyaLabs
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @author Sacha Telgenhof <[email protected]>
11
 */
12
13
namespace Yasumi\Provider\Switzerland;
14
15
use Yasumi\Exception\InvalidDateException;
16
use Yasumi\Exception\UnknownLocaleException;
17
use Yasumi\Holiday;
18
use Yasumi\Provider\ChristianHolidays;
19
use Yasumi\Provider\Switzerland;
20
21
/**
22
 * Provider for all holidays in Bern (Switzerland).
23
 *
24
 * @link https://en.wikipedia.org/wiki/Canton_of_Bern
25
 * @link https://www.fin.be.ch/fin/fr/index/personal/personalrecht/wdb.thema.212.html
26
 */
27
class Bern extends Switzerland
28
{
29
    use ChristianHolidays;
30
31
    /**
32
     * Code to identify this Holiday Provider. Typically this is the ISO3166 code corresponding to the respective
33
     * country or sub-region.
34
     */
35
    public const ID = 'CH-BE';
36
37
    /**
38
     * Initialize holidays for Bern (Switzerland).
39
     *
40
     * @throws InvalidDateException
41
     * @throws \InvalidArgumentException
42
     * @throws UnknownLocaleException
43
     * @throws \Exception
44
     */
45
    public function initialize(): void
46
    {
47
        parent::initialize();
48
49
        $this->addHoliday($this->goodFriday($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER));
50
        $this->addHoliday($this->stStephensDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER));
51
        $this->addHoliday($this->newYearsDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER));
52
        $this->addHoliday($this->christmasDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER));
53
        $this->addHoliday($this->ascensionDay($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER));
54
        $this->addHoliday($this->easterMonday($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER));
55
        $this->addHoliday($this->pentecostMonday($this->year, $this->timezone, $this->locale, Holiday::TYPE_OTHER));
56
57
        $this->calculateBerchtoldsTag();
58
    }
59
}
60