<commit_before><?php defined('INITIALIZED') OR exit('You cannot access this file directly');

class DB {
	private $sql;
	private $whereVars;
	private $table;

	public static function save ($object) {
		$arrVars = $object->getObjVars();

		// Remove o atributo 'primarykey' da lista
		$arr = $arrVars;
		$arrVars = array();
		foreach($arr as $i => $var){
			if($var != 'primarykey'){
				$arrVars[] = $var;
			}
		}

		// Define o número que deve ser subtraído 
		// da contagem máxima de elementos nas rotinas abaixo
		$varsSub = 1;
		if(in_array('id', $arrVars))
			$varsSub++;

		$table = $object->getTableVar();

		if (self::isNew($object)) {
			$sql = 'INSERT INTO ' . $table . ' (';
			foreach ($arrVars as $i => $var) {
				if($var != 'id' && $var != 'primarykey'){
					$sql .= $var;
					if ($i < (sizeof($arrVars) - $varsSub))
						$sql .= ', ';
				}
			}
			$sql .= ') VALUES (';
			foreach ($arrVars as $i => $var) {
				if($var != 'id' && $var != 'primarykey'){
					$get = 'get' . ucfirst($var);
					$sql .= ':' . $var;
					if ($i < (sizeof($arrVars) - $varsSub))
						$sql .= ', ';
				}
			}
			$sql .= ');';


		} else {
			$sql = 'UPDATE ' . $table . ' SET ';
			foreach ($arrVars as $i => $var) {
				if($var != 'id' && $var != 'primarykey'){
					$get = 'get' . ucfirst($var);
					$sql .= $var . ' = :' . $var;
					if ($i < (sizeof($arrVars) - $varsSub))
						$sql .= ', ';
				}
			}
			$sql .= ' WHERE '.$object->primarykey.' = :'.$object->primarykey.';';
		}

		
		$con = self::connect();
		$stmt = $con->prepare($sql);

		foreach ($arrVars as $var) {
			if ($var != 'id' && $var != 'primarykey') {
				$getFunc = 'get' . ucfirst($var);
				$stmt->bindValue(':'.$var, (string) $object->$getFunc());
			}
		}

		if (!self::isNew($object)) {
			$getFunc = 'get'.ucfirst($object->primarykey);
			$stmt->bindValue(':'.$object->primarykey, (int) $object->$getFunc());
		}

dump($sql);<commit_msg>Correção na classe DB<commit_after><?php defined('INITIALIZED') OR exit('You cannot access this file directly');

class DB {
	private $sql;
	private $whereVars;
	private $table;

	public static function save ($object) {
		$arrVars = $object->getObjVars();

		// Remove o atributo 'primarykey' da lista
		$arr = $arrVars;
		$arrVars = array();
		foreach($arr as $i => $var){
			if($var != 'primarykey'){
				$arrVars[] = $var;
			}
		}

		// Define o número que deve ser subtraído 
		// da contagem máxima de elementos nas rotinas abaixo
		$varsSub = 0;
		if(in_array('id', $arrVars))
			$varsSub++;

		$table = $object->getTableVar();

		if (self::isNew($object)) {
			$sql = 'INSERT INTO ' . $table . ' (';
			foreach ($arrVars as $i => $var) {
				if($var != 'id' && $var != 'primarykey'){
					$sql .= $var;
					if ($i < (sizeof($arrVars) - $varsSub))
						$sql .= ', ';
				}
			}
			$sql .= ') VALUES (';
			foreach ($arrVars as $i => $var) {
				if($var != 'id' && $var != 'primarykey'){
					$get = 'get' . ucfirst($var);
					$sql .= ':' . $var;
					if ($i < (sizeof($arrVars) - $varsSub))
						$sql .= ', ';
				}
			}
			$sql .= ');';


		} else {
			$sql = 'UPDATE ' . $table . ' SET ';
			foreach ($arrVars as $i => $var) {
				if($var != 'id' && $var != 'primarykey'){
					$get = 'get' . ucfirst($var);
					$sql .= $var . ' = :' . $var;
					if ($i < (sizeof($arrVars) - $varsSub))
						$sql .= ', ';
				}
			}
			$sql .= ' WHERE '.$object->primarykey.' = :'.$object->primarykey.';';
		}

		
		$con = self::connect();
		$stmt = $con->prepare($sql);

		foreach ($arrVars as $var) {
			if ($var != 'id' && $var != 'primarykey') {
				$getFunc = 'get' . ucfirst($var);
				$stmt->bindValue(':'.$var, (string) $object->$getFunc());
			}
		}

		if (!self::isNew($object)) {
			$getFunc = 'get'.ucfirst($object->primarykey);
			$stmt->bindValue(':'.$object->primarykey, (int) $object->$getFunc());
		}

{'fraction_non_alphanumeric': 0.23606044815007818, 'fraction_numerical': 0.0005211047420531526, 'mean_word_length': 2.6807286673058486, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 33, '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': '2460836', 'n_tokens_mistral': 1735, 'n_tokens_neox': 1477, 'n_words': 331}