<commit_before><?php
namespace App\Entity;

use Symfony\Component\Security\Core\User\AdvancedUserInterface;
use Doctrine\ORM\Mapping AS ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Validator\Mapping\ClassMetadata;
use Doctrine\Common\Collections\ArrayCollection;

/**
 * @ORM\Entity(repositoryClass="UserRepository")
 * @ORM\HasLifecycleCallbacks
 * @ORM\Table(name="user")
 */
class User implements AdvancedUserInterface, \Serializable
{
    /**
     * @ORM\Column(type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @ORM\Column(type="string", length=60, unique=true)
     */
    private $username;

    /**
     * @ORM\Column(type="string", length=32)
     */
    private $salt;

    /**
     * @ORM\Column(type="string", length=255)
     */
    private $password;

    /**
     * @ORM\Column(type="string", length=60, unique=true)
     */
    private $email;

    /**
     * @ORM\Column(type="string", length=60, unique=true)
     */
    private $firstname;
    
    /**
     * @ORM\Column(type="string", length=60, unique=true)
     */
    private $lastname;
    
    /**
     * @ORM\Column(type="string", length=60, unique=true)
     */
    private $phone;
    
    /**
     * @ORM\Column(type="string", length=255, nullable=true)
     */
    private $roles;

    /**
     * @ORM\Column(type="integer", name="level")
     */
    private $experience;

    /**
     * @ORM\Column(type="boolean", name="active")
     */
    private $active;

    /**
     * @ORM\Column(type="datetime")
     */
    protected $created;

    /**
     * @ORM\Column(type="datetime", name="last_login", nullable=true)
     */
    protected $lastLogin;

    /**
     * @ORM\Column(type="integer", name="nb_login")
     */
    protected $nbLogin = 0;
    
    /**
     * @ORM\OneToMany(targetEntity="App\Entity\UserLogin", mappedBy="user")
     * @ORM\OrderBy({"created" = "DESC"})
     */
    protected $logins;

    /**
     * @ORM\ManyToMany(targetEntity="Device",cascade="persist",inversedBy="users")
     * @ORM\JoinTable(name="users_devices")
     */
    protected $devices;
    
    /**
     * @ORM\OneToMany(targetEntity="App\Entity\Rappel", mappedBy="user")
     */
    protected $rappels;
    
    /**
     * @ORM\OneToMany(targetEntity="App\Entity\Information", mappedBy="user")
     */
    protected $informations;
    
    /**
     * Constructor
     */
    public function __construct()
    {
        $this->active = true;
        $this->salt = md5(uniqid(null, true));
        $this->experience = 0;
        $this->logins = new ArrayCollection();
        $this->devices = new ArrayCollection();
        $this->rappels = new ArrayCollection();
        $this->informations = new ArrayCollection();
    }

    /**
     * @param $id
     */
    public function setId($id)
    {
        $this->id = $id;
    }

    /**
     * @return mixed
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * @param $username
     */
    public function setUsername($username)
    {
        $this->username = $username;
    }

    /**
     * @return mixed
     */
    public function getUsername()
    {
        return $this->username;
    }
    
    /**
     * @param $firstname
     */
    public function setFirstname($firstname)
    {
        $this->firstname = $firstname;
    }

    /**
     * @return mixed
     */
    public function getFirstname()
    {
        return $this->firstname;
    }
    
    /**
     * @param $lastname
     */
    public function setLastname($lastname)
    {
        $this->lastname = $lastname;
    }

    /**
     * @return mixed
     */
    public function getLastname()
    {
        return $this->lastname;
    }
    
    /**
     * @param $phone
     */
    public function setPhone($phone)
    {
        $this->phone = $phone;
    }

    /**
     * @return mixed
     */
    public function getPhone()
    {
        return $this->phone;
    }
    
    /**
     * Returns the password used to authenticate the user.
     * @return string The password
     */
    public function getPassword()
    {
        return $this->password;
    }

    /**
     * @param $password
     * @return mixed
     */
    public function setPassword($password)
    {
        return $this->password = $password;
    }

    /**
     * Returns the salt that was originally used to encode the password.
     * @return string The salt
     */
    public function getSalt()
    {
        return $this->salt;
    }

