DestroyCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 88.46 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 7 7 1
A execute() 3 5 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php namespace Magestead\Command\VM;
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 DestroyCommand
10
 * @package Magestead\Command\VM
11
 */
12 View Code Duplication
class DestroyCommand extends Command
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
13
{
14
    /**
15
     * @var
16
     */
17
    protected $_projectPath;
18
19
    protected function configure()
20
    {
21
        $this->_projectPath = getcwd();
22
23
        $this->setName("vm:destroy");
24
        $this->setDescription("Destroy your development machine");
25
    }
26
27
    /**
28
     * @param InputInterface $input
29
     * @param OutputInterface $output
30
     * @return ProcessCommand
31
     */
32
    protected function execute(InputInterface $input, OutputInterface $output)
33
    {
34
        $output->writeln('<info>Destroying your development environment</info>');
35
        return new ProcessCommand('vagrant destroy --force', $this->_projectPath, $output);
36
    }
37
}
38