Completed
Push — master ( 4d195a...e47cc7 )
by Tobias
07:34
created

SyncCommand::execute()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 8
Ratio 100 %

Importance

Changes 0
Metric Value
dl 8
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 2
1
<?php
2
3
/*
4
 * This file is part of the PHP Translation package.
5
 *
6
 * (c) PHP Translation team <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Translation\Bundle\Command;
13
14
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
15
use Symfony\Component\Console\Input\InputArgument;
16
use Symfony\Component\Console\Input\InputInterface;
17
use Symfony\Component\Console\Output\OutputInterface;
18
use Translation\Bundle\Model\Configuration;
19
use Translation\Bundle\Service\StorageService;
20
21
/**
22
 * @author Tobias Nyholm <[email protected]>
23
 */
24 View Code Duplication
class SyncCommand extends ContainerAwareCommand
0 ignored issues
show
Duplication introduced by
This class 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...
25
{
26
    protected function configure()
27
    {
28
        $this
29
            ->setName('translation:sync')
30
            ->setDescription('Sync the translations with the remote storage')
31
            ->addArgument('configuration', InputArgument::OPTIONAL, 'The configuration to use', 'default');
32
    }
33
34
    protected function execute(InputInterface $input, OutputInterface $output)
35
    {
36
        $container = $this->getContainer();
37
        $configName = $input->getArgument('configuration');
38
        /** @var StorageService $storage */
39
        $storage = $container->get('php_translation.storage.'.$configName);
40
        $storage->sync();
41
    }
42
}
43