Completed
Push — master ( 7346cf...68e36d )
by Ryan
18:45 queued 13:05
created

Clear::getArguments()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
1
<?php namespace Anomaly\Streams\Platform\Asset\Console;
2
3
use Anomaly\Streams\Platform\Application\Application;
4
use Illuminate\Console\Command;
5
use Illuminate\Filesystem\Filesystem;
6
use Symfony\Component\Console\Input\InputArgument;
7
8
/**
9
 * Class Clear
10
 *
11
 * @link   http://pyrocms.com/
12
 * @author PyroCMS, Inc. <[email protected]>
13
 * @author Ryan Thompson <[email protected]>
14
 */
15
class Clear extends Command
16
{
17
18
    /**
19
     * The console command name.
20
     *
21
     * @var string
22
     */
23
    protected $name = 'assets:clear';
24
25
    /**
26
     * The console command description.
27
     *
28
     * @var string
29
     */
30
    protected $description = 'Clear compiled public assets.';
31
32
    /**
33
     * Execute the console command.
34
     *
35
     * @param Filesystem  $files
36
     * @param Application $application
37
     */
38
    public function fire(Filesystem $files, Application $application)
39
    {
40
        $directory = 'assets';
41
42
        if ($path = $this->argument('path')) {
43
            $directory .= DIRECTORY_SEPARATOR . str_replace('../', '', $path);
44
        }
45
46
        $files->deleteDirectory($directory = $application->getAssetsPath($directory), true);
47
48
        $this->info($directory . ' has been emptied!');
49
    }
50
51
    /**
52
     * Get the console command arguments.
53
     *
54
     * @return array
55
     */
56
    protected function getArguments()
57
    {
58
        return [
59
            ['path', InputArgument::OPTIONAL, 'The asset path to delete.'],
60
        ];
61
    }
62
}
63