Rule   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 23
ccs 0
cts 7
cp 0
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A message() 0 3 1
A passes() 0 3 1
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