<commit_before><?php 

$app->get("/api/configuration/:id/(/:apikey)", function($user_id, $apikey=null) use($app) {
	$result = new Result();
	$result->setCode(FALSE);
	$result->setStatus(CONFLICT);
	$result->setMessage("Invalid Api Key!!");
	if(comprobarApiKey($apikey))
		$result = getUserConfiguration($user_id); // Obtener la configuración de un User
	$app->response->status($result->getStatus());
	$app->response->body(json_encode($result));
});

function getUserConfiguration($user_email) {
	$result = new Result();
	try {
		$connection = getConnection();
		$dbquery = $connection->prepare("SELECT * FROM Configuration WHERE Configuration_userId = ?");
		$dbquery->bindParam(1, $user_email);
		$dbquery->execute();
		$data = $dbquery->fetchObject();
		$connection = null;

		if ($data != null) {
			$result->setCode(TRUE);
			$result->setStatus(OK);
			$result->setData($data);
		}	
		else {
			$result->setCode(FALSE);
			$result->setStatus(NOT_COMPLETED);
			$result->setMessage("Does the Configuration exist?");
		}
	} catch (PDOException $e) {
		$result->setCode(FALSE);
		$result->setStatus(CONFLICT);
		$result->setMessage("Error: " . $e->getMessage());
	}
	return $result;
}

$app->post("/api/configuration", function() use($app) {
	//get params
	$json = $app->request->post('userconf');
	$userconf = json_decode($json);

	$result = postUserConfiguration($userconf->email, $userconf->geosearch, $userconf->geolat, $userconf->geolon, $userconf->sporttype, $userconf->privacitylat, $userconf->privacitylon, $userconf->chatnotifications, $userconf->friendsnotification); // Añadir una Configuración para un Usuario
	$app->response->status($result->getStatus());
	$app->response->body(json_encode($result));
});<commit_msg>Configuración de usuario<commit_after><?php 

$app->get("/api/configuration/:id/(/:apikey)", function($user_id, $apikey=null) use($app) {
	$result = new Result();
	$result->setCode(FALSE);
	$result->setStatus(CONFLICT);
	$result->setMessage("Invalid Api Key!!");
	if(comprobarApiKey($apikey))
		$result = getUserConfiguration($user_id); // Obtener la configuración de un User
	$app->response->status($result->getStatus());
	$app->response->body(json_encode($result));
});

function getUserConfiguration($user_email) {
	$result = new Result();
	try {
		$connection = getConnection();
		$dbquery = $connection->prepare("SELECT * FROM Configuration WHERE Configuration_userId = ?");
		$dbquery->bindParam(1, $user_email);
		$dbquery->execute();
		$data = $dbquery->fetchObject();
		$connection = null;

		if ($data != null) {
			$result->setCode(TRUE);
			$result->setStatus(OK);
			$result->setData($data);
		}	
		else {
			$result->setCode(FALSE);
			$result->setStatus(NOT_COMPLETED);
			$result->setMessage("Does the Configuration exist?");
		}
	} catch (PDOException $e) {
		$result->setCode(FALSE);
		$result->setStatus(CONFLICT);
		$result->setMessage("Error: " . $e->getMessage());
	}
	return $result;
}

$app->post("/api/configuration(/:apikey)", function($apikey=null) use($app) {
	//get params
	$json = $app->request->post('userconf');
	$userconf = json_decode($json);

	if(comprobarApiKey($apikey))
		$result = postUserConfiguration($userconf->email, $userconf->geosearch, $userconf->privacity, $userconf->geolat, $userconf->geolon, $userconf->sporttype, $userconf->privacitylat, $userconf->privacitylon, $userconf->chatnotifications, $userconf->friendsnotification); // Añadir una Configuración para un Usuario
	$app->response->status($result->getStatus());
	$app->response->body(json_encode($result));
});
{'fraction_non_alphanumeric': 0.19599548787366047, 'fraction_numerical': 0.0005640157924421884, 'mean_word_length': 5.968565815324165, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 84, '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': '2984726', 'n_tokens_mistral': 1244, 'n_tokens_neox': 1195, 'n_words': 192}