FlushCommand::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 6
rs 10
c 0
b 0
f 0
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