<commit_before><?php
namespace data;
use data\Holidays;

/* 
 * Keep track of sales hours
 * http://www.lovdata.no/all/tl-19890602-027-006.html
 */
final class Hours
{
    private $holidays;
    private $today;
    private $tomorrow;
    private $saturday;
    private $sunday;
    private $today_type;
    private $tomorrow_type;

    public function __construct($date)
    {
        $this->holidays = Holidays::getFromCache(date('Y', $date));
        $this->today = $date;
        $this->tomorrow = strtotime("+1 day", $this->today);
        $this->sunday = date('w', $this->today) == 0;
        $this->saturday = !$this->sunday && date('w', $this->tomorrow) == 0;

        $this->today_type = $this->holidays->getDateType($this->today);
        $this->tomorrow_type = $this->holidays->getDateType($this->tomorrow);
    }

    public function getNextDay()
    {
        return new self($this->tomorrow);
    }

    public static function createFromTimestamp($timestamp)
    {
        $year = date('Y', $timestamp);
        $month = date('m', $timestamp);
        $day = date('d', $timestamp);
        return new self(mktime(0, 0, 0, $month, $day, $year));
    }

    public static function createFromDate($year, $month, $day)
    {
        return new self(mktime(0, 0, 0, $month, $day, $year));
    }

    public function getWineHours()
    {
        if ($this->sunday)
        {
            return null;
        }
        
        if ($this->today_type != Holidays::NOTHING && $this->today_type != Holidays::ELECTION)
        {
            // Sunday or any non-regular day (holidays, "eves", election day, other special days)
            if ($this->today_type != Holidays::NEWYEARS_EVE)
            {
                return null;
            }
        }

        if ($this->isDayBeforeHoliday())
        {<commit_msg>Fixed bug with new years eve<commit_after><?php
namespace data;
use data\Holidays;

/* 
 * Keep track of sales hours
 * http://www.lovdata.no/all/tl-19890602-027-006.html
 */
final class Hours
{
    private $holidays;
    private $today;
    private $tomorrow;
    private $saturday;
    private $sunday;
    private $today_type;
    private $tomorrow_type;

    public function __construct($date)
    {
        $this->holidays = Holidays::getFromCache(date('Y', $date));
        $this->today = $date;
        $this->tomorrow = strtotime("+1 day", $this->today);
        $this->sunday = date('w', $this->today) == 0;
        $this->saturday = !$this->sunday && date('w', $this->tomorrow) == 0;

        $this->today_type = $this->holidays->getDateType($this->today);
        $this->tomorrow_type = $this->holidays->getDateType($this->tomorrow);
    }

    public function getNextDay()
    {
        return new self($this->tomorrow);
    }

    public static function createFromTimestamp($timestamp)
    {
        $year = date('Y', $timestamp);
        $month = date('m', $timestamp);
        $day = date('d', $timestamp);
        return new self(mktime(0, 0, 0, $month, $day, $year));
    }

    public static function createFromDate($year, $month, $day)
    {
        return new self(mktime(0, 0, 0, $month, $day, $year));
    }

    public function getWineHours()
    {
        if ($this->sunday)
        {
            return null;
        }
        
        if ($this->today_type != Holidays::NOTHING && $this->today_type != Holidays::ELECTION)
        {
            // Sunday or any non-regular day (holidays, "eves", election day, other special days)
            if ($this->today_type != Holidays::NEWYEARS_EVE)
            {
                return null;
            }
        }

        if ($this->isDayBeforeHoliday() || $this->today_type == Holidays::NEWYEARS_EVE)
        {
{'fraction_non_alphanumeric': 0.15586169638033495, 'fraction_numerical': 0.01242571582928147, 'mean_word_length': 2.3270440251572326, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 50, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '1402417', 'n_tokens_mistral': 1245, 'n_tokens_neox': 1171, 'n_words': 257}