<commit_before><?php
/**
 * Date attribute handling class
 *
 * @package 	Core
 * @author		<NAME> <<EMAIL>>
 * @access		public
 * @link		http://grandcentral.fr
 */
class attrDate extends _attrs
{
	protected $data = '0000-00-00 00:00:00';
	protected $params = array(
		'type' => 'datetime'
	);
/**
 * Set the data into the attribute.
 *
 * @param	mixed	attribute data
 * @access	public
 */
	public function set($data)
	{
		$this->data = (empty($data)) ? '0000-00-00 00:00:00' : $data;
		return $this;
	}
/**
 * Check if the attribute data is empty
 *
 * @return	bool	true if is empty, false otherwise
 * @access	public
 */
	public function is_empty()
	{
		return (empty($this->data) || $this->data == '0000-00-00 00:00:00') ? true : false;
	}
/**
 * Returns date formatted according to given format.
 * Uses php [Datetime::format](http://php.net/manual/en/datetime.format.php) method.
 *
 * @param	string	Format accepted by [date()](http://php.net/manual/en/function.date.php)
 * @return	string	Returns the formatted date string on success or FALSE on failure.
 * @access	public
 */
	public function format($format)
	{
		$date = new DateTime($this->data);
		return $date->format($format);
	}
/**
 * Alter the timestamp of a DateTime object by incrementing or decrementing in a format accepted by strtotime().
 * Uses php [Datetime::modify](http://php.net/manual/en/datetime.modify.php) method
 *
 * @param	string	la variable
 * @return	string	une string
 * @access	public
 */
	public function modify($modif)
	{
		$date = new DateTime($this->data);
		return $date->modify($modif);
	}
/**
 * Get mysql attribute definition<commit_msg>attrDate : new diff method<commit_after><?php
/**
 * Date attribute handling class
 *
 * @package 	Core
 * @author		<NAME> <<EMAIL>>
 * @access		public
 * @link		http://grandcentral.fr
 */
class attrDate extends _attrs
{
	protected $data = '0000-00-00 00:00:00';
	protected $params = array(
		'type' => 'datetime'
	);
/**
 * Set the data into the attribute.
 *
 * @param	mixed	attribute data
 * @access	public
 */
	public function set($data)
	{
		$this->data = (empty($data)) ? '0000-00-00 00:00:00' : $data;
		return $this;
	}
/**
 * Check if the attribute data is empty
 *
 * @return	bool	true if is empty, false otherwise
 * @access	public
 */
	public function is_empty()
	{
		return (empty($this->data) || $this->data == '0000-00-00 00:00:00') ? true : false;
	}
/**
 * Returns date formatted according to given format.
 * Uses php [Datetime::format](http://php.net/manual/en/datetime.format.php) method.
 *
 * @param	string	Format accepted by [date()](http://php.net/manual/en/function.date.php)
 * @return	string	Returns the formatted date string on success or FALSE on failure.
 * @access	public
 */
	public function format($format)
	{
		$date = new DateTime($this->data);
		return $date->format($format);
	}
/**
 * Alter the timestamp of a DateTime object by incrementing or decrementing in a format accepted by strtotime().
 * Uses php [Datetime::modify](http://php.net/manual/en/datetime.modify.php) method
 *
 * @param	string	la variable
 * @return	string	une string
 * @access	public
 */
	public function modify($modif)
	{
		$date = new DateTime($this->data);
		return $date->modify($modif);
	}
/**
 * Calcule la différence entre deux dates en secondes
 *
 * @param	string	la date à comparer
 * @return	string	la différence entre deux dates en secondes
 * @access	public
 */
	public function diff($date)
	{
		$date1 = strtotime($this->data);
		$date2 = strtotime($date);
		$diff = $date1 - $date2;
		return $diff;
	}
/**
 * Get mysql attribute definition
{'fraction_non_alphanumeric': 0.15095913261050875, 'fraction_numerical': 0.024464831804281346, 'mean_word_length': 3.746701846965699, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 26, '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': '2483256', 'n_tokens_mistral': 1284, 'n_tokens_neox': 1193, 'n_words': 357}