<commit_before><?php

namespace Cothema\OpeningHours\Model;

use Nette\Utils\DateTime;

/**
 * 
 * @author <NAME> <<EMAIL>>
 */
class OpeningHours extends \Nette\Object {

    /** @var array */
    private $openingHours;

    /** @var array */
    private $specificDays;

    public function __construct() {
        $this->openingHours = [];
        $this->specificDays = [];
    }

    /**
     * 
     * @param DateTime $day
     * @return WeekDay
     */
    public function getDay(DateTime $day) {
        if (isset($this->specificDays[$day->format('Y-m-d')])) {
            return $this->specificDays[$day->format('Y-m-d')];
        }

        return $this->openingHours[(string) $day->format('w')];
    }

    /**
     * 
     * @param string $weekDay
     * @return WeekDay
     */
    public function getWeekDay($weekDay) {
        return $this->openingHours[(string) $weekDay];
    }

    /**
     * 
     * @return WeekDay
     */
    public function getToday() {
        return $this->getDay(new DateTime);
    }

    /**
     * 
     * @param array $openingHours
     */
    public function setOpeningHours(array $openingHours) {
        foreach ($openingHours as $openingHourKey => $openingHour) {
            $weekDay = new WeekDay($openingHourKey);
            $weekDay->setOpenTime($openingHour[0]);
            $weekDay->setCloseTime($openingHour[1]);
            $this->openingHours[(string) $openingHourKey] = $weekDay;
        }
    }

    /**
     * 
     * @param string $day e.g. '2015-12-01'
     * @param array|FALSE $openingHours e.g. ['10:00', '11:00']
     */
    public function addSpecificDay($day, $openingHours) {
        $specificDay = new SpecificDay($day);

        if (is_array($openingHours)) {
            $specificDay->setOpenTime($openingHours[0]);
            $specificDay->setCloseTime($openingHours[1]);
        } elseif ($openingHours === FALSE) {
            // Closed all the day
        } else {
            throw new \Exception('Invalid $openingHours param format.');
        }

        $this->specificDays[$day] = $specificDay;
    }

    /**
     * 
     * @param array $days e.g. ['2015-12-01', '2015-12-02']
     * @param array $openingHours e.g. ['10:00', '11:00']
     */
    public function addSpecificDays(array $days, array $openingHours) {
        foreach ($days as $day) {
            $this->addSpecificDay($day, $openingHours);
        }
    }

    /**
     * 
     * @param string $day e.g. '2015-12-01'
     */
    public function getSpecificDay($day) {
        return isset($this->specificDays[$day]) ? $this->specificDays[$day] : FALSE;
    }

}<commit_msg>hotfix<commit_after><?php

namespace Cothema\OpeningHours\Model;

use Nette\Utils\DateTime;

/**
 * 
 * @author <NAME> <<EMAIL>>
 */
class OpeningHours extends \Nette\Object {

    /** @var array */
    private $openingHours;

    /** @var array */
    private $specificDays;

    public function __construct() {
        $this->openingHours = [];
        $this->specificDays = [];
    }

    /**
     * 
     * @param DateTime $day
     * @return WeekDay
     */
    public function getDay(DateTime $day) {
        if (isset($this->specificDays[$day->format('Y-m-d')])) {
            return $this->specificDays[$day->format('Y-m-d')];
        }

        return $this->openingHours[(string) $day->format('w')];
    }

    /**
     * 
     * @param string $weekDay
     * @return WeekDay
     */
    public function getWeekDay($weekDay) {
        return $this->openingHours[(string) $weekDay];
    }

    /**
     * 
     * @return WeekDay
     */
    public function getToday() {
        return $this->getDay(new DateTime);
    }

    /**
     * 
     * @param array $openingHours
     */
    public function setOpeningHours(array $openingHours) {
        foreach ($openingHours as $openingHourKey => $openingHour) {
            $weekDay = new WeekDay($openingHourKey);
            $weekDay->setOpenTime($openingHour[0]);
            $weekDay->setCloseTime($openingHour[1]);
            $this->openingHours[(string) $openingHourKey] = $weekDay;
        }
    }

    /**
     * 
     * @param string $day e.g. '2015-12-01'
     * @param array|FALSE $openingHours e.g. ['10:00', '11:00']
     */
    public function addSpecificDay($day, $openingHours) {
        $specificDay = new SpecificDay($day);

        if (is_array($openingHours)) {
            $specificDay->setOpenTime($openingHours[0]);
            $specificDay->setCloseTime($openingHours[1]);
        } elseif ($openingHours === FALSE) {
            // Closed all the day
        } else {
            throw new \Exception('Invalid $openingHours param format.');
        }

        $this->specificDays[$day] = $specificDay;
    }

    /**
     * 
     * @param array $days e.g. ['2015-12-01', '2015-12-02']
     * @param array|FALSE $openingHours e.g. ['10:00', '11:00']
     */
    public function addSpecificDays(array $days, $openingHours) {
        foreach ($days as $day) {
            $this->addSpecificDay($day, $openingHours);
        }
    }

    /**
     * 
     * @param string $day e.g. '2015-12-01'
     */
    public function getSpecificDay($day) {
        return isset($this->specificDays[$day]) ? $this->specificDays[$day] : FALSE;
    }

}
{'fraction_non_alphanumeric': 0.16141356255969436, 'fraction_numerical': 0.019866284622731614, 'mean_word_length': 2.1466346153846154, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 49, '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': '3505822', 'n_tokens_mistral': 1817, 'n_tokens_neox': 1649, 'n_words': 307}