Completed
Push — master ( 9ed21b...9c17df )
by Ashley
01:58
created

CleanupCommand::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Clarkeash\Doorman\Commands;
4
5
use Clarkeash\Doorman\Models\BaseInvite;
6
use Illuminate\Console\Command;
7
8
class CleanupCommand extends Command
9
{
10
    /**
11
     * @var BaseInvite
12
     */
13
    protected $invite;
14
15 57
    public function __construct(BaseInvite $invite)
16
    {
17 57
        parent::__construct();
18 57
        $this->invite = $invite;
19 57
    }
20
21
    /**
22
     * The console command signature.
23
     *
24
     * @var string
25
     */
26
    protected $signature = 'doorman:cleanup';
27
    
28
    /**
29
     * The console command description.
30
     *
31
     * @var string
32
     */
33
    protected $description = 'Remove expired invites from the database.';
34
    
35
    /**
36
     * Execute the console command.
37
     *
38
     * @return mixed
39
     */
40 1
    public function handle()
41
    {
42 1
        $useless = $this->invite->useless()->count();
0 ignored issues
show
Bug introduced by
The method useless() does not exist on Clarkeash\Doorman\Models\BaseInvite. Did you maybe mean isUseless()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
43 1
        $this->invite->useless()->delete();
0 ignored issues
show
Bug introduced by
The method useless() does not exist on Clarkeash\Doorman\Models\BaseInvite. Did you maybe mean isUseless()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
44 1
        $this->info('Successfully deleted ' . $useless . ' expired invites from the database.');
45 1
    }
46
}
47