Passed
Push — master ( 1497f5...8a34be )
by Mike
10:00
created

RestoreLocalCommand   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 32
loc 32
ccs 0
cts 19
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 10 10 1
A execute() 9 9 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
2
3
4
namespace Nexus\Dumper\Communication\Command;
5
6
7
use Symfony\Component\Console\Input\InputArgument;
8
use Symfony\Component\Console\Input\InputInterface;
9
use Symfony\Component\Console\Output\OutputInterface;
10
use Xervice\Console\Command\AbstractCommand;
11
12
/**
13
 * @method \Nexus\Dumper\DumperFacade getFacade()
14
 */
15 View Code Duplication
class RestoreLocalCommand extends AbstractCommand
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...
16
{
17
    protected function configure()
18
    {
19
        $this
20
            ->setName('dumper:restore:local')
21
            ->setDescription('Restore one volume')
22
            ->addArgument('volume', InputArgument::REQUIRED, 'The volume to restore')
23
            ->addArgument('path', InputArgument::REQUIRED, 'The path inside the volume to restore')
24
            ->addArgument('version', InputArgument::REQUIRED, 'The version for naming of your restore')
25
            ->addArgument('datapath', InputArgument::OPTIONAL, 'The Datapath for naming of your restore', '/data');
26
    }
27
28
    /**
29
     * @param \Symfony\Component\Console\Input\InputInterface $input
30
     * @param \Symfony\Component\Console\Output\OutputInterface $output
31
     *
32
     * @return int|null|void
33
     * @throws \Core\Locator\Dynamic\ServiceNotParseable
34
     * @throws \Xervice\Config\Exception\ConfigNotFound
35
     */
36
    protected function execute(InputInterface $input, OutputInterface $output)
37
    {
38
        $this->getFacade()->restoreToLocal(
39
            $input->getArgument('volume'),
40
            $input->getArgument('path'),
41
            $input->getArgument('version'),
42
            $input->getArgument('datapath')
43
        );
44
    }
45
46
}