FlushCommand   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 32
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 6 1
A __construct() 0 6 1
A execute() 0 6 1
1
<?php
2
/**
3
 * This file is part of the InMemoryList package.
4
 *
5
 * (c) Mauro Cassani<https://github.com/mauretto78>
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 InMemoryList\Command;
12
13
use Symfony\Component\Console\Input\InputInterface;
14
use Symfony\Component\Console\Output\OutputInterface;
15
16
class FlushCommand extends BaseCommand
17
{
18
    /**
19
     * FlushCommand constructor.
20
     *
21
     * @param null  $driver
0 ignored issues
show
Documentation Bug introduced by
Are you sure the doc-type for parameter $driver is correct as it would always require null to be passed?
Loading history...
22
     * @param array $parameters
23
     */
24
    public function __construct($driver = null, array $parameters = [])
25
    {
26
        parent::__construct(
27
            'iml_cache_flush',
28
            $driver,
29
            $parameters
30
        );
31
    }
32
33
    protected function configure()
34
    {
35
        $this
36
            ->setName('iml:cache:flush')
37
            ->setDescription('Flush all data stored in cache.')
38
            ->setHelp('This command flushes all data stored in cache.')
39
        ;
40
    }
41
42
    protected function execute(InputInterface $input, OutputInterface $output)
43
    {
44
        $cache = $this->createClient($this->driver, $this->parameters);
45
        $cache->getRepository()->flush();
46
47
        $output->writeln('<fg=red>['.$this->driver.'] Cache was successful flushed.</>');
48
    }
49
}
50