DumpSshCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
eloc 13
dl 0
loc 27
ccs 0
cts 17
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 8 1
A execute() 0 9 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Nexus\Dumper\Communication\Command;
5
6
use DataProvider\DumperConfigDataProvider;
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\Business\Model\Command\AbstractCommand;
11
12
/**
13
 * @method \Nexus\Dumper\Business\DumperFacade getFacade()
14
 */
15
class DumpSshCommand extends AbstractCommand
16
{
17
    protected function configure(): void
18
    {
19
        $this
20
            ->setName('dumper:dump:ssh')
21
            ->setDescription('Dump one volume to ssh')
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
     */
33
    protected function execute(InputInterface $input, OutputInterface $output)
34
    {
35
        $configDataProvider = new DumperConfigDataProvider();
36
        $configDataProvider->setVolume($input->getArgument('volume'));
37
        $configDataProvider->setPath($input->getArgument('path'));
38
        $configDataProvider->setVersion($input->getArgument('version'));
39
        $configDataProvider->setEngine('ssh');
40
41
        $this->getFacade()->dump($configDataProvider);
42
    }
43
44
}