CheckInvitation   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A handle() 0 11 3
1
<?php
2
3
namespace mathewparet\LaravelInvites\Commands;
4
5
use mathewparet\LaravelInvites\Facades\LaravelInvites;
6
7
use Illuminate\Console\Command;
8
9
use mathewparet\LaravelInvites\Exceptions\LaravelInvitesException;
10
11
class CheckInvitation extends Command
12
{
13
    /**
14
     * The name and signature of the console command.
15
     *
16
     * @var string
17
     */
18
    protected $signature = 'invites:check {code : The invitation code} {email? : Email ID to check against}';
19
20
    /**
21
     * The console command description.
22
     *
23
     * @var string
24
     */
25
    protected $description = 'Check the validity of the given code';
26
27
    /**
28
     * Create a new command instance.
29
     *
30
     * @return void
31
     */
32
    public function __construct()
33
    {
34
        parent::__construct();
35
    }
36
37
    /**
38
     * Execute the console command.
39
     *
40
     * @return mixed
41
     */
42
    public function handle()
43
    {
44
        $email = $this->argument('email') ?: null;
45
        $code = $this->argument('code');
46
47
        try {
48
            LaravelInvites::check($code, $email);
1 ignored issue
show
Bug introduced by
The method check() does not exist on mathewparet\LaravelInvites\Facades\LaravelInvites. Since you implemented __callStatic, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

48
            LaravelInvites::/** @scrutinizer ignore-call */ 
49
                            check($code, $email);
Loading history...
49
            $this->info('This code is valid');
50
        } catch (LaravelInvitesException $e)
51
        {
52
            $this->error($e->getMessage());
53
        }
54
    }
55
}
56