GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

PrepareCommand::execute()   B
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 24
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 24
rs 8.9713
cc 2
eloc 15
nc 2
nop 2
1
<?php
2
3
namespace Application\Command\Translations;
4
5
use Silex\Application;
6
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Input\InputOption;
9
use Symfony\Component\Console\Output\OutputInterface;
10
11
/**
12
 * @author Borut Balažek <[email protected]>
13
 */
14
class PrepareCommand extends ContainerAwareCommand
15
{
16
    protected $app;
17
18
    public function __construct($name, Application $app)
19
    {
20
        parent::__construct($name);
21
22
        $this->app = $app;
23
    }
24
25
    protected function configure()
26
    {
27
        $this
28
            ->setName(
29
                'application:translations:prepare'
30
            )
31
            ->setDescription('Prepare translations')
32
            ->addOption(
33
                'locale',
34
                'l',
35
                InputOption::VALUE_OPTIONAL,
36
                'On which locale?'
37
            )
38
        ;
39
    }
40
41
    protected function execute(InputInterface $input, OutputInterface $output)
42
    {
43
        $app = $this->app;
44
45
        $locale = $input->getOption('locale')
46
            ? $input->getOption('locale')
47
            : 'en_US'
48
        ;
49
50
        $results = $app['application.translator']
51
            ->prepare($app, $locale)
52
        ;
53
54
        $allMessages = $results['allMessages'];
55
        $translatedMessages = $results['translatedMessages'];
56
        $untranslatedMessages = $results['untranslatedMessages'];
57
58
        $output->writeln('<info>The Translations for '.$locale.' were successfully prepared!</info>');
59
        $output->writeln(
60
            '<info>All: '.count($allMessages).'; '.
61
            'Translated: '.count($translatedMessages).'; '.
62
            'Untranslated: '.count($untranslatedMessages).'!</info>'
63
        );
64
    }
65
}
66