    /**
     * @param array $role
     */
    public function setRole($role)
    {
        $this->roles = $role;
    }
    
    /**
     * @param array $roles
     */
    public function setRoles($roles)
    {
        $this->roles = implode(",", $roles);
    }

    /**
     * Returns the roles granted to the user.
     * @return Role[] The user roles
     */
    public function getRoles()
    {
        $roles = explode(",", $this->roles);
        array_push($roles, 'ROLE_USER');
        return array_unique(array_filter($roles));
    }

    /**
     * @param $active
     */
    public function setActive($active)
    {
        $this->active = $active;
    }

    /**
     * @return bool
     */
    public function getActive()
    {
        return $this->active;
    }

    /**
     * @param $email
     */
    public function setEmail($email)
    {
        $this->email = $email;
    }

    /**
     * @return mixed
     */
    public function getEmail()
    {
        return $this->email;
    }

    /**
     * @param mixed $created
     */
    public function setCreated($created)
    {
        $this->created = $created;
    }

    /**
     * @return mixed
     */
    public function getCreated()
    {
        return $this->created;
    }

    /**
     * @param mixed $lastLogin
     */
    public function setLastLogin($lastLogin)
    {
        $this->lastLogin = $lastLogin;
    }

    /**
     * @return mixed
     */
    public function getLastLogin()
    {
        return $this->lastLogin;
    }

    /**
     * @param mixed $nbLogin
     */
    public function setNbLogin($nbLogin)
    {
        $this->nbLogin = $nbLogin;
    }

    /**
     * @return mixed
     */
    public function getNbLogin()
    {
        return $this->nbLogin;
    }

    /**
     * @param $logins
     */
    public function setLogins($logins)
    {
        $this->logins = $logins;
    }<commit_msg>Ajout d'un champ contacts aux utilisateurs<commit_after><?php
namespace App\Entity;

use Symfony\Component\Security\Core\User\AdvancedUserInterface;
use Doctrine\ORM\Mapping AS ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Validator\Mapping\ClassMetadata;
use Doctrine\Common\Collections\ArrayCollection;

/**
 * @ORM\Entity(repositoryClass="UserRepository")
 * @ORM\HasLifecycleCallbacks
 * @ORM\Table(name="user")
 */
class User implements AdvancedUserInterface, \Serializable
{
    /**
     * @ORM\Column(type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @ORM\Column(type="string", length=60, unique=true)
     */
    private $username;

    /**
     * @ORM\Column(type="string", length=32)
     */
    private $salt;

    /**
     * @ORM\Column(type="string", length=255)
     */
    private $password;

    /**
     * @ORM\Column(type="string", length=60, unique=true)
     */
    private $email;

    /**
     * @ORM\Column(type="string", length=60, unique=true)
     */
    private $firstname;
    
    /**
     * @ORM\Column(type="string", length=60, unique=true)
     */
    private $lastname;
    
    /**
     * @ORM\Column(type="string", length=60, unique=true)
     */
    private $phone;
    
    /**
     * @ORM\Column(type="string", length=255, nullable=true)
     */
    private $roles;

    /**
     * @ORM\Column(type="integer", name="level")
     */
    private $experience;

    /**
     * @ORM\Column(type="boolean", name="active")
     */
    private $active;

    /**
     * @ORM\Column(type="datetime")
     */
    protected $created;

    /**
     * @ORM\Column(type="datetime", name="last_login", nullable=true)
     */
    protected $lastLogin;

    /**
     * @ORM\Column(type="integer", name="nb_login")
     */
    protected $nbLogin = 0;

    /**
     * @ORM\Column(type="text", name="contacts")
     */
    protected $contacts;
    
    /**
     * @ORM\OneToMany(targetEntity="App\Entity\UserLogin", mappedBy="user")
     * @ORM\OrderBy({"created" = "DESC"})
     */
    protected $logins;

    /**
     * @ORM\ManyToMany(targetEntity="Device",cascade="persist",inversedBy="users")
     * @ORM\JoinTable(name="users_devices")
     */
    protected $devices;
    
    /**
     * @ORM\OneToMany(targetEntity="App\Entity\Rappel", mappedBy="user")
     */
    protected $rappels;
    
    /**
     * @ORM\OneToMany(targetEntity="App\Entity\Information", mappedBy="user")
     */
    protected $informations;
    
    /**
     * Constructor
     */
    public function __construct()
    {
        $this->active = true;
        $this->salt = md5(uniqid(null, true));
        $this->experience = 0;
        $this->logins = new ArrayCollection();
        $this->devices = new ArrayCollection();
        $this->rappels = new ArrayCollection();
        $this->informations = new ArrayCollection();
    }

    /**
     * @param $id
     */
    public function setId($id)
    {
        $this->id = $id;
    }

    /**
     * @return mixed
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * @param $username
     */
    public function setUsername($username)
    {
        $this->username = $username;
    }

    /**
     * @return mixed
     */
    public function getUsername()
    {
        return $this->username;
    }
    
    /**
     * @param $firstname
     */
    public function setFirstname($firstname)
    {
        $this->firstname = $firstname;
    }

    /**
     * @return mixed
     */
    public function getFirstname()
    {
        return $this->firstname;
    }
    
    /**
     * @param $lastname
     */
    public function setLastname($lastname)
    {
        $this->lastname = $lastname;
    }

    /**
     * @return mixed
     */
    public function getLastname()
    {
        return $this->lastname;
    }
    
    /**
     * @param $phone
     */
    public function setPhone($phone)
    {
        $this->phone = $phone;
    }

    /**
     * @return mixed
     */
    public function getPhone()
    {
        return $this->phone;
    }
    
    /**
     * Returns the password used to authenticate the user.
     * @return string The password
     */
    public function getPassword()
    {
        return $this->password;
    }

    /**
     * @param $password
     * @return mixed
     */
    public function setPassword($password)
    {
        return $this->password = $password;
    }

    /**
     * Returns the salt that was originally used to encode the password.
     * @return string The salt
     */
    public function getSalt()
    {
        return $this->salt;
    }

    /**
     * @param array $role
     */
    public function setRole($role)
    {
        $this->roles = $role;
    }
    
    /**
     * @param array $roles
     */
    public function setRoles($roles)
    {
        $this->roles = implode(",", $roles);
    }

    /**
     * Returns the roles granted to the user.
     * @return Role[] The user roles
     */
    public function getRoles()
    {
        $roles = explode(",", $this->roles);
        array_push($roles, 'ROLE_USER');
        return array_unique(array_filter($roles));
    }

    /**
     * @param $active
     */
    public function setActive($active)
    {
        $this->active = $active;
    }

    /**
     * @return bool
     */
    public function getActive()
    {
        return $this->active;
    }

    /**
     * @param $email
     */
    public function setEmail($email)
    {
        $this->email = $email;
    }

    /**
     * @return mixed
     */
    public function getEmail()
    {
        return $this->email;
    }

    /**
     * @param mixed $created
     */
    public function setCreated($created)
    {
        $this->created = $created;
    }

    /**
     * @return mixed
     */
    public function getCreated()
    {
        return $this->created;
    }

    /**
     * @param mixed $lastLogin
     */
    public function setLastLogin($lastLogin)
    {
        $this->lastLogin = $lastLogin;
    }

    /**
     * @return mixed
     */
    public function getLastLogin()
    {
        return $this->lastLogin;
    }

    /**
     * @param mixed $nbLogin
     */
    public function setNbLogin($nbLogin)
    {
        $this->nbLogin = $nbLogin;
    }

    /**
     * @return mixed
     */
    public function getNbLogin()
    {
        return $this->nbLogin;
    }

    /**
     * @param string $contact
     */
    public function setContacts($contacts)
    {
        $this->contacts = $contacts;
    }

    /**
     * @return string
     */
    public function getContacts()
    {
        return $this->contacts;
    }

    /**
     * @param $logins
     */
    public function setLogins($logins)
    {
        $this->logins = $logins;
    }
{'fraction_non_alphanumeric': 0.1522941264384995, 'fraction_numerical': 0.0031385443132566134, 'mean_word_length': 1.8688102893890675, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 73, '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': '4976031', 'n_tokens_mistral': 4274, 'n_tokens_neox': 4162, 'n_words': 760}