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

FlushallCommand   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

2 Methods

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