Completed
Push — master ( 356e08...d08624 )
by Tobias
09:26
created

SyncCommand::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 0
cts 5
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
crap 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\Component\Console\Command\Command;
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\Service\StorageManager;
19
20
/**
21
 * @author Tobias Nyholm <[email protected]>
22
 */
23
class SyncCommand extends Command
24
{
25
    protected static $defaultName = 'translation:sync';
26
27
    /**
28
     * @var StorageManager
29
     */
30
    private $storageManager;
31
32
    /**
33
     * @param StorageManager $storageManager
34
     */
35
    public function __construct(StorageManager $storageManager)
36
    {
37
        $this->storageManager = $storageManager;
38
39
        parent::__construct();
40
    }
41
42
    protected function configure()
43
    {
44
        $this
45
            ->setName(self::$defaultName)
46
            ->setDescription('Sync the translations with the remote storage')
47
            ->addArgument('configuration', InputArgument::OPTIONAL, 'The configuration to use', 'default');
48
    }
49
50
    protected function execute(InputInterface $input, OutputInterface $output)
51
    {
52
        $configName = $input->getArgument('configuration');
53
        $this->storageManager->getStorage($configName)->sync();
54
    }
55
}
56