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

DownloadCommand   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 5
dl 19
loc 19
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 7 7 1
A execute() 8 8 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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 DownloadCommand 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:download')
30
            ->setDescription('Replace local messages with messages from remote')
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->download();
41
    }
42
}
43