Completed
Push — master ( f2b67d...98a2b4 )
by Arne
01:46
created

DumpCommand::executePrepared()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 14
Code Lines 9

Duplication

Lines 14
Ratio 100 %

Importance

Changes 0
Metric Value
dl 14
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 AbstractCommand
14
{
15 View Code Duplication
    protected function configure()
0 ignored issues
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
        $this->setName('restore');
18
        $this->setDescription('Dump the contents of a vault.');
19
        $this->addArgument('path', InputArgument::REQUIRED, 'Target path.');
20
        $this->addOption('config', 'c', InputOption::VALUE_REQUIRED, 'Configuration file to use. Defaults to "archivr.json".');
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 executePrepared(InputInterface $input, OutputInterface $output, Configuration $configuration): int
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...
26
    {
27
        $archivr = new ArchivR($configuration);
28
        $archivr->dump(
29
            $input->getArgument('path'),
30
            $input->hasOption('revision') ? (int)$input->getOption('revision') : null,
31
            $input->getOption('vault'),
32
            new SynchronizationProgressListener($output)
33
        );
34
35
        $output->writeln(PHP_EOL . '<info>Done!</info>');
36
37
        return 0;
38
    }
39
}
40