Purge::handle()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Fisharebest\LaravelAssets\Commands;
4
5
use Fisharebest\LaravelAssets\Assets;
6
use Illuminate\Console\Command;
7
use Symfony\Component\Console\Input\InputArgument;
8
9
class Purge extends Command
10
{
11
    /** Required for Laravel 5.0 */
12
    protected $name = 'assets:purge';
13
14
    /**
15
     * The name and signature of the console command.
16
     *
17
     * @var string
18
     */
19
    protected $signature = 'assets:purge {--days=0 : Only delete files older than this number of days}';
20
21
    /**
22
     * The console command description.
23
     *
24
     * @var string
25
     */
26
    protected $description = 'Delete generated CSS and JS files';
27
28
    /**
29
     * An instance of our assets object.
30
     *
31
     * @var Assets $assets
32
     */
33
    private $assets;
34
35
    /**
36
     * Create a command
37
     *
38
     * @param Assets $assets
39
     */
40
    public function __construct(Assets $assets)
41
    {
42
        parent::__construct();
43
44
        $this->assets = $assets;
45
    }
46
47
    /**
48
     * Execute the console command.
49
     */
50
    public function handle()
51
    {
52
        $this->assets->purge($this);
53
    }
54
55
    /**
56
     * Get the console command options.
57
     *
58
     * @return array
59
     */
60
    protected function getOptions()
61
    {
62
        return [
63
            ['days', 'd', InputArgument::OPTIONAL, 'number of days', 0],
64
        ];
65
    }
66
}
67