<commit_before><?php namespace Maatwebsite\Usher\Domain\Users\Activations;

use Maatwebsite\Usher\Contracts\Users\Activiations\ActivatedAt as ActivatedAtInterface;
use Maatwebsite\Usher\Domain\Users\Events\UserGotActivated;
use Maatwebsite\Usher\Contracts\Users\Activiations\ActivationCode;
use Maatwebsite\Usher\Domain\Users\Events\UserGotDeactivated;
use Maatwebsite\Usher\Exceptions\InvalidActiviationCodeException;

trait Activatable
{

    /**
     * @ORM\Embedded(class = "Maatwebsite\Usher\Domain\Users\Activations\ActivatedAt", columnPrefix=false)
     * @var ActivatedAt
     */
    protected $activated_at = null;

    /**
     * @ORM\Embedded(class = "Maatwebsite\Usher\Domain\Users\Activations\ActivationCode", columnPrefix=false)
     * @var ActivationCode
     */
    protected $activation_code;

    /**
     * Ban user
     * @param ActivationCode $code
     * @param bool           $force
     * @return mixed
     */
    public function activate(ActivationCode $code = null, $force = false)
    {
        if (!$this->isActivated() && ($force || $this->checkIfActivationCodeMatches($code))) {
            $this->setActivatedAt(
                new ActivatedAt()
            );

            event(new UserGotActivated($this));
        }
    }

    /**
     * @return bool
     */
    public function isActivated()
    {
        return $this->getActivatedAt() && !is_null($this->getActivatedAt()->getDate())
            ? true
            : false;
    }

    /**
     * Ban user
     * @return mixed
     */
    public function deactivate()
    {
        $this->activated_at = null;

        event(new UserGotDeactivated($this));
    }

    /**
     * @return ActivatedAtInterface
     */
    public function getActivatedAt()
    {
        return $this->activated_at;
    }

    /**
     * @param ActivatedAtInterface $activated_at
     */
    public function setActivatedAt(ActivatedAtInterface $activated_at = null)
    {
        $this->activated_at = $activated_at;
    }

    /**
     * @return ActivationCode
     */
    public function getActivationCode()
    {
        return $this->activation_code;
    }

    /**
     * @param ActivationCode $activation_code
     */
    public function setActivationCode(ActivationCode $activation_code)
    {
        $this->activation_code = $activation_code;
    }

    /**
     * @param ActivationCode $code
     * @return mixed
     */
    protected function checkIfActivationCodeMatches(ActivationCode $code)
    {
        if ($this->getActivationCode()->equals($code)) {
            return true;
        }

        throw new InvalidActiviationCodeException();
    }
}
<commit_msg>Remove activation interfaces for now<commit_after><?php namespace Maatwebsite\Usher\Domain\Users\Activations;

use Maatwebsite\Usher\Domain\Users\Events\UserGotActivated;
use Maatwebsite\Usher\Domain\Users\Events\UserGotDeactivated;
use Maatwebsite\Usher\Exceptions\InvalidActiviationCodeException;

trait Activatable
{

    /**
     * @ORM\Embedded(class = "Maatwebsite\Usher\Domain\Users\Activations\ActivatedAt", columnPrefix=false)
     * @var ActivatedAt
     */
    protected $activated_at = null;

    /**
     * @ORM\Embedded(class = "Maatwebsite\Usher\Domain\Users\Activations\ActivationCode", columnPrefix=false)
     * @var ActivationCode
     */
    protected $activation_code;

    /**
     * Ban user
     * @param ActivationCode $code
     * @param bool           $force
     * @return mixed
     */
    public function activate(ActivationCode $code = null, $force = false)
    {
        if (!$this->isActivated() && ($force || $this->checkIfActivationCodeMatches($code))) {
            $this->setActivatedAt(
                new ActivatedAt()
            );

            event(new UserGotActivated($this));
        }
    }

    /**
     * @return bool
     */
    public function isActivated()
    {
        return $this->getActivatedAt() && !is_null($this->getActivatedAt()->getDate())
            ? true
            : false;
    }

    /**
     * Ban user
     * @return mixed
     */
    public function deactivate()
    {
        $this->activated_at = null;

        event(new UserGotDeactivated($this));
    }

    /**
     * @return ActivatedAt
     */
    public function getActivatedAt()
    {
        return $this->activated_at;
    }

    /**
     * @param ActivatedAt $activated_at
     */
    public function setActivatedAt(ActivatedAt $activated_at = null)
    {
        $this->activated_at = $activated_at;
    }

    /**
     * @return ActivationCode
     */
    public function getActivationCode()
    {
        return $this->activation_code;
    }

    /**
     * @param ActivationCode $activation_code
     */
    public function setActivationCode(ActivationCode $activation_code)
    {
        $this->activation_code = $activation_code;
    }

    /**
     * @param ActivationCode $code
     * @return mixed
     */
    protected function checkIfActivationCodeMatches(ActivationCode $code)
    {
        if ($this->getActivationCode()->equals($code)) {
            return true;
        }

        throw new InvalidActiviationCodeException();
    }
}

{'fraction_non_alphanumeric': 0.11737180736985767, 'fraction_numerical': 0.0, 'mean_word_length': 2.3906146728354263, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 29, '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': '6878745', 'n_tokens_mistral': 1578, 'n_tokens_neox': 1486, 'n_words': 254}