<commit_before><?php

namespace Clarkeash\Doorman\Models;

use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;

class Invite extends Model
{
    protected $dates = [ 'valid_until' ];
    
    public function __construct(array $attributes = [ ])
    {
        $this->table = config('doorman.invite_table_name');
        parent::__construct($attributes);
    }

    public function hasExpired()
    {
        if (is_null($this->valid_until)) return false;

        return $this->valid_until->isPast();
    }

    public function isFull()
    {
        if ($this->max == 0) return false;

        return $this->uses >= $this->max;
    }

    public function isRestricted()
    {
        return !is_null($this->for);
    }

    public function isRestrictedFor($email)
    {
        return $email == $this->for;
    }

    public function isUseless()
    {
        return $this->hasExpired() || $this->isFull();
    }
<commit_msg>add comments<commit_after><?php

namespace Clarkeash\Doorman\Models;

use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;

class Invite extends Model
{
    protected $dates = [ 'valid_until' ];
    
    public function __construct(array $attributes = [ ])
    {
        $this->table = config('doorman.invite_table_name');
        parent::__construct($attributes);
    }

    /**
     * Has the invite expired.
     *
     * @return bool
     */
    public function hasExpired()
    {
        if (is_null($this->valid_until)) return false;

        return $this->valid_until->isPast();
    }

    /**
     * Is the invite full.
     *
     * @return bool
     */
    public function isFull()
    {
        if ($this->max == 0) return false;

        return $this->uses >= $this->max;
    }

    /**
     * Is the invite restricted to a user.
     *
     * @return bool
     */
    public function isRestricted()
    {
        return !is_null($this->for);
    }


    /**
     * Is the invite restricted for a particular user.
     * 
     * @param string $email
     *
     * @return bool
     */
    public function isRestrictedFor($email)
    {
        return $email == $this->for;
    }

    /**
     * Can the invite be used anymore.
     *
     * @return bool
     */
    public function isUseless()
    {
        return $this->hasExpired() || $this->isFull();
    }

{'fraction_non_alphanumeric': 0.13333333333333333, 'fraction_numerical': 0.0008658008658008658, 'mean_word_length': 2.1061827956989245, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, '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': '7281597', 'n_tokens_mistral': 736, 'n_tokens_neox': 708, 'n_words': 159}