<commit_before><?php

class Validation {
	
	static $f;
	
	static function init () {
		
		Validation::$f = new stdClass();
		
		Validation::$f->{"bool_Int"} = function ($d) { return $d == 0 || $d == 1; };	
		Validation::$f->{"not_Null"} = function ($d) { return !is_null($d); };	
		Validation::$f->{"unsigned_Int"} = function ($d) { return is_numeric($d) && ($d%1 == 0) && $d >= 0; };	
		Validation::$f->{"Int"} = function ($d) { return is_numeric($d) && ($d%1 == 0); };	
		Validation::$f->{"Number"} = function ($d) { return is_numeric($d); };	
		Validation::$f->{"notEmpty_String"} = function ($d) { return strlen($d) > 0; };	
		Validation::$f->{"Email"} = function ($d) { return filter_var($d, FILTER_VALIDATE_EMAIL); };	
		Validation::$f->{"Timestamp"} = Validation::$f->Int;	
		Validation::$f->{"anterior_Timestamp"} = function ($d) { return $d < time(); };	
		Validation::$f->{"posterior_Timestamp"} = function ($d) { return $d > time(); };	
		
	}
	
	private $validity;
	private $fieldsValidity;
	
	private $fieldExists;
	
	private $die;
	
	public function __construct($source, $requiredFields, $rules=array(), $die=true) {
		
		if(count($rules) == 0)
			$die = false;
		
		$this->die = $die;
		
		$this->validity = true;
		
		$this->fieldsExists = true;
		$this->fieldsValidity = array();
		
		foreach($requiredFields as $k) {
			
			if(isset($source[$k])) {
				if(isset($rules[$k])){<commit_msg>last update : added datetime type<commit_after><?php

class Validation {
	
	static $f;
	
	static function init () {
		
		Validation::$f = new stdClass();
		
		Validation::$f->{"bool_Int"} = function ($d) { return $d == 0 || $d == 1; };	
		Validation::$f->{"not_Null"} = function ($d) { return !is_null($d); };	
		Validation::$f->{"unsigned_Int"} = function ($d) { return is_numeric($d) && ($d%1 == 0) && $d >= 0; };	
		Validation::$f->{"Int"} = function ($d) { return is_numeric($d) && ($d%1 == 0); };	
		Validation::$f->{"Number"} = function ($d) { return is_numeric($d); };	
		Validation::$f->{"notEmpty_String"} = function ($d) { return strlen($d) > 0; };	
		Validation::$f->{"datetime"} = function ($d) { DateTime::createFromFormat('Y-m-d H:i:s', '2009-02-15 15:16:17') != false; };	
		Validation::$f->{"Email"} = function ($d) { return filter_var($d, FILTER_VALIDATE_EMAIL); };	
		Validation::$f->{"Timestamp"} = Validation::$f->Int;	
		Validation::$f->{"anterior_Timestamp"} = function ($d) { return $d < time(); };	
		Validation::$f->{"posterior_Timestamp"} = function ($d) { return $d > time(); };	
		
	}
	
	private $validity;
	private $fieldsValidity;
	
	private $fieldExists;
	
	private $die;
	
	public function __construct($source, $requiredFields, $rules=array(), $die=true) {
		
		if(count($rules) == 0)
			$die = false;
		
		$this->die = $die;
		
		$this->validity = true;
		
		$this->fieldsExists = true;
		$this->fieldsValidity = array();
		
		foreach($requiredFields as $k) {
			
			if(isset($source[$k])) {
				if(isset($rules[$k])){
{'fraction_non_alphanumeric': 0.23188896411645227, 'fraction_numerical': 0.010832769126607989, 'mean_word_length': 4.166083916083916, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 40, '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': '941866', 'n_tokens_mistral': 1149, 'n_tokens_neox': 1019, 'n_words': 215}