DumpCommand::configure()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 10
Ratio 100 %

Importance

Changes 0
Metric Value
dl 10
loc 10
rs 9.9332
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Storeman\Cli\Command;
4
5
use Storeman\Storeman;
6
use Storeman\Cli\SynchronizationProgressListener;
7
use Symfony\Component\Console\Input\InputArgument;
8
use Symfony\Component\Console\Input\InputInterface;
9
use Symfony\Component\Console\Input\InputOption;
10
use Symfony\Component\Console\Output\OutputInterface;
11
12
class DumpCommand extends AbstractCommand
13
{
14 View Code Duplication
    protected function configure()
15
    {
16
        parent::configure();
17
18
        $this->setName('dump');
19
        $this->setDescription('Dump the contents of a vault.');
20
        $this->addArgument('path', InputArgument::REQUIRED, 'Target path.');
21
        $this->addOption('revision', 'r', InputOption::VALUE_REQUIRED, 'Restore given revision. Defaults to last revision.');
22
        $this->addOption('vault', null, InputOption::VALUE_REQUIRED, 'Vault to use to download state from.');
23
    }
24
25 View Code Duplication
    protected function executeConfigured(InputInterface $input, OutputInterface $output, Storeman $storeman): int
26
    {
27
        $storeman->dump(
28
            $input->getArgument('path'),
29
            $input->getOption(  'revision') ? (int)$input->getOption('revision') : null,
30
            $input->getOption('vault'),
31
            new SynchronizationProgressListener($output)
32
        );
33
34
        $output->writeln(PHP_EOL . '<info>Done!</info>');
35
36
        return 0;
37
    }
38
}
39