<commit_before><?php

class Validator {
	/*
	 The model to validate
	*/
	protected $model = null;

	/*
	 Is the model valid?
	*/
	public $isValid = true;

	/*
	 The validation errors
	*/
	public $errors = [];

	/*
	 The class constructor
	*/
	public function __construct($model) {
		$this->model = $model;
	}

	/*
	 Checks if a string contains mutations

	 @param string $str
	 @param string $fieldName
	*/
	protected function checkMutation($str, $fieldName) {
		if (preg_match('/ÄÖÜäöüßéàè+/', $str)) {
			$this->errors[] = sprintf('Field "%s" must not contain mutations', $fieldName);
			$this->isValid  = false;
		}
	}


	/*
	 Checks if a string contains whitespaces

	 @param string $str
	 @param string $fieldName
	*/
	protected function checkWhitespace($str, $fieldName) {
		if (preg_match('/\s+/', $str)) {
			$this->errors[] = sprintf('Field "%s" must not contain whitespaces', $fieldName);
			$this->isValid  = false;
		}
	}

	/*
	 Checks if a string contains special chars

	 @param string $str
	 @param string $fieldName
	*/
	protected function checkSpecialChar($str, $fieldName) {
		if (preg_match('/[^A-Za-z0-9ÄÖÜäöüßéàè\s]+/', $str)) {
			$this->errors[] = sprintf('Field "%s" must not contain special chars', $fieldName);
			$this->isValid  = false;
		}
	}

	/*
	 Checks if a string length is between $min and $max

	 @param string $str
	 @param string $fieldName
	 @param int $min
	 @param int $max
	*/
	protected function checkLength($str, $fieldName, $min, $max) {
		if (strlen($str) >= $max || strlen($str) <= $min) {
			$this->errors[] = sprintf('Field "%s" must be between %d and %d chars', $fieldName, $min, $max);
			$this->isValid  = false;
		}
	}
}<commit_msg>Fixed validator<commit_after><?php

class Validator {
	/*
	 The model to validate
	*/
	protected $model = null;

	/*
	 Is the model valid?
	*/
	public $isValid = true;

	/*
	 The validation errors
	*/
	public $errors = [];

	/*
	 The class constructor
	*/
	public function __construct($model) {
		$this->model = $model;
	}

	/*
	 Checks if a string contains mutations

	 @param string $str
	 @param string $fieldName
	*/
	protected function checkMutation($str, $fieldName) {
		if (preg_match('/ÄÖÜäöüßéàè+/', $str)) {
			$this->errors[] = sprintf('Field "%s" must not contain mutations', $fieldName);
			$this->isValid  = false;
		}
	}


	/*
	 Checks if a string contains whitespaces

	 @param string $str
	 @param string $fieldName
	*/
	protected function checkWhitespace($str, $fieldName) {
		if (preg_match('/\s+/', $str)) {
			$this->errors[] = sprintf('Field "%s" must not contain whitespaces', $fieldName);
			$this->isValid  = false;
		}
	}

	/*
	 Checks if a string contains special chars

	 @param string $str
	 @param string $fieldName
	*/
	protected function checkSpecialChar($str, $fieldName) {
		if (preg_match('/[^A-Za-z0-9ÄÖÜäöüßéàè\s]+/', $str)) {
			$this->errors[] = sprintf('Field "%s" must not contain special chars', $fieldName);
			$this->isValid  = false;
		}
	}

	/*
	 Checks if a string length is between $min and $max

	 @param string $str
	 @param string $fieldName
	 @param int $min
	 @param int $max
	*/
	protected function checkLength($str, $fieldName, $min, $max) {
		if (strlen($str) > $max || strlen($str) < $min) {
			$this->errors[] = sprintf('Field "%s" must be between %d and %d chars', $fieldName, $min, $max);
			$this->isValid  = false;
		}
	}
}
{'fraction_non_alphanumeric': 0.16023738872403562, 'fraction_numerical': 0.0011869436201780415, 'mean_word_length': 3.4472295514511875, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 23, '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': '7299080', 'n_tokens_mistral': 1269, 'n_tokens_neox': 1165, 'n_words': 335}