<commit_before><?php
namespace HolidayAPI;

class v1
{
    private $cache = false;

    public function __construct($cache = false)
    {
        if ($_SERVER['SERVER_NAME'] != '127.0.0.1') {
            $this->cache = $cache;
        }
    }

    public function getHolidays()
    {
        if (ini_get('date.timezone') == '') {
            date_default_timezone_set('UTC');
        }

        $payload  = ['status' => 200];
        $holidays = [];

        try {
            if ($_SERVER['REQUEST_METHOD'] != 'GET') {
                throw new \Exception('This API only supports GET requests.');
            } elseif (!isset($_GET['country']) || trim($_GET['country']) == '') {
                throw new \Exception('The country parameter is required.');
            } elseif (!isset($_GET['year']) || trim($_GET['year']) == '') {
                throw new \Exception('The year parameter is required.');
            }

            $year     = $_GET['year'];
            $month    = isset($_GET['month'])   ? str_pad($_GET['month'], 2, '0', STR_PAD_LEFT) : '';
            $day      = isset($_GET['day'])     ? str_pad($_GET['day'],   2, '0', STR_PAD_LEFT) : '';
            $country  = isset($_GET['country']) ? strtoupper($_GET['country'])                  : '';
            $date     = $year . '-' . $month . '-' . $day;

            if ($month && $day) {
                if (strtotime($date) === false) {
                    throw new \Exception('The supplied date (' . $date . ') is invalid.');
                }
            }

            if ($this->cache) {
                $cache_key        = 'holidayapi:' . $country . ':holidays:' . $year;
                $country_holidays = $this->cache->get($cache_key);
            } else {
                $country_holidays = false;
            }

            if ($country_holidays) {
                $country_holidays = unserialize($country_holidays);
            } else {
                $country_file = '../data/' . $country . '.json';

                if (!file_exists($country_file)) {
                    throw new \Exception('The supplied country (' . $country . ') is not supported at this time.');
                }<commit_msg>Threw out _GET requirement<commit_after><?php
namespace HolidayAPI;

class v1
{
    private $cache = false;

    public function __construct($cache = false)
    {
        if ($_SERVER['SERVER_NAME'] != '127.0.0.1') {
            $this->cache = $cache;
        }
    }

    public function getHolidays()
    {
        if (ini_get('date.timezone') == '') {
            date_default_timezone_set('UTC');
        }

        $payload  = ['status' => 200];
        $holidays = [];

        try {
            if (!isset($_REQUEST['country']) || trim($_REQUEST['country']) == '') {
                throw new \Exception('The country parameter is required.');
            } elseif (!isset($_REQUEST['year']) || trim($_REQUEST['year']) == '') {
                throw new \Exception('The year parameter is required.');
            }

            $year     = $_REQUEST['year'];
            $month    = isset($_REQUEST['month'])   ? str_pad($_REQUEST['month'], 2, '0', STR_PAD_LEFT) : '';
            $day      = isset($_REQUEST['day'])     ? str_pad($_REQUEST['day'],   2, '0', STR_PAD_LEFT) : '';
            $country  = isset($_REQUEST['country']) ? strtoupper($_REQUEST['country'])                  : '';
            $date     = $year . '-' . $month . '-' . $day;

            if ($month && $day) {
                if (strtotime($date) === false) {
                    throw new \Exception('The supplied date (' . $date . ') is invalid.');
                }
            }

            if ($this->cache) {
                $cache_key        = 'holidayapi:' . $country . ':holidays:' . $year;
                $country_holidays = $this->cache->get($cache_key);
            } else {
                $country_holidays = false;
            }

            if ($country_holidays) {
                $country_holidays = unserialize($country_holidays);
            } else {
                $country_file = '../data/' . $country . '.json';

                if (!file_exists($country_file)) {
                    throw new \Exception('The supplied country (' . $country . ') is not supported at this time.');
                }
{'fraction_non_alphanumeric': 0.16985534297713487, 'fraction_numerical': 0.006532897806812879, 'mean_word_length': 1.6172161172161172, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '1029716', 'n_tokens_mistral': 1210, 'n_tokens_neox': 1175, 'n_words': 250}