<commit_before><?php
// src/Phil/UserBundle/Entity/User.php
namespace Phil\UserBundle\Entity;

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

use Phil\CMSBundle\Entity\Page;
use Phil\UserBundle\Entity\Role;

/**
 * @ORM\Entity(repositoryClass="Phil\UserBundle\Entity\Repository\UserRepository")
 * @ORM\Table(name="users")
 * @ORM\HasLifecycleCallbacks
 * @UniqueEntity(fields="email", message="Email address already registered. Select a unique email address.")
 * @UniqueEntity(fields="username", message="Username already registered. Select a unique username.")
 */
class User implements AdvancedUserInterface, \Serializable
{
    /**
     * @ORM\Column(type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @ORM\Column(type="string", length=32, unique=true)
     * @Assert\NotBlank(message = "You must enter a username.")
     * @Assert\Length(max = 32)
     * @Assert\Length(min = 3)
     */
    private $username;

    /**
     * @ORM\Column(type="string", length=32)
     * @Assert\NotBlank(message = "You must enter a first name")
     * @Assert\Length(max = 32)
     * @Assert\Length(min = 3)
     */
    private $firstname;

    /**
     * @ORM\Column(type="string", length=32)
     * @Assert\NotBlank(message = "You must enter a last name")
     * @Assert\Length(max = 32)
     * @Assert\Length(min = 3)
     */
    private $lastname;

    /**
     * @ORM\Column(type="date")
     * @Assert\Date()
     */
    private $birthday;

    /**
     * @ORM\Column(type="string", length=64)
     * @Assert\NotBlank(message = "You must enter a password")
     * @Assert\Length(max = 64)
     * @Assert\Length(min = 6)
     */
    private $password;

    /**
     * @ORM\Column(type="string", length=64, unique=true)
     * @Assert\NotBlank(message = "You must enter an email")
     * @Assert\Length(max = 64)
     * @Assert\Email()
     */
    private $email;

    /**
     * @ORM\Column(type="boolean")
     */
    private $emailVerified;

    /**
     * @ORM\Column(type="boolean")
     */
    private $enabled;

    /**
     * @ORM\Column(type="boolean")
     */
    private $expired;
    
    /**
     * @ORM\Column(type="boolean")
     */
    private $locked;

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

    /**
     * @ORM\Column(type="string", length=64, nullable=true)
     */
    private $activationCode;

    /**
     * @ORM\Column(type="datetime", nullable=true)
     */
    private $resetTime;

    /**
     * @ORM\Column(type="string", length=64, nullable=true)
     */
    private $resetCode;

    /**
     * @ORM\Column(type="boolean")
     */
    private $passwordExpired;

    /**
     * @ORM\ManyToMany(targetEntity="Role", inversedBy="users")
     */
    private $roles;

    /**
     * @ORM\OneToMany(targetEntity="Phil\CMSBundle\Entity\Page", mappedBy="owner")
     */
    protected $pages;

    public function __construct()
    {
        $this->roles = new ArrayCollection();
        $this->pages = new ArrayCollection();
        $this->enabled = false;
        $this->expired = false;
        $this->locked = false;
        $this->created = new \DateTime();
        $this->resetTime = null;
        $this->emailVerified = false;
        $this->passwordExpired = false;
    }

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

    /**
     * Set username
     *
     * @param string $username
     * @return User
     */
    public function setUsername($username)
    {
        $this->username = $username;

        return $this;
    }

    /**
     * @inheritDoc
     */
    public function getUsername()
    {
        return $this->username;
    }

    /**
     * Set firstname
     *
     * @param string $firstname
     * @return User
     */
    public function setFirstname($firstname)
    {
        $this->firstname = $firstname;

        return $this;
    }

    /**
     * Get firstname
     *
     * @return string 
     */
    public function getFirstname()
    {
        return $this->firstname;
    }

    /**
     * Set lastname
     *
     * @param string $lastname
     * @return User
     */
    public function setLastname($lastname)
    {
        $this->lastname = $lastname;

        return $this;
    }

    /**
     * Get lastname
     *
     * @return string 
     */
    public function getLastname()
    {
        return $this->lastname;
    }

    /**
     * Set birthday
     *
     * @param \DateTime $birthday
     * @return User
     */
    public function setBirthday($birthday)
    {
        $this->birthday = $birthday;

        return $this;
    }

