<commit_before><?php	
	include_once 'PUWI_Command.php';
	$action = $_POST['action'];
	//$action = 'rerun';
	
	function selectRunner($action){
		switch($action)
		{
			case 'rerun':
				$URLParams = $_POST['argv'];
				$URLParams[0] = $URLParams[0]."/PUWI_Command.php";
				$URLParams[1] = $URLParams[1]."/";
				
				$runner = new PUWI_Command;
				$argv=array($URLParams[0],$URLParams[1]);
				//$argv=array("/opt/lampp/htdocs/PUWI/PUWI_Command.php","/home/lucia/Calculadora/");
				$results = $runner->run($argv);
	
				sendData($results);
			break;
			
			case 'runFolder':
				$URLParams = $_POST['argv'];
				$folderName = $_POST['folderName'];
				$URLParams[0] = $URLParams[0]."/PUWI_Command.php";
				$URLParams[1] = $URLParams[1]."/".$folderName;
					
				$runner = new PUWI_Command;
				$argv=array($URLParams[0],$URLParams[1]);
				//$argv=array("/opt/lampp/htdocs/PUWI/PUWI_Command.php","/opt/lampp/htdocs/workspace-eclipse/Calculadora/testsRepes/");
				$results = $runner->run($argv);
				sendData($results);
			break;
			
			case 'runTests':
				$results = runCommand();
				sendData($results);
			break;
			
		}
	}
	/**
	 * Encode data in JSON 
	 * 
	 * @param array $results
	 */
	function sendData($results){
		$array = array('result' => $results);
		//print_r($array);
		echo json_encode($array);
	}
	
	/**
	 * Run group of tests (group, file, class)
	 * 
	 * @return array
	 */
	function runCommand(){
		$elementName = $_POST['name'];
		$type = $_POST['type'];
		$URLParams = $_POST['argv'];
		$URLParams[0] = $URLParams[0]."/PUWI_Command.php";
		$URLParams[1] = $URLParams[1]."/";
		
		$runner = new PUWI_Command;
		$argv=array($URLParams[0],$URLParams[1],$elementName,$type);
		//$argv=array("/opt/lampp/htdocs/PUWI/PUWI_Command.php","/home/lucia/Calculadora/","AddTest","file");
		//$argv=array("/opt/lampp/htdocs/PUWI/PUWI_Command.php","/home/lucia/Calculadora/","grupo1","group");
		//$argv=array("/opt/lampp/htdocs/PUWI/PUWI_Command.php","/home/lucia/Calculadora/","AddTest::test_setUpWorksAdd","test");
		return $runner->run($argv,FALSE);
	}
	
	selectRunner($action);
	
?>
<commit_msg>Add createCommand function<commit_after><?php	
	include_once 'PUWI_Command.php';
	$action = $_POST['action'];
	//$action = 'rerun';
	
	function selectRunner($action){
		switch($action)
		{
			case 'rerun':
				$URLParams = $_POST['argv'];
				$URLParams[0] = $URLParams[0]."/PUWI_Command.php";
				$URLParams[1] = $URLParams[1]."/";
				
				$runner = createCommand();
				$argv=array($URLParams[0],$URLParams[1]);
				//$argv=array("/opt/lampp/htdocs/PUWI/PUWI_Command.php","/home/lucia/Calculadora/");
				$results = $runner->run($argv);
	
				sendData($results);
			break;
			
			case 'runFolder':
				$URLParams = $_POST['argv'];
				$folderName = $_POST['folderName'];
				$URLParams[0] = $URLParams[0]."/PUWI_Command.php";
				$URLParams[1] = $URLParams[1]."/".$folderName;
					
				$runner = createCommand();
				$argv=array($URLParams[0],$URLParams[1]);
				//$argv=array("/opt/lampp/htdocs/PUWI/PUWI_Command.php","/opt/lampp/htdocs/workspace-eclipse/Calculadora/testsRepes/");
				$results = $runner->run($argv);
				sendData($results);
			break;
			
			case 'runTests':
				$results = runCommand();
				sendData($results);
			break;
			
		}
	}
	/**
	 * Encode data in JSON 
	 * 
	 * @param array $results
	 */
	function sendData($results){
		$array = array('result' => $results);
		//print_r($array);
		echo json_encode($array);
	}
	
	/**
	 * Run group of tests (group, file, class)
	 * 
	 * @return array
	 */
	function runCommand(){
		$elementName = $_POST['name'];
		$type = $_POST['type'];
		$URLParams = $_POST['argv'];
		$URLParams[0] = $URLParams[0]."/PUWI_Command.php";
		$URLParams[1] = $URLParams[1]."/";
		
		$runner = createCommand();
		$argv=array($URLParams[0],$URLParams[1],$elementName,$type);
		//$argv=array("/opt/lampp/htdocs/PUWI/PUWI_Command.php","/home/lucia/Calculadora/","AddTest","file");
		//$argv=array("/opt/lampp/htdocs/PUWI/PUWI_Command.php","/home/lucia/Calculadora/","grupo1","group");
		//$argv=array("/opt/lampp/htdocs/PUWI/PUWI_Command.php","/home/lucia/Calculadora/","AddTest::test_setUpWorksAdd","test");
		return $runner->run($argv,FALSE);
	}
	
	/**
	 * Create a PUWI_Command
	 * 
	 * @return PUWI_Command
	 */
	function createCommand(){
		return new PUWI_Command;
	} 
	
	
	selectRunner($action);
	
?>

{'fraction_non_alphanumeric': 0.21310724106324472, 'fraction_numerical': 0.008707607699358386, 'mean_word_length': 3.9322033898305087, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '2833314', 'n_tokens_mistral': 1889, 'n_tokens_neox': 1644, 'n_words': 205}