CacheClearCommand::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 3
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 5
rs 9.4285
1
<?php
2
3
namespace Sugarcrm\UpgradeSpec\Command;
4
5
use Sugarcrm\UpgradeSpec\Cache\Cache;
6
use Symfony\Component\Console\Input\InputInterface;
7
use Symfony\Component\Console\Output\OutputInterface;
8
9
class CacheClearCommand extends Command
10
{
11
    /**
12
     * @var Cache
13
     */
14
    private $cache;
15
16
    /**
17
     * CacheCleanCommand constructor.
18
     *
19
     * @param null  $name
20
     * @param Cache $cache
21
     */
22
    public function __construct($name, Cache $cache)
23
    {
24
        parent::__construct($name);
25
26
        $this->cache = $cache;
27
    }
28
29
    /**
30
     * Configure the command.
31
     */
32
    protected function configure()
33
    {
34
        $this->setName('cache:clear')
35
            ->setDescription('Clears uspec cache');
36
    }
37
38
    /**
39
     * Execute the command.
40
     *
41
     * @param InputInterface  $input
42
     * @param OutputInterface $output
43
     *
44
     * @return int
45
     */
46
    protected function execute(InputInterface $input, OutputInterface $output)
47
    {
48
        $output->writeln('<comment>Cleaning application cache ...</comment>');
49
        $this->cache->clear();
50
        $output->writeln('<comment>Done</comment>');
51
52
        return 0;
53
    }
54
}
55