Rule::passes()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 3
ccs 0
cts 3
cp 0
crap 2
rs 10
1
<?php
2
3
/*
4
 * This file is part of the godruoyi/laravel-idcard-validator.
5
 *
6
 * (c) Godruoyi <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled.
9
 */
10
11
namespace Godruoyi\LaravelIdCard;
12
13
use Illuminate\Contracts\Validation\Rule as BaseRule;
14
15
class Rule implements BaseRule
16
{
17
    /**
18
     * Determine if the validation rule passes.
19
     *
20
     * @param string $attribute
21
     * @param mixed  $value
22
     *
23
     * @return bool
24
     */
25
    public function passes($attribute, $value)
26
    {
27
        return IdCard::passes($value);
28
    }
29
30
    /**
31
     * Get the validation error message.
32
     *
33
     * @return string
34
     */
35
    public function message()
36
    {
37
        return '无效的身份证号码';
38
    }
39
}
40