<commit_before><?php

namespace Adldap\Laravel\Validation\Rules;

use Adldap\Laravel\Events\AuthenticatedModelTrashed;

class DenyTrashed extends Rule
{
    /**
     * {@inheritdoc}
     */
    public function isValid()
    {
        if (method_exists($this->model, 'trashed') && $this->model->trashed()) {
            event(new AuthenticatedModelTrashed($this->user, $this->model));

            return false;
        }

        return true;
    }
}<commit_msg>Small refactor<commit_after><?php

namespace Adldap\Laravel\Validation\Rules;

use Illuminate\Support\Facades\Event;
use Adldap\Laravel\Events\AuthenticatedModelTrashed;

class DenyTrashed extends Rule
{
    /**
     * {@inheritdoc}
     */
    public function isValid()
    {
        if ($this->isTrashed()) {
            Event::fire(
                new AuthenticatedModelTrashed($this->user, $this->model)
            );

            return false;
        }

        return true;
    }

    /**
     * Determines if the current model is trashed.
     *
     * @return bool
     */
    protected function isTrashed()
    {
        return method_exists($this->model, 'trashed') && $this->model->trashed();
    }
}
{'fraction_non_alphanumeric': 0.1292517006802721, 'fraction_numerical': 0.0, 'mean_word_length': 2.2969187675070026, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 14, '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': '2121159', 'n_tokens_mistral': 365, 'n_tokens_neox': 356, 'n_words': 66}