Completed
Push — feature/add-cli-installers ( 26e1ec...2e79ad )
by Steven
13:48
created

FlushallCommand::execute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
rs 9.4285
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
class FlushallCommand extends Command
9
{
10
    protected $_config;
11
    protected $_projectPath;
12
13
    protected function configure()
14
    {
15
        $this->_projectPath = getcwd();
16
        $this->setName("redis:flush-all");
17
        $this->setDescription("Flush redis storage");
18
    }
19
20
    /**
21
     * @param InputInterface $input
22
     * @param OutputInterface $output
23
     * @return ProcessCommand
24
     */
25
    protected function execute(InputInterface $input, OutputInterface $output)
26
    {
27
        $output->writeln('<info>Flushing Redis Storage</info>');
28
29
        $command = "redis-cli flushall";
30
        $passedCommand = "vagrant ssh -c '". $command ."'";
31
        return new ProcessCommand($passedCommand, $this->_projectPath, $output);
32
    }
33
}
34