<commit_before><?php
// src/Acme/UserBundle/Entity/User.php

namespace Cobase\UserBundle\Entity;

use Cobase\AppBundle\Entity\Like;
use Cobase\AppBundle\Entity\Post;
use Doctrine\Common\Collections\ArrayCollection;
use FOS\UserBundle\Model\User as BaseUser;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;

/**
 * @ORM\Entity(repositoryClass="Cobase\AppBundle\Repository\UserRepository")
 * @ORM\Table(name="user")
 */
class User extends BaseUser
{
    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

    /**
     * @ORM\Column(type="string", length=255)
     *
     * @Assert\NotBlank(message="Please enter your real name.", groups={"Registration", "Profile"})
     * @Assert\Length(
     *  min="5",
     *  max="255",
     *  minMessage="The name is too short.",
     *  maxMessage="The name is too long.",
     *  groups={"Registration", "Profile"}
     * )
     */
    protected $name;

    /**
     * @ORM\Column(type="string", length=120, nullable=true)
     *
     * @Assert\Length(
     *  max="150",
     *  maxMessage="The gravatar email is too long.", groups={"Registration", "Profile"}
     * )
     */
    protected $gravatar;

    /**
     * @ORM\Column(name="email_visible", type="boolean", nullable=false)
     *
     * @Assert\Type(type="bool", groups={"Profile"})
     */
    protected $emailVisible = false;

    /**
     * @ORM\OneToMany(targetEntity="Cobase\AppBundle\Entity\Group", mappedBy="user")
     */
    protected $groupsFollowed;

    /**
     * @ORM\OneToMany(targetEntity="Cobase\AppBundle\Entity\Subscription", mappedBy="user")
     */
    protected $subscriptions;

    /**
     * @ORM\OneToMany(targetEntity="Cobase\AppBundle\Entity\Post", mappedBy="user")
     */
    protected $posts;

    /**
     * @var ArrayCollection
     *
     * @ORM\OneToMany(targetEntity="Cobase\AppBundle\Entity\Like", mappedBy="user")
     */
    protected $likes = null;

    public function getName()
    {
        return $this->name;
    }

    public function setName($name)
    {
        $this->name = $name;
    }

    public function getGravatar()
    {
        return $this->gravatar;
    }

    public function setGravatar($address)
    {
        $this->gravatar = $address;
    }

    public function getEmailVisible()
    {
        return $this->emailVisible;
    }
<commit_msg>added avatar field for uploaded image and set default value for gravatar (email)<commit_after><?php
// src/Acme/UserBundle/Entity/User.php

namespace Cobase\UserBundle\Entity;

use Cobase\AppBundle\Entity\Like;
use Cobase\AppBundle\Entity\Post;
use Doctrine\Common\Collections\ArrayCollection;
use FOS\UserBundle\Model\User as BaseUser;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;

/**
 * @ORM\Entity(repositoryClass="Cobase\AppBundle\Repository\UserRepository")
 * @ORM\Table(name="user")
 */
class User extends BaseUser
{
    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

    /**
     * @ORM\Column(type="string", length=255)
     *
     * @Assert\NotBlank(message="Please enter your real name.", groups={"Registration", "Profile"})
     * @Assert\Length(
     *  min="5",
     *  max="255",
     *  minMessage="The name is too short.",
     *  maxMessage="The name is too long.",
     *  groups={"Registration", "Profile"}
     * )
     */
    protected $name;

    /**
     * @ORM\Column(type="string", length=120, nullable=true)
     *
     * @Assert\Length(
     *  max="150",
     *  maxMessage="The gravatar email is too long.", groups={"Registration", "Profile"}
     * )
     */
    protected $gravatar;

    /**
     * @ORM\Column(name="avatar", type="string", nullable=true)
     */
    protected $avatar;

    /**
     * @ORM\Column(name="email_visible", type="boolean", nullable=false)
     *
     * @Assert\Type(type="bool", groups={"Profile"})
     */
    protected $emailVisible = false;

    /**
     * @ORM\OneToMany(targetEntity="Cobase\AppBundle\Entity\Group", mappedBy="user")
     */
    protected $groupsFollowed;

    /**
     * @ORM\OneToMany(targetEntity="Cobase\AppBundle\Entity\Subscription", mappedBy="user")
     */
    protected $subscriptions;

    /**
     * @ORM\OneToMany(targetEntity="Cobase\AppBundle\Entity\Post", mappedBy="user")
     */
    protected $posts;

    /**
     * @var ArrayCollection
     *
     * @ORM\OneToMany(targetEntity="Cobase\AppBundle\Entity\Like", mappedBy="user")
     */
    protected $likes = null;

    public function getName()
    {
        return $this->name;
    }

    public function setName($name)
    {
        $this->name = $name;
    }

    public function getGravatar()
    {
        return !empty($this->gravatar) ? $this->gravatar : $this->email;
    }

    public function setGravatar($address)
    {
        $this->gravatar = $address;
    }

    public function hasAvatar()
    {
        return !empty($this->avatar) ? true : false;
    }

    public function getAvatar()
    {
        return $this->avatar;
    }

    public function setAvatar($image)
    {
        $this->avatar = $image;
    }

    public function getEmailVisible()
    {
        return $this->emailVisible;
    }

{'fraction_non_alphanumeric': 0.1561911930748965, 'fraction_numerical': 0.004892736168611215, 'mean_word_length': 2.714185883997205, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 18, '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': '5200871', 'n_tokens_mistral': 1727, 'n_tokens_neox': 1677, 'n_words': 288}