Completed
Push — master ( 126598...f22255 )
by ARCANEDEV
09:12 queued 07:35
created

ClearCommand::handle()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 0
dl 0
loc 7
ccs 5
cts 5
cp 1
crap 2
rs 10
c 0
b 0
f 0
1
<?php namespace Arcanedev\LogViewer\Commands;
2
3
/**
4
 * Class     ClearCommand
5
 *
6
 * @package  Arcanedev\LogViewer\Commands
7
 * @author   ARCANEDEV <[email protected]>
8
 */
9
class ClearCommand extends Command
10
{
11
    /* -----------------------------------------------------------------
12
     |  Properties
13
     | -----------------------------------------------------------------
14
     */
15
16
    /**
17
     * The name and signature of the console command.
18
     *
19
     * @var string
20
     */
21
    protected $signature = 'log-viewer:clear';
22
23
    /**
24
     * The console command description.
25
     *
26
     * @var string
27
     */
28
    protected $description = 'Clear all generated log files';
29
30
    /* -----------------------------------------------------------------
31
     |  Main Methods
32
     | -----------------------------------------------------------------
33
     */
34
35
    /**
36
     * Execute the console command.
37
     */
38 3
    public function handle()
39
    {
40 3
        if ($this->confirm('This will delete all the log files, Do you wish to continue?')) {
41 3
            $this->logViewer->clear();
42 3
            $this->info('Successfully cleared the logs!');
43
        }
44 3
    }
45
}
46