Completed
Push — master ( ff94ff...f5576b )
by Avtandil
04:05
created

LogClear   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 36
ccs 0
cts 11
cp 0
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 13 3
1
<?php
2
/*
3
 * This file is part of the Laravel Platfourm package.
4
 *
5
 * (c) Avtandil Kikabidze aka LONGMAN <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Longman\Platfourm\Foundation\Console;
12
13
use Illuminate\Filesystem\Filesystem;
14
use Longman\Platfourm\Console\Command;
15
16
class LogClear extends Command
17
{
18
    /**
19
     * The name and signature of the console command.
20
     *
21
     * @var string
22
     */
23
    protected $signature = 'log:clear';
24
25
    /**
26
     * The console command description.
27
     *
28
     * @var string
29
     */
30
    protected $description = 'Clear logs';
31
32
    /**
33
     * Execute the console command.
34
     *
35
     * @return mixed
36
     */
37
    public function handle()
38
    {
39
        $filesystem = app(Filesystem::class);
40
41
        $logFiles = $filesystem->glob(storage_path('logs/*.log'));
42
43
        foreach ($logFiles as $file) {
44
            $status = $filesystem->delete($file);
45
            if ($status) {
46
                $this->info('Successfully deleted: ' . $file);
47
            }
48
        }
49
    }
50
51
}
52