Completed
Pull Request — master (#139)
by Kévin
03:44
created

DumpReferenceCommand::configure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 7
ccs 5
cts 5
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * @author Kévin Gomez https://github.com/K-Phoen <[email protected]>
4
 */
5
6
namespace PHPSA\Command;
7
8
use PHPSA\Analyzer;
9
use PHPSA\Configuration;
10
use Symfony\Component\Config\Definition\Dumper\YamlReferenceDumper;
11
use Symfony\Component\Console\Command\Command;
12
use Symfony\Component\Console\Input\InputInterface;
13
use Symfony\Component\Console\Output\OutputInterface;
14
15
class DumpReferenceCommand extends Command
16
{
17
    /**
18
     * {@inheritdoc}
19
     */
20 747
    protected function configure()
21
    {
22 747
        $this
23 747
            ->setName('config:dump-reference')
24 747
            ->setDescription('Dumps the default configuration')
25
        ;
26 747
    }
27
28
    /**
29
     * {@inheritdoc}
30
     */
31
    protected function execute(InputInterface $input, OutputInterface $output)
32
    {
33
        $analyzerConfiguration = Analyzer\Factory::getPassesConfigurations();
0 ignored issues
show
Comprehensibility Naming introduced by
The variable name $analyzerConfiguration exceeds the maximum configured length of 20.

Very long variable names usually make code harder to read. It is therefore recommended not to make variable names too verbose.

Loading history...
34
        $configuration = new Configuration([], $analyzerConfiguration);
35
        $configTree = $configuration->getConfigTreeBuilder($analyzerConfiguration)->buildTree();
36
37
        $dumper = new YamlReferenceDumper();
38
        $output->writeln($dumper->dumpNode($configTree));
39
    }
40
}
41