<commit_before><?php

namespace Fuel\Tasks;

class Tweet {

	public static function run($date = null) {
		date_default_timezone_set('US/Eastern');
		$time = ($date == null) ? time() : strtotime($date);
		$date = getdate($time);
		
		if ($date['year'] == 1969) {
			return \Cli::color("Invalid date.", 'red');
		}

		// Tweet::tweet("test");
		$day_of_week = $date['wday'];
		$month = $date['mon'];
		$day = $date['mday'];
		$today = $date['year'] . '-' . $date['mon'] . '-' . $date['mday'];

		$sql = "SELECT * FROM hours_of_operation
				INNER JOIN venue ON hours_of_operation.venue_id = venue.id
				WHERE day_of_week = $day_of_week
				AND (DAY(valid_from) <= $day AND MONTH(valid_from) <= $month)
				AND (DAY(valid_to) >= $day AND MONTH(valid_to) >= $month)";

		$result = \DB::query($sql)->execute();

		foreach ($result as $row) {
			
			if (isset($row['open_message'])) {
				$default_open_message = $row['open_message'];
			} else {
				$default_open_message = $row['name'] . " is open for the day!";
			}

			if (isset($row['website'])) {
				$default_open_message .= ' ' . $row['website'];
			}

			if (isset($row['close_message'])) {
				$default_closed_message = $row['close_message'];
			} else {
				$default_closed_message = $row['name'] . " is now closed for the day :(";
			}

			// Check if venue is open
			if (isset($row['open_time'])) {

				$opentime = strtotime($today . ' ' . $row['open_time']);
				if ($time > $opentime && $time < strtotime('+10 minutes', $opentime)) {
					if (isset($row['latitude']) && isset($row['longitude'])) {
						Tweet::tweet($default_open_message, $row['latitude'], $row['longitude']);
					} else {
						Tweet::tweet($default_open_message);
					}
				}
			}
<commit_msg>Clean up.<commit_after><?php

namespace Fuel\Tasks;

class Tweet {

	public static function run($date = null) {
		date_default_timezone_set('US/Eastern');
		$time = ($date == null) ? time() : strtotime($date);
		$date = getdate($time);
		
		if ($date['year'] == 1969) {
			return \Cli::color("Invalid date.", 'red');
		}

		$day_of_week = $date['wday'];
		$month = $date['mon'];
		$day = $date['mday'];
		$today = $date['year'] . '-' . $date['mon'] . '-' . $date['mday'];

		$sql = "SELECT * FROM hours_of_operation
				INNER JOIN venue ON hours_of_operation.venue_id = venue.id
				WHERE day_of_week = $day_of_week
				AND (DAY(valid_from) <= $day AND MONTH(valid_from) <= $month)
				AND (DAY(valid_to) >= $day AND MONTH(valid_to) >= $month)";

		$result = \DB::query($sql)->execute();

		foreach ($result as $row) {

			if (isset($row['open_message'])) {
				$default_open_message = $row['open_message'];
			} else {
				$default_open_message = $row['name'] . " is open for the day!";
			}

			if (isset($row['website'])) {
				$default_open_message .= ' ' . $row['website'];
			}

			if (isset($row['close_message'])) {
				$default_closed_message = $row['close_message'];
			} else {
				$default_closed_message = $row['name'] . " is now closed for the day :(";
			}

			// Check if venue is open
			if (isset($row['open_time'])) {

				$opentime = strtotime($today . ' ' . $row['open_time']);
				if ($time > $opentime && $time < strtotime('+10 minutes', $opentime)) {
					if (isset($row['latitude']) && isset($row['longitude'])) {
						Tweet::tweet($default_open_message, $row['latitude'], $row['longitude']);
					} else {
						Tweet::tweet($default_open_message);
					}
				}
			}

{'fraction_non_alphanumeric': 0.2074810052600818, 'fraction_numerical': 0.0035067212156633548, 'mean_word_length': 3.6132075471698113, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '2453026', 'n_tokens_mistral': 1453, 'n_tokens_neox': 1213, 'n_words': 242}