FlushallCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

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
/**
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