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

DumpReferenceCommand   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Test Coverage

Coverage 41.67%

Importance

Changes 0
Metric Value
dl 0
loc 26
ccs 5
cts 12
cp 0.4167
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 6

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 7 1
A execute() 0 9 1
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