<commit_before><?php
namespace dash\social\telegram;

class log
{
	public static $logData = [];










	/**
	 * prepare array to save record of log in database
	 * @return function [description]
	 */
	public static function done()
	{
		$myDetail =
		[
			'chatid'        => hook::from(),
			'user_id'       => \dash\user::id(),
			'hook'          => self::json(tg::$hook),
			// 'hookdate'      => self::$logData['hook_date'],
			'hooktext'      => hook::text(),
			'hookmessageid' => hook::message_id(),
			// 'sendmethod'    => '',
			// 'send'          => '',
			// 'senddate'      => '',
			// 'sendtext'      => '',
			// 'sendmesageid'  => '',
			// 'sendkeyboard'  => '',
			// 'response'      => '',
			'responsedate'  => date('Y-m-d H:i:s'),
			'url'           => tg::$api_token,
			// 'step'          => '',
			// 'meta'          => '',
			// 'status'        => '',
		];

		// combine collected and generated array together
		$myDetail = array_merge($myDetail, self::$logData);
		// save log into database
		\dash\db\telegrams::insert($myDetail);
	}









	public static function save($_method = null, $_sendData = null, $_sendDate = null, $_response = null)
	{
		$myDetail =
		[
			// 'chatid'        => '',
			'user_id'       => \dash\user::id(),
			'hook'          => self::json(self::$hook),
			'hookdate'      => self::$hookDate,
			// 'hooktext'      => '',
			// 'hookmessageid' => '',
			'sendmethod'    => $_method,
			'send'          => self::json($_sendData),
			'senddate'      => $_sendDate,
			// 'sendtext'      => '',
			// 'sendmesageid'  => '',
			// 'sendkeyboard'  => '',
			'response'      => self::json($_response),
			'responsedate'  => date('Y-m-d H:i:s'),
			'url'           => self::$api_token,
			// 'step'          => '',
			// 'meta'          => '',
			// 'status'        => '',
		];

		\dash\db\telegrams::insert($myDetail);
	}

	public static function json($_data)
	{
		if(!$_data)
		{
			return null;
		}
		return json_encode($_data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
	}


	public static function saveHook()
	{
		// try to register user if not exist
		\dash\social\telegram\user::handle();

		$myDetail =
		[
			// 'chatid'        => '',
			'user_id'       => \dash\user::id(),
			'hook'          => self::json(self::$hook),
			'hookdate'      => self::$hookDate,
			// 'hooktext'      => '',
			// 'hookmessageid' => '',
			// 'status'        => '',
		];
		\dash\db\telegrams::insert($myDetail);
	}


	/**
	 * save history of messages into session of this user
	 * @param  [type] $_text [description]
	 * @return [type]        [description]
	 */
	private static function saveHistory($_text, $_maxSize = 20)
	{
		if(!isset($_SESSION['tg']['history']))
		{
			$_SESSION['tg']['history'] = [];
		}
		// Prepend text to the beginning of an session array
		array_unshift($_SESSION['tg']['history'], $_text);
		// if count of messages is more than maxSize, remove old one
		if(count($_SESSION['tg']['history']) > $_maxSize)
		{
			// Pop the text off the end of array
			array_pop($_SESSION['tg']['history']);
		}
		// if last commit is repeated
		if(isset($_SESSION['tg']['history'][1]) &&
			$_SESSION['tg']['history'][1] === $_text || empty($_text)
		)
		{
			self::$skipText = true;
			return false;
		}
	}


}
?><commit_msg>remove unused fn<commit_after><?php
namespace dash\social\telegram;

class log
{
	public static $logData = [];










	/**
	 * prepare array to save record of log in database
	 * @return function [description]
	 */
	public static function done()
	{
		$myDetail =
		[
			'chatid'        => hook::from(),
			'user_id'       => \dash\user::id(),
			'hook'          => self::json(tg::$hook),
			// 'hookdate'      => self::$logData['hook_date'],
			'hooktext'      => hook::text(),
			'hookmessageid' => hook::message_id(),
			// 'sendmethod'    => '',
			// 'send'          => '',
			// 'senddate'      => '',
			// 'sendtext'      => '',
			// 'sendmesageid'  => '',
			// 'sendkeyboard'  => '',
			// 'response'      => '',
			'responsedate'  => date('Y-m-d H:i:s'),
			'url'           => tg::$api_token,
			// 'step'          => '',
			// 'meta'          => '',
			// 'status'        => '',
		];

		// combine collected and generated array together
		$myDetail = array_merge($myDetail, self::$logData);
		// save log into database
		\dash\db\telegrams::insert($myDetail);
	}









	public static function save($_method = null, $_sendData = null, $_sendDate = null, $_response = null)
	{
		$myDetail =
		[
			// 'chatid'        => '',
			'user_id'       => \dash\user::id(),
			'hook'          => self::json(self::$hook),
			'hookdate'      => self::$hookDate,
			// 'hooktext'      => '',
			// 'hookmessageid' => '',
			'sendmethod'    => $_method,
			'send'          => self::json($_sendData),
			'senddate'      => $_sendDate,
			// 'sendtext'      => '',
			// 'sendmesageid'  => '',
			// 'sendkeyboard'  => '',
			'response'      => self::json($_response),
			'responsedate'  => date('Y-m-d H:i:s'),
			'url'           => self::$api_token,
			// 'step'          => '',
			// 'meta'          => '',
			// 'status'        => '',
		];

		\dash\db\telegrams::insert($myDetail);
	}

	public static function json($_data)
	{
		if(!$_data)
		{
			return null;
		}
		return json_encode($_data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
	}


	/**
	 * save history of messages into session of this user
	 * @param  [type] $_text [description]
	 * @return [type]        [description]
	 */
	private static function saveHistory($_text, $_maxSize = 20)
	{
		if(!isset($_SESSION['tg']['history']))
		{
			$_SESSION['tg']['history'] = [];
		}
		// Prepend text to the beginning of an session array
		array_unshift($_SESSION['tg']['history'], $_text);
		// if count of messages is more than maxSize, remove old one
		if(count($_SESSION['tg']['history']) > $_maxSize)
		{
			// Pop the text off the end of array
			array_pop($_SESSION['tg']['history']);
		}
		// if last commit is repeated
		if(isset($_SESSION['tg']['history'][1]) &&
			$_SESSION['tg']['history'][1] === $_text || empty($_text)
		)
		{
			self::$skipText = true;
			return false;
		}
	}


}
?>
{'fraction_non_alphanumeric': 0.20936995153473345, 'fraction_numerical': 0.0012924071082390954, 'mean_word_length': 2.399780340472268, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 86, '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': '3800037', 'n_tokens_mistral': 2359, 'n_tokens_neox': 2088, 'n_words': 404}