Completed
Pull Request — master (#251)
by ARCANEDEV
11:41
created

ClearCommand::handle()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 0
dl 0
loc 7
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
    public function handle()
39
    {
40
        if ($this->confirm('This will delete all the log files, Do you wish to continue?')) {
41
            $this->logViewer->clear();
42
            $this->info('Successfully cleared the logs!');
43
        }
44
    }
45
}
46