FlushallCommand::execute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 2
1
<?php namespace Magestead\Command\Redis;
2
3
use Magestead\Command\ProcessCommand;
4
use Symfony\Component\Console\Command\Command;
5
use Symfony\Component\Console\Input\InputInterface;
6
use Symfony\Component\Console\Output\OutputInterface;
7
8
/**
9
 * Class FlushallCommand
10
 * @package Magestead\Command\Redis
11
 */
12
class FlushallCommand extends Command
13
{
14
    protected $_config;
15
    protected $_projectPath;
16
17
    protected function configure()
18
    {
19
        $this->_projectPath = getcwd();
20
        $this->setName("redis:flush-all");
21
        $this->setDescription("Flush redis storage");
22
    }
23
24
    /**
25
     * @param InputInterface $input
26
     * @param OutputInterface $output
27
     * @return ProcessCommand
28
     */
29
    protected function execute(InputInterface $input, OutputInterface $output)
30
    {
31
        $output->writeln('<info>Flushing Redis Storage</info>');
32
33
        $command  = "redis-cli flushall";
34
        $pCommand = "vagrant ssh -c '". $command ."'";
35
        return new ProcessCommand($pCommand, $this->_projectPath, $output);
36
    }
37
}
38