<commit_before><?php

Validator::extend('zh_mobile', function ($attribute, $value) {
    return preg_match('/^(\+?0?86\-?)?((13\d|14[57]|15[^4,\D]|17[678]|18\d)\d{8}|170[059]\d{7})$/', $value);
});

Validator::extend('confirm_mobile_not_change', function ($attribute, $value) {
    $state = SmsManager::retrieveState();

    return $state && $state['to'] === $value;
});

Validator::extend('verify_code', function ($attribute, $value) {
    $state = SmsManager::retrieveState();
    $attempt = config('laravel-sms.verifyCode.attemptLimit');
    if ($attempt > 0) {
        $state['attempt'] ++;
        if ($state['attempt'] <= $attempt) {
            SmsManager::updateState($state);
        } else {
            SmsManager::forgetState();
        }
    }

    return $state && $state['deadline'] >= time() && $state['code'] === $value;
});

Validator::extend('confirm_rule', function ($attribute, $value, $parameters) {
    $state = SmsManager::retrieveState();
    $name = null;
    if (array_key_exists(0, $parameters)) {
        $name = $parameters[0];
    } elseif ($path = SmsManager::pathOfUrl(URL::previous())) {
        $name = $path;
    }

    return $state && array_key_exists($attribute, $state['usedRule']) && $state['usedRule'][$attribute] === $name;
});<commit_msg>modify verify method<commit_after><?php

Validator::extend('zh_mobile', function ($attribute, $value) {
    return preg_match('/^(\+?0?86\-?)?((13\d|14[57]|15[^4,\D]|17[678]|18\d)\d{8}|170[059]\d{7})$/', $value);
});

Validator::extend('confirm_mobile_not_change', function ($attribute, $value) {
    $state = SmsManager::retrieveState();

    return $state && $state['to'] === $value;
});

Validator::extend('verify_code', function ($attribute, $value) {
    $state = SmsManager::retrieveState();
    $attempts = config('laravel-sms.verifyCode.attemptLimit');
    $attempt = true;
    if ($attempts > 0) {
        $state['attempts'] ++;
        if ($state['attempts'] <= $attempts) {
            SmsManager::updateState($state);
        } else {
            $attempt = false;
        }
    }

    return $state && $state['deadline'] >= time() && $state['code'] === $value && $attempt;
});

Validator::extend('confirm_rule', function ($attribute, $value, $parameters) {
    $state = SmsManager::retrieveState();
    $name = null;
    if (array_key_exists(0, $parameters)) {
        $name = $parameters[0];
    } elseif ($path = SmsManager::pathOfUrl(URL::previous())) {
        $name = $path;
    }

    return $state && array_key_exists($attribute, $state['usedRule']) && $state['usedRule'][$attribute] === $name;
});
{'fraction_non_alphanumeric': 0.22076923076923077, 'fraction_numerical': 0.023076923076923078, 'mean_word_length': 4.021235521235521, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '4108307', 'n_tokens_mistral': 897, 'n_tokens_neox': 849, 'n_words': 140}