    /**
     * Get birthday
     *
     * @return \DateTime 
     */
    public function getBirthday()<commit_msg>Phase 2 - minor clean up to user class<commit_after><?php
// src/Phil/UserBundle/Entity/User.php
namespace Phil\UserBundle\Entity;

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

use Phil\CMSBundle\Entity\Page;
use Phil\UserBundle\Entity\Role;

/**
 * @ORM\Entity(repositoryClass="Phil\UserBundle\Entity\Repository\UserRepository")
 * @ORM\Table(name="users")
 * @ORM\HasLifecycleCallbacks
 * @UniqueEntity(fields="email", message="Email address already registered. Select a unique email address.")
 * @UniqueEntity(fields="username", message="Username already registered. Select a unique username.")
 */
class User implements AdvancedUserInterface, \Serializable
{
    /**
     * @ORM\Column(type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @ORM\Column(type="string", length=32, unique=true)
     * @Assert\NotBlank(message = "You must enter a username.")
     * @Assert\Length(max = 32)
     * @Assert\Length(min = 3)
     * @Assert\Regex(pattern="/[^A-Za-z0-9]/", match=false, message="Your username may only contain letters and numbers.")
     */
    private $username;

    /**
     * @ORM\Column(type="string", length=32)
     * @Assert\NotBlank(message = "You must enter a first name")
     * @Assert\Length(max = 32)
     * @Assert\Length(min = 3)
     * @Assert\Regex(pattern="/[^A-Za-z ]/", match=false, message="First name may only contain letters.")
     */
    private $firstname;

    /**
     * @ORM\Column(type="string", length=32)
     * @Assert\NotBlank(message = "You must enter a last name")
     * @Assert\Length(max = 32)
     * @Assert\Length(min = 3)
     * @Assert\Regex(pattern="/[^A-Za-z ]/", match=false, message="Last name may only contain letters.")
     */
    private $lastname;

    /**
     * @ORM\Column(type="date")
     * @Assert\Date()
     */
    private $birthday;

    /**
     * @ORM\Column(type="string", length=64)
     * @Assert\NotBlank(message = "You must enter a password")
     * @Assert\Length(max = 64)
     * @Assert\Length(min = 6)
     */
    private $password;

    /**
     * @ORM\Column(type="string", length=64, unique=true)
     * @Assert\NotBlank(message = "You must enter an email")
     * @Assert\Length(max = 64)
     * @Assert\Email()
     */
    private $email;

    /**
     * @ORM\Column(type="boolean")
     */
    private $emailVerified;

    /**
     * @ORM\Column(type="boolean")
     */
    private $enabled;

    /**
     * @ORM\Column(type="boolean")
     */
    private $expired;
    
    /**
     * @ORM\Column(type="boolean")
     */
    private $locked;

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

    /**
     * @ORM\Column(type="string", length=64, nullable=true)
     */
    private $activationCode;

    /**
     * @ORM\Column(type="datetime", nullable=true)
     */
    private $resetTime;

    /**
     * @ORM\Column(type="string", length=64, nullable=true)
     */
    private $resetCode;

    /**
     * @ORM\Column(type="boolean")
     */
    private $passwordExpired;

    /**
     * @ORM\ManyToMany(targetEntity="Role", inversedBy="users")
     */
    private $roles;

    /**
     * @ORM\OneToMany(targetEntity="Phil\CMSBundle\Entity\Page", mappedBy="owner")
     */
    protected $pages;

    public function __construct()
    {
        $this->roles = new ArrayCollection();
        $this->pages = new ArrayCollection();
        $this->enabled = false;
        $this->expired = false;
        $this->locked = false;
        $this->created = new \DateTime();
        $this->resetTime = null;
        $this->emailVerified = false;
        $this->passwordExpired = false;
    }

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

    /**
     * Set username
     *
     * @param string $username
     * @return User
     */
    public function setUsername($username)
    {
        $this->username = trim(strtolower($username);

        return $this;
    }

    /**
     * @inheritDoc
     */
    public function getUsername()
    {
        return $this->username;
    }

    /**
     * Set firstname
     *
     * @param string $firstname
     * @return User
     */
    public function setFirstname($firstname)
    {
        $this->firstname = trim(strtolower($firstname));

        return $this;
    }

    /**
     * Get firstname
     *
     * @return string 
     */
    public function getFirstname()
    {
        return ucwords($this->firstname);
    }

    /**
     * Set lastname
     *
     * @param string $lastname
     * @return User
     */
    public function setLastname($lastname)
    {
        $this->lastname = trim(strtolower($lastname));

        return $this;
    }

    /**
     * Get lastname
     *
     * @return string 
     */
    public function getLastname()
    {
        return ucwords($this->lastname);
    }

    /**
     * Set birthday
     *
     * @param \DateTime $birthday
     * @return User
     */
    public function setBirthday($birthday)
    {
        $this->birthday = $birthday;

        return $this;
    }

    /**
     * Get birthday
     *
     * @return \DateTime 
     */
    public function getBirthday()
{'fraction_non_alphanumeric': 0.1531471207193419, 'fraction_numerical': 0.005643772718576621, 'mean_word_length': 2.210009210930304, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 37, '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': '6595208', 'n_tokens_mistral': 3367, 'n_tokens_neox': 3229, 'n_words': 612}