<commit_before><?php
	namespace xTend
	{
		class File
		{
			//Routing to files
			public static function System($FilePath) {
				$Path = "../System";
				$FileParts = explode(".", $FilePath);
				for($i=0;$i<count($FileParts)-1;$i++) {
					$Path.="/".$FileParts[$i];
				}
				//Add extension
				$Path.=".".$FileParts[count($FileParts)-1];
				//Return path string
				return $Path;
			}
			public static function Web($FilePath) {
				$Path = "";
				$FileParts = explode(".", $FilePath);
				for($i=0;$i<count($FileParts)-1;$i++) {
					if($i!=0) { $Path .= "/"; }
					$Path.=$FileParts[$i];
				}
				//Add extension
				$Path.=".".$FileParts[count($FileParts)-1];
				//Return path string
				return Config::Url."/".$Path;	
			}
			//Check whether a file exists
			public static function Exists($FilePath) {
				return is_file($FilePath);
			}
			//Rename a file
			public static function Rename($Source, $Destination) {
				//Check for file existance
				if(self::Exists($FilePath)) {
					rename($Source, $Destination);
				}
			}
			//Copy a file
			public static function Copy($Source, $Destination) {
				//Check for file existance
				if(self::Exists($FilePath)) {
					copy($Source, $Destination);
				}
			}
			//Move a file (alias for rename)
			public static function Move($Source, $Destination) {
				self::Rename($Source, $Destination);
			}
			//Remove a file
			public static function Remove($FilePath) {
				//Check whether file actually exists
				if(self::Exists($FilePath)) {
					return unlink($FilePath);
				}
				return false;
			}
			//Get the file contents of a file
			public static function Read($FilePath) {
				//Check whether file actually exists
				if(self::Exists($FilePath)) {
					return file_get_contents($FilePath);
				}
				return false;
			}
			//Write to a file (overwrite)
			public static function Write($FilePath, $FileContent) {
				return file_put_contents($FilePath, $FileContent);
			}
			//Append to a file
			public static function Append($FilePath, $FileContent) {
				return file_put_contents($FilePath, $FileContent, FILE_APPEND);
			}
			//set meta data
			public static function SetMeta($File, $Key, $Value) {
				//check file existance
				if(!self::Exists($File)) { return false; }
				//get meta
				$metaFileName = Dir::System("Meta")."/".hash("sha256",$File);
				$meta = array();
				if(self::Exists($metaFileName)) { $meta = json_decode(self::Read($metaFileName),true);  }
				$meta[$Key] = $Value;
				return self::Write($metaFileName, json_encode($meta));
			}
			//get meta data
			public static function GetMeta($File, $Key) {
				if(!self::Exists($File)) { return false; }<commit_msg>Subviews<commit_after><?php
	namespace xTend
	{
		class File
		{
			//Routing to files
			public static function System($FilePath) {
				$Path = "../System";
				$FileParts = explode(".", $FilePath);
				for($i=0;$i<count($FileParts)-1;$i++) {
					$Path.="/".$FileParts[$i];
				}
				//Add extension
				$Path.=".".$FileParts[count($FileParts)-1];
				//Return path string
				return $Path;
			}
			public static function Web($FilePath) {
				$Path = "";
				$FileParts = explode(".", $FilePath);
				for($i=0;$i<count($FileParts)-1;$i++) {
					if($i!=0) { $Path .= "/"; }
					$Path.=$FileParts[$i];
				}
				//Add extension
				$Path.=".".$FileParts[count($FileParts)-1];
				//Return path string
				return Config::Url."/".$Path;	
			}
			//Check whether a file exists
			public static function Exists($FilePath) {
				return is_file($FilePath);
			}
			//Rename a file
			public static function Rename($Source, $Destination) {
				//Check for file existance
				if(self::Exists($FilePath)) {
					rename($Source, $Destination);
				}
			}
			//Copy a file
			public static function Copy($Source, $Destination) {
				//Check for file existance
				if(self::Exists($FilePath)) {
					copy($Source, $Destination);
				}
			}
			//Move a file (alias for rename)
			public static function Move($Source, $Destination) {
				self::Rename($Source, $Destination);
			}
			//Remove a file
			public static function Remove($FilePath) {
				//Check whether file actually exists
				if(self::Exists($FilePath)) {
					return unlink($FilePath);
				}
				return false;
			}
			//Get the file contents of a file
			public static function Read($FilePath) {
				//Check whether file actually exists
				if(self::Exists($FilePath)) {
					return file_get_contents($FilePath);
				}
				return false;
			}
			//Write to a file (overwrite)
			public static function Write($FilePath, $FileContent) {
				//create directories if necessary
				//replace \ with /
				$FilePath = str_replace('\\', '/', $FilePath);
				//fetch directory path
				$DirPath=substr($FilePath, 0, strrpos($FilePath, '/'));
				//create dir if non existent
				if(!Dir::Exists($DirPath)) {
					Dir::Create($DirPath);
				}
				//try to put contents
				return file_put_contents($FilePath, $FileContent);
			}
			//Append to a file
			public static function Append($FilePath, $FileContent) {
				return file_put_contents($FilePath, $FileContent, FILE_APPEND);
			}
			//set meta data
			public static function SetMeta($File, $Key, $Value) {
				//check file existance
				if(!self::Exists($File)) { return false; }
				//get meta
				$metaFileName = Dir::System("Meta")."/".hash("sha256",$File);
				$meta = array();
				if(self::Exists($metaFileName)) { $meta = json_decode(self::Read($metaFileName),true);  }
				$meta[$Key] = $Value;
				return self::Write($metaFileName, json_encode($meta));
			}
			//get meta data
			public static function GetMeta($File, $Key) {
				if(!self::Exists($File)) { return false; }
{'fraction_non_alphanumeric': 0.16542421015264466, 'fraction_numerical': 0.003727369542066028, 'mean_word_length': 3.074475777295734, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, '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': '6168289', 'n_tokens_mistral': 2223, 'n_tokens_neox': 1749, 'n_words': 436}