<commit_before><?php 
namespace User\UserBundle\Mapper;

use User\UserBundle\Entity\User;
use Doctrine\ORM\EntityManager;


class UserMapper{

	protected $em;

	public function __construct(EntityManager $em) {
		$this->em = $em;
	}
	/**
	 * Save User to database
	 * @param array of user info
	 */
	
	public function saveUser($data) {
		$user = new User();
		
		//Set user data
		$user->setEmail($data['email']);
		$user->setPassword(hash('sha256', $data['password']))	;
		$user->setLastname($data['lastname']);
		$user->setFirstname($data['firstname']);
		$user->setStat($data['email']);
		$this->em->persist($user);
		$this->em->flush();

		$save = $user->getId();
		if(!$save) {
			throw new exception('Unable to create new user');
		} else {
			return $save;
		}

	}

	/**
	 * Update user to database
	 * @param array of user info
	 */

	public function updateUser($data) {

	}

	/**
	 * Search user bu username and password for login functionalites from database
	 * @param String Usernamen and Password
	 */

	public function searchUserBy($email, $password) {
		 $user = $this->em
        ->getRepository('UserUserBundle:User')
        ->findOneBy(array(
        	'email' => $email,
        	'password' => $password
        ));
  
		return $user;
	}

}<commit_msg>Password hash implemtation<commit_after><?php 
namespace User\UserBundle\Mapper;

use User\UserBundle\Entity\User;
use Doctrine\ORM\EntityManager;


class UserMapper{

	protected $em;

	public function __construct(EntityManager $em) {
		$this->em = $em;
	}
	/**
	 * Save User to database
	 * @param array of user info
	 */
	
	public function saveUser($data) {
		$user = new User();
		
		//Set user data
		$user->setEmail($data['email']);
		$user->setPassword(hash('<PASSWORD>', $data['password']))	;
		$user->setLastname($data['lastname']);
		$user->setFirstname($data['firstname']);
		$user->setStat($data['email']);
		$this->em->persist($user);
		$this->em->flush();

		$save = $user->getId();
		if(!$save) {
			throw new exception('Unable to create new user');
		} else {
			return $save;
		}

	}

	/**
	 * Update user to database
	 * @param array of user info
	 */

	public function updateUser($data) {

	}

	/**
	 * Search user bu username and password for login functionalites from database
	 * @param String Usernamen and Password
	 */

	public function searchUserBy($email, $password) {
		 $user = $this->em
        ->getRepository('UserUserBundle:User')
        ->findOneBy(array(
        	'email' => $email,
        	'password' => <PASSWORD>('<PASSWORD>', $password)
        ));
  
		return $user;
	}

}
{'fraction_non_alphanumeric': 0.16686024003097175, 'fraction_numerical': 0.0011614401858304297, 'mean_word_length': 3.3945578231292517, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 38, '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': '7047005', 'n_tokens_mistral': 913, 'n_tokens_neox': 823, 'n_words': 199}