<commit_before><?php

namespace Peyote;

/**
 * A class that builds delete statments.
 *
 * @link       http://dev.mysql.com/doc/refman/5.0/en/delete.html
 *
 * @package    Peyote
 * @author     <NAME> <<EMAIL>>
 */
class Delete extends \Peyote\Base
{
	/**
	 * @var \Peyote\Where  The where clause
	 */
	protected $where;

	/**
	 * @var \Peyote\OrderBy  The order by clause
	 */	
	protected $order_by;

	/**
	 * @var \Peyote\Limit  The limit clause
	 */
	protected $limit;

	/**
	 * Create a new Delete instance.
	 *
	 * @param mixed         $table   The table name OR array($table, $alias)
	 * @param \Peyote\Where $where
	 */
	public function __construct($table = "", \Peyote\Where $where = null)
	{
		$this->table($table);
		$this->where = ($where !== null) ? $where : new \Peyote\Where;
		$this->order_by = new \Peyote\OrderBy;
		$this->limit = new \Peyote\Limit;
	}

	/**
	 * Compiles the query into raw SQL
	 *
	 * @return  string
	 */
	public function compile()
	{
		$sql = "DELETE FROM {$this->table()}";

		// Where
		$where = $this->where->compile();
		if ($where !== "")
		{
			$sql .= " ".$where;
		}

		// Order By
		$order = $this->order_by->compile();
		if ($order !== "")
		{
			$sql .= " ".$order;
		}

		// Limit
		$limit = $this->limit->compile();
		if ($limit !== "")
		{
			$sql .= " ".$limit;
		}

		return $sql;
	}

	/**
	 * Get the class properties to use as "traits".
	 *
	 * @return array
	 */
	protected function traits()
	{
		return array("where","order_by","limit");
	}

}
<commit_msg>Refactoring the delete class to use array implosion instead of string contamination.<commit_after><?php

namespace Peyote;

/**
 * A class that builds delete statments.
 *
 * @link       http://dev.mysql.com/doc/refman/5.0/en/delete.html
 *
 * @package    Peyote
 * @author     <NAME> <<EMAIL>>
 */
class Delete extends \Peyote\Base
{
	/**
	 * @var \Peyote\Where  The where clause
	 */
	protected $where;

	/**
	 * @var \Peyote\OrderBy  The order by clause
	 */	
	protected $order_by;

	/**
	 * @var \Peyote\Limit  The limit clause
	 */
	protected $limit;

	/**
	 * Create a new Delete instance.
	 *
	 * @param mixed         $table   The table name OR array($table, $alias)
	 * @param \Peyote\Where $where
	 */
	public function __construct($table = "", \Peyote\Where $where = null)
	{
		$this->table($table);
		$this->where = ($where !== null) ? $where : new \Peyote\Where;
		$this->order_by = new \Peyote\OrderBy;
		$this->limit = new \Peyote\Limit;
	}

	/**
	 * Compiles the query into raw SQL
	 *
	 * @return  string
	 */
	public function compile()
	{
		$sql = array("DELETE FROM");
		$sql[] = $this->table();

		// Where?
		$where = $this->where->compile();
		if ($where !== "")
		{
			$sql[] = $where;
		}

		// Order
		$order = $this->order_by->compile();
		if ($order !== "")
		{
			$sql[] = $order;
		}

		// Limit
		$limit = $this->limit->compile();
		if ($limit !== "")
		{
			$sql[] = $limit;
		}

		return implode(" ", $sql);
	}

	/**
	 * Get the class properties to use as "traits".
	 *
	 * @return array
	 */
	protected function traits()
	{
		return array("where","order_by","limit");
	}

}

{'fraction_non_alphanumeric': 0.18852196216736133, 'fraction_numerical': 0.0012824623276691247, 'mean_word_length': 2.5738831615120277, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 31, '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': '6854710', 'n_tokens_mistral': 1224, 'n_tokens_neox': 1107, 'n_words': 276}