<commit_before><?php

namespace Kwetal\Workdays\Calendar\World\Europe;

use Kwetal\Workdays\Calendar\CalendarBase;
use Kwetal\Workdays\Calendar\CalendarInterface;
use Kwetal\Workdays\Traits\WesternCalendar;
use Kwetal\Workdays\Traits\ChristianCalendar;
use Kwetal\Workdays\Traits\LabourDay;

class Belgium extends CalendarBase implements CalendarInterface
{
    use
        WesternCalendar,
        ChristianCalendar,
        LabourDay;

    public function __construct($year)
    {
        $this->hasEasterSunday = true;
        $this->hasEasterMonday = true;
        $this->hasAscensionThursday = true;
        $this->hasWhitSunday = true;
        $this->hasWhitMonday = true;
        $this->hasAssumption = true;
        $this->hasAllSaints = true;
        $this->hasChristmasSunday = true;
        $this->hasChristmasMonday = true;

        $this->loadHolidays($year);
    }

    public function loadHolidays($year)
    {
        if (in_array($year, $this->yearsLoaded)) {
            return;
        }

        $this->holidays = array_merge(
            $this->holidays,
            $this->getHolidaysChristian($year),
            $this->getHolidaysWestern($year),
            $this->getLocalHolidays($year)
        );

        $this->yearsLoaded[] = $year;
    }

    public function getLocalHolidays($year)
    {
        return array_merge(
            $this->getLabourDay($year),
            $this->getTheOtherLabourDay($year),
            $this->getArmisticeDay($year)
        );
    }

    protected function getTheOtherLabourDay($year)
    {
        return [sprintf('%s-07-21', $year),];
    }

    protected function getArmisticeDay($year)
    {
        return [sprintf('%s-11-11', $year)];
    }
}<commit_msg>Refactored Belgium calendar to use DateTime objects; add doc-comment<commit_after><?php

namespace Kwetal\Workdays\Calendar\World\Europe;

use Kwetal\DateUtils\DateTime\DateTime;
use Kwetal\Workdays\Calendar\CalendarBase;
use Kwetal\Workdays\Calendar\CalendarInterface;
use Kwetal\Workdays\Traits\WesternCalendar;
use Kwetal\Workdays\Traits\ChristianCalendar;
use Kwetal\Workdays\Traits\LabourDay;

class Belgium extends CalendarBase implements CalendarInterface
{
    use
        WesternCalendar,
        ChristianCalendar,
        LabourDay;

    /**
     * Constructor
     *
     * @param int $year
     */
    public function __construct($year)
    {
        $this->hasEasterSunday = true;
        $this->labelEasterSunday = 'Paaszondag';

        $this->hasEasterMonday = true;
        $this->labelEasterMonday = 'Paasmaandag';

        $this->hasAscensionThursday = true;
        $this->labelAscensionThursday = 'Onze Lieve Heer hemelvaart';

        $this->hasWhitSunday = true;
        $this->labelWhitSunday = 'Pinksterzondag';

        $this->hasWhitMonday = true;
        $this->labelWhitMonday = 'Pinkstermaandag';

        $this->hasAssumption = true;
        $this->labelAssumption = 'Onze Lieve Vrouw hemelvaart';

        $this->hasAllSaints = true;
        $this->labelAllSaints = 'Allerheiligen';

        $this->hasChristmasSunday = true;
        $this->labelChristmasSunday = 'Kerstmis';

        $this->labelNewYearsDay = 'Nieuwjaar';

        $this->labelLabourDay = 'Dag van de arbeid';

        $this->loadHolidays($year);
    }

    /**
     * Load all the holidays for the given year
     *
     * @param int $year
     */
    public function loadHolidays($year)
    {
        if (in_array($year, $this->yearsLoaded)) {
            return;
        }

        $this->holidays = array_merge(
            $this->holidays,
            $this->getHolidaysChristian($year),
            $this->getHolidaysWestern($year),
            $this->getLocalHolidays($year)
        );

        $this->yearsLoaded[] = $year;
    }

    /**
     * Returns the local holidays for the given year
     *
     * @param int $year
     * @return array
     */
    public function getLocalHolidays($year)
    {
        return array_merge(
            $this->getLabourDay($year),
            $this->getNationalDay($year),
            $this->getArmisticeDay($year)
        );
    }

    /**
     * Returns the Belgium National Day
     *
     * @param int $year
     * @return array
     */
    protected function getNationalDay($year)
    {
        $day = new DateTime(sprintf('%s-07-21', $year));

        return [$day->addLabel('Nationale feestdag')];
    }

    /**
     * Returns Armistice day
     *
     * @param int $year
     * @return array
     */
    protected function getArmisticeDay($year)
    {
        $day = new DateTime(sprintf('%s-11-11', $year));

        return [$day->addLabel('Wapenstilstand')];
    }
}
{'fraction_non_alphanumeric': 0.12309016569829997, 'fraction_numerical': 0.003443081557994405, 'mean_word_length': 2.3656770456191167, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 54, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5391335', 'n_tokens_mistral': 1530, 'n_tokens_neox': 1404, 'n_words': 250}