<commit_before><?php
namespace Craft;

class PrestoCommand extends BaseCommand
{
	/**
	 * Initiate the action. Looks for any purges that have been added since the check was last run.
	 */
	public function actionCheck()
	{
		craft()->presto->updateRootPath(
			craft()->plugins->getPlugin('presto')->getSettings()['rootPath']
		);

		$lastUpdated = $this->getUpdateTime();
		$this->writeUpdateTime();

		if (! $lastUpdated) {
			craft()->presto->purgeEntireCache();
		} else {
			$lastUpdated = new DateTime($lastUpdated, new \DateTimeZone(craft()->getTimeZone()));

			$paths = craft()->presto->getPurgeEvents($lastUpdated);

			if (count($paths)) {
				if ($paths[0] === 'all') {
					craft()->presto->purgeEntireCache();
				} else {
					craft()->presto->purgeCache($paths);
				}
			}
		}
	}

	/**
	 * Returns the path to the file holding the last update check
	 *
	 * @return string
	 */
	private function getUpdatePath()
	{
		return craft()->path->runtimePath . 'prestoPurgeEvents.txt';
	}

	/**
	 * Returns the string value for when the check was last run
	 *
	 * @return array|bool|string
	 */
	private function getUpdateTime()
	{
		return IOHelper::getFileContents(
			$this->getUpdatePath()
		);
	}

	/**
	 * Updates last update check to the current time, formatted to be equivalent to
	 * DateTimes stored in the database
	 */
	private function writeUpdateTime()
	{
		IOHelper::writeToFile(
			$this->getUpdatePath(),
			DateTimeHelper::formatTimeForDb()
		);
	}
}<commit_msg>Use service method to get dateTime<commit_after><?php
namespace Craft;

class PrestoCommand extends BaseCommand
{
	/**
	 * Initiate the action. Looks for any purges that have been added since the check was last run.
	 */
	public function actionCheck()
	{
		craft()->presto->updateRootPath(
			craft()->plugins->getPlugin('presto')->getSettings()['rootPath']
		);

		$lastUpdated = $this->getUpdateTime();
		$this->writeUpdateTime();

		if (! $lastUpdated) {
			craft()->presto->purgeEntireCache();
		} else {
			$lastUpdated = craft()->presto->getDateTime($lastUpdated);

			$paths = craft()->presto->getPurgeEvents($lastUpdated);

			if (count($paths)) {
				if ($paths[0] === 'all') {
					craft()->presto->purgeEntireCache();
				} else {
					craft()->presto->purgeCache($paths);
				}
			}
		}
	}

	/**
	 * Returns the path to the file holding the last update check
	 *
	 * @return string
	 */
	private function getUpdatePath()
	{
		return craft()->path->runtimePath . 'prestoPurgeEvents.txt';
	}

	/**
	 * Returns the string value for when the check was last run
	 *
	 * @return array|bool|string
	 */
	private function getUpdateTime()
	{
		return IOHelper::getFileContents(
			$this->getUpdatePath()
		);
	}

	/**
	 * Updates last update check to the current time, formatted to be equivalent to
	 * DateTimes stored in the database
	 */
	private function writeUpdateTime()
	{
		IOHelper::writeToFile(
			$this->getUpdatePath(),
			DateTimeHelper::formatTimeForDb()
		);
	}
}
{'fraction_non_alphanumeric': 0.14824797843665768, 'fraction_numerical': 0.0006738544474393531, 'mean_word_length': 3.705229793977813, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 44, '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': '5550820', 'n_tokens_mistral': 1041, 'n_tokens_neox': 920, 'n_words': 228}