CacheClearCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 46
rs 10
wmc 3
lcom 1
cbo 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A configure() 0 5 1
A execute() 0 8 1
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