<commit_before><?php
	/**
	* Todo Manager
	* 
	* @author		<NAME>, <EMAIL>
	* @link			janpecha.iunas.cz
	* @copyright	(c) 2011 <NAME>
	* @version		2.0.0.1a
	* @todo			[DEL]	01.05.2011 - ?? pro datum a cas misto nazvu souboru pouzit jeho ctime ??
	*/
	
	class TodoModel
	{
		private static $dir = './cztodo/todos';
		private static $protocol = '';
		//private static $dateTimeFormat = 'j.n.Y - H:i:s';
		const DATE_TIME_FORMAT = 'YmdHis';
		
		
		
		public static function setDir($directory)
		{
			self::$dir = (string)$directory;
		}
		
		
		
		/*public function setDateTimeFormat($format = 'j.n.Y - H:i:s')
		{
			self::$dateTimeFormat = (string)$format;
		}*/
		
		
		
		public static function setProtocol($protocol = '')
		{
			self::$protocol = (string)$protocol;
		}
		
		
		
		public function addTodo($todoText)
		{
			$fileName = date(self::DATE_TIME_FORMAT).'_u';	// date() => 4+2+2 2+2+2 = 14 + 2 = 16
			file_put_contents(self::$dir . "/$fileName", (string)$todoText);
		}
		
		
		
		public function getAll()
		{
			$todos = array();
			$dir = opendir(self::$dir);
			
			while($t = readdir($dir))
			{
				if($t == '.' || $t == '..'){
					continue;
				}
				
				$id = substr($t, 0, -2);
				
				$todos[$id] = array(
					'id'	=> $id,
					'datetime' => DateTime::createFromFormat(self::DATE_TIME_FORMAT, $id),
					'text' 	=> file_get_contents(self::$protocol . self::$dir . "/$t"),
					'state'	=> substr($t, -1)
				);
			}
			
			closedir($dir);
			
			krsort($todos);
			
			return $todos;
		}<commit_msg>TodoModel ignores "hidden" files (file name starts with dot)<commit_after><?php
	/**
	* Todo Manager
	* 
	* @author		<NAME>, <EMAIL>
	* @link			janpecha.iunas.cz
	* @copyright	(c) 2011 <NAME>
	* @version		2.0.0.1a
	* @todo			[DEL]	01.05.2011 - ?? pro datum a cas misto nazvu souboru pouzit jeho ctime ??
	*/
	
	class TodoModel
	{
		private static $dir = './cztodo/todos';
		private static $protocol = '';
		//private static $dateTimeFormat = 'j.n.Y - H:i:s';
		const DATE_TIME_FORMAT = 'YmdHis';
		
		
		
		public static function setDir($directory)
		{
			self::$dir = (string)$directory;
		}
		
		
		
		/*public function setDateTimeFormat($format = 'j.n.Y - H:i:s')
		{
			self::$dateTimeFormat = (string)$format;
		}*/
		
		
		
		public static function setProtocol($protocol = '')
		{
			self::$protocol = (string)$protocol;
		}
		
		
		
		public function addTodo($todoText)
		{
			$fileName = date(self::DATE_TIME_FORMAT).'_u';	// date() => 4+2+2 2+2+2 = 14 + 2 = 16
			file_put_contents(self::$dir . "/$fileName", (string)$todoText);
		}
		
		
		
		public function getAll()
		{
			$todos = array();
			$dir = opendir(self::$dir);
			
			while($t = readdir($dir))
			{
				if($t == '.' || $t == '..'){
					continue;
				}
				
				if(isset($t[0]) && $t[0] === '.')	// .htaccess file, etc.
				{
					continue;
				}
				
				$id = substr($t, 0, -2);
				
				$todos[$id] = array(
					'id'	=> $id,
					'datetime' => DateTime::createFromFormat(self::DATE_TIME_FORMAT, $id),
					'text' 	=> file_get_contents(self::$protocol . self::$dir . "/$t"),
					'state'	=> substr($t, -1)
				);
			}
			
			closedir($dir);
			
			krsort($todos);
			
			return $todos;
		}
{'fraction_non_alphanumeric': 0.1925368454060834, 'fraction_numerical': 0.019441831295076827, 'mean_word_length': 2.568232662192394, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 19, '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': '2446374', 'n_tokens_mistral': 1568, 'n_tokens_neox': 1254, 'n_words': 236}