Completed
Pull Request — master (#139)
by Kévin
22:48 queued 19:51
created

DumpReferenceCommand   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Test Coverage

Coverage 45.45%

Importance

Changes 0
Metric Value
dl 0
loc 25
ccs 5
cts 11
cp 0.4545
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 8 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 732
    protected function configure()
21
    {
22 732
        $this
23 732
            ->setName('config:dump-reference')
24 732
            ->setDescription('Dumps the default configuration')
25
        ;
26 732
    }
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
36
        $dumper = new YamlReferenceDumper();
37
        $output->writeln($dumper->dumpNode($configuration->getConfigTreeBuilder($analyzerConfiguration)->buildTree()));
38
    }
39
}
40