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 ClearCommand extends AbstractCommand |
|
|
|
|
16
|
|
|
{ |
17
|
|
|
protected function configure() |
18
|
|
|
{ |
19
|
|
|
$this |
20
|
|
|
->setName('dumper:clear') |
21
|
|
|
->setDescription('Clear one volume') |
22
|
|
|
->addArgument('volume', InputArgument::REQUIRED, 'The volume to dump') |
23
|
|
|
->addArgument('path', InputArgument::OPTIONAL, 'The path inside the volume to dump', '/data') |
24
|
|
|
->addArgument('version', InputArgument::OPTIONAL, 'The version for naming of your restore', 'master'); |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @param \Symfony\Component\Console\Input\InputInterface $input |
29
|
|
|
* @param \Symfony\Component\Console\Output\OutputInterface $output |
30
|
|
|
* |
31
|
|
|
* @return int|null|void |
32
|
|
|
* @throws \Core\Locator\Dynamic\ServiceNotParseable |
33
|
|
|
* @throws \Xervice\Config\Exception\ConfigNotFound |
34
|
|
|
*/ |
35
|
|
|
protected function execute(InputInterface $input, OutputInterface $output) |
36
|
|
|
{ |
37
|
|
|
$this->getFacade()->dumpToLocal( |
38
|
|
|
$input->getArgument('volume'), |
39
|
|
|
$input->getArgument('path'), |
40
|
|
|
$input->getArgument('version') |
41
|
|
|
); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
} |
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.