Completed
Push — master ( fef7a6...aff413 )
by Arne
02:38
created

DumpCommand::executeConfigured()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 14
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

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