<commit_before><?php

require_once(dirname(__FILE__) . '/is_email.php');
class User
{
	private $email;
	private $forename;
	private $surname;
	private $studentNumber;
	
	function setName($first, $last)
	{
		$this -> forename = $this -> tidy($first);
		$this -> surname = $this -> tidy($last);
	}
	
	function setStudentNumber($number)
	{
		$this -> studentNumber = $this -> tidy($number);
	}
	
	function setEmail($email)
	{
		$this -> email = $email;
	}
	
	function firstName()
	{
		return $this -> forename;
	}
	
	function lastName()
	{
		return $this -> surname;
	}
	
	function email()
	{
		return $this -> email;
	}
	
	function studentNumber()
	{
		return $this -> studentNumber;
	}
	
	function validate()
	{
		$errors = [];
		
		if (!is_numeric($this -> studentNumber) 
			|| strlen($this -> studentNumber) != 9)
		{
			$errors[] = "Student number invalid";
		}
		
		if (strlen($this -> forename) == 0)
		{
			$errors[] = "No first name entered";
		}
		
		if (strlen($this -> surname) == 0)
		{
			$errors[] = "No last name entered";
		}
		
		if (strlen($this -> email) == 0)
		{
			$errors[] = "No email address entered";
		}
		elseif (!is_email($this -> email))
		{
			$errors[] = "Invalid email address entered";
		}
		
		return $errors;
	}
	
	function tidy($string)
	{
		$string = trim($string);
		$string = mb_convert_case($string, MB_CASE_TITLE);
		
		return $string;
	}
}

?>
<commit_msg>Using older array init syntax for 5.3 compatibility<commit_after><?php

require_once(dirname(__FILE__) . '/is_email.php');
class User
{
	private $email;
	private $forename;
	private $surname;
	private $studentNumber;
	
	function setName($first, $last)
	{
		$this -> forename = $this -> tidy($first);
		$this -> surname = $this -> tidy($last);
	}
	
	function setStudentNumber($number)
	{
		$this -> studentNumber = $this -> tidy($number);
	}
	
	function setEmail($email)
	{
		$this -> email = $email;
	}
	
	function firstName()
	{
		return $this -> forename;
	}
	
	function lastName()
	{
		return $this -> surname;
	}
	
	function email()
	{
		return $this -> email;
	}
	
	function studentNumber()
	{
		return $this -> studentNumber;
	}
	
	function validate()
	{
		$errors = array();
		
		if (!is_numeric($this -> studentNumber) 
			|| strlen($this -> studentNumber) != 9)
		{
			$errors[] = "Student number invalid";
		}
		
		if (strlen($this -> forename) == 0)
		{
			$errors[] = "No first name entered";
		}
		
		if (strlen($this -> surname) == 0)
		{
			$errors[] = "No last name entered";
		}
		
		if (strlen($this -> email) == 0)
		{
			$errors[] = "No email address entered";
		}
		elseif (!is_email($this -> email))
		{
			$errors[] = "Invalid email address entered";
		}
		
		return $errors;
	}
	
	function tidy($string)
	{
		$string = trim($string);
		$string = mb_convert_case($string, MB_CASE_TITLE);
		
		return $string;
	}
}

?>

{'fraction_non_alphanumeric': 0.1715392743923917, 'fraction_numerical': 0.003522367030644593, 'mean_word_length': 3.0629470672389125, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 39, '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': '4363679', 'n_tokens_mistral': 1160, 'n_tokens_neox': 990, 'n_words': 236}