Completed
Pull Request — master (#16)
by Miguel
02:52
created

CleanupCommand   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 2
c 2
b 0
f 0
lcom 0
cbo 1
dl 0
loc 38
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A handle() 0 6 1
1
<?php
2
3
namespace Clarkeash\Doorman\Commands;
4
5
use Illuminate\Console\Command;
6
use Clarkeash\Doorman\Models\Invite;
7
8
class CleanupCommand extends Command
9
{
10
    /**
11
     * The console command signature.
12
     *
13
     * @var string
14
     */
15
    protected $signature = 'doorman:cleanup';
16
    
17
    /**
18
     * The console command description.
19
     *
20
     * @var string
21
     */
22
    protected $description = 'Remove expired invites from the database.';
23
    
24
    /**
25
     * Create a new command instance.
26
     *
27
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
28
     */
29
    public function __construct()
30
    {
31
        parent::__construct();
32
    }
33
    
34
    /**
35
     * Execute the console command.
36
     *
37
     * @return mixed
38
     */
39
    public function handle()
40
    {
41
        $useless = Invite::useless()->count();
42
        Invite::useless()->delete();
43
        $this->info('Successfully deleted '.$useless.' expired invites from the database.');
44
    }
45
}
46