GeneratePhonePrefixDataCommand::execute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 7
nc 1
nop 2
dl 0
loc 11
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace libphonenumber\buildtools\Commands;
4
5
use libphonenumber\buildtools\GeneratePhonePrefixData;
6
use Symfony\Component\Console\Command\Command;
7
use Symfony\Component\Console\Input\InputArgument;
8
use Symfony\Component\Console\Input\InputInterface;
9
use Symfony\Component\Console\Input\InputOption;
10
use Symfony\Component\Console\Output\OutputInterface;
11
12
class GeneratePhonePrefixDataCommand extends Command
13
{
14
    protected function configure()
15
    {
16
        $this->setName('GeneratePhonePrefixData');
17
        $this->setDescription('Generate phone prefix data files');
18
        $this->setDefinition(
19
            array(
20
                new InputArgument('InputDirectory', InputArgument::REQUIRED, 'The input directory containing the locale/region.txt files'),
21
                new InputArgument('OutputDirectory', InputArgument::REQUIRED, 'The output source directory'),
22
                new InputOption('expandCountries', null, InputOption::VALUE_NONE, 'Should we expand certain countries into separate files'),
23
            )
24
        );
25
    }
26
27
    protected function execute(InputInterface $input, OutputInterface $output)
28
    {
29
        $generatePhonePrefixData = new GeneratePhonePrefixData();
30
        $generatePhonePrefixData->start(
31
            $input->getArgument('InputDirectory'),
32
            $input->getArgument('OutputDirectory'),
33
            $output,
34
            $input->getOption('expandCountries')
35
        );
36
37
        return 0;
38
    }
39
}
40