<commit_before><?php

class cart {
	protected $quantity;
	protected $date;
	protected $date_update;

	public function __construct() {

	}

	public function setQuantity($q = 1) {
		$this->quantity = $q;
	}

	public function setDate($d = null) {
		$this->date = ($d !== null) ? $d : date("Y-m-d H:i:s", time());
	}

	public function setDateUpdate($d = null) {
		$this->date_update = ($d !== null) ? $d : date("Y-m-d H:i:s", time());
	}

	public function add($u, $i, $c = null) {
		global $configuration, $mysqli;

		$query[1] = sprintf("SELECT id FROM %s_cart WHERE user_id = '%s' AND product_id = '%s'", $configuration["mysql-prefix"], $u, $i);
		$source[1] = $mysqli->query($query[1]);

		if ($source[1]->num_rows > 0) {
			return $this->addQuantity($u, $i);
		} else {
			$query[0] = sprintf(
				"INSERT INTO %s_cart (user_id, product_id, quantity, content, date, date_update) VALUES ('%s', '%s', '%s', '%s', '%s', '%s')",
				$configuration["mysql-prefix"], $u, $i, $this->quantity, $c, $this->date, $this->date_update
			);

			return $mysqli->query($query[0]);
		}
	}
<commit_msg>new $vars + new setId + new setUser + new setProduct<commit_after><?php

class cart {
	protected $id;
	protected $product_id;
	protected $quantity;
	protected $user_id;
	protected $date;
	protected $date_update;

	public function __construct() {}

	public function setId($i) {
		$this->id = $i;
	}

	public function setProduct($p) {
		$this->product_id = $p;
	}

	public function setQuantity($q = 1) {
		$this->quantity = $q;
	}

	public function setUser($u) {
		$this->user_id = $u;
	}

	public function setDate($d = null) {
		$this->date = ($d !== null) ? $d : date("Y-m-d H:i:s", time());
	}

	public function setDateUpdate($d = null) {
		$this->date_update = ($d !== null) ? $d : date("Y-m-d H:i:s", time());
	}

	public function add($u, $i, $c = null) {
		global $configuration, $mysqli;

		$query[1] = sprintf("SELECT id FROM %s_cart WHERE user_id = '%s' AND product_id = '%s'", $configuration["mysql-prefix"], $u, $i);
		$source[1] = $mysqli->query($query[1]);

		if ($source[1]->num_rows > 0) {
			return $this->addQuantity($u, $i);
		} else {
			$query[0] = sprintf(
				"INSERT INTO %s_cart (user_id, product_id, quantity, content, date, date_update) VALUES ('%s', '%s', '%s', '%s', '%s', '%s')",
				$configuration["mysql-prefix"], $u, $i, $this->quantity, $c, $this->date, $this->date_update
			);

			return $mysqli->query($query[0]);
		}
	}

{'fraction_non_alphanumeric': 0.2168032786885246, 'fraction_numerical': 0.006557377049180328, 'mean_word_length': 4.074844074844075, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 28, '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': '7445588', 'n_tokens_mistral': 1012, 'n_tokens_neox': 932, 'n_words': 226}