IdentityVerityCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
c 0
b 0
f 0
dl 0
loc 42
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A handle() 0 10 2
A __construct() 0 3 1
1
<?php
2
3
namespace ArcherZdip\Identity\Console;
4
5
use ArcherZdip\Identity\VerityChineseIDNumber;
6
use Illuminate\Console\Command;
7
8
class IdentityVerityCommand extends Command
9
{
10
    /**
11
     * The name and signature of the console command.
12
     *
13
     * @var string
14
     */
15
    protected $signature = 'identity:verity
16
                            {idnumber : Chinese ID number string}';
17
18
    /**
19
     * The console command description.
20
     *
21
     * @var string
22
     */
23
    protected $description = 'Verity Chinese ID number';
24
25
    /**
26
     * Create a new command instance.
27
     *
28
     * @return void
29
     */
30
    public function __construct()
31
    {
32
        parent::__construct();
33
    }
34
35
    /**
36
     * Execute the console command.
37
     *
38
     * @return mixed
39
     */
40
    public function handle()
41
    {
42
        $idnumber = $this->argument('idnumber');
43
44
        $isVerity = VerityChineseIDNumber::isValid($idnumber);
45
46
        if($isVerity) {
47
            $this->info("The {$idnumber} is correct!");
48
        } else {
49
            $this->error("The {$idnumber} is incorrectness!");
50
        }
51
    }
52
}
53