FlushCommand   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 63
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A handle() 0 11 1
A getArguments() 0 4 1
A getOptions() 0 4 1
1
<?php
2
3
namespace Reallyli\AB\Commands;
4
5
use DB;
6
use Config;
7
use Illuminate\Console\Command;
8
9
class FlushCommand extends Command
10
{
11
    /**
12
     * The console command name.
13
     *
14
     * @var string
15
     */
16
    protected $name = 'ab:flush';
17
18
    /**
19
     * The console command description.
20
     *
21
     * @var string
22
     */
23
    protected $description = 'Clear all A/B testing data.';
24
25
    /**
26
     * Create a new command instance.
27
     *
28
     * @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...
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
        $connection = Config::get('ab::connection');
43
44
        DB::connection($connection)->table('experiments')->delete();
45
        DB::connection($connection)->table('goals')->delete();
46
47
        $this->call('ab:install');
48
49
        $this->info('A/B testing data flushed.');
50
    }
51
52
    /**
53
     * Get the console command arguments.
54
     *
55
     * @return array
56
     */
57
    protected function getArguments()
58
    {
59
        return [];
60
    }
61
62
    /**
63
     * Get the console command options.
64
     *
65
     * @return array
66
     */
67
    protected function getOptions()
68
    {
69
        return [];
70
    }
71
}
72