Completed
Pull Request — master (#283)
by Enrico
04:27
created

DumpReferenceCommand   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 26
ccs 12
cts 12
cp 1
rs 10
c 1
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
/**
16
 * Command to dump the analyzer default configuration as YAML
17
 */
18
class DumpReferenceCommand extends Command
19
{
20
    /**
21
     * {@inheritdoc}
22
     */
23 886
    protected function configure()
24
    {
25 886
        $this
26 886
            ->setName('config:dump-reference')
27 886
            ->setDescription('Dumps the default configuration')
28
        ;
29 886
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34 1
    protected function execute(InputInterface $input, OutputInterface $output)
35
    {
36 1
        $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...
37 1
        $configuration = new Configuration([], $analyzerConfiguration);
38 1
        $configTree = $configuration->getConfigTreeBuilder($analyzerConfiguration)->buildTree();
39
40 1
        $dumper = new YamlReferenceDumper();
41 1
        $output->writeln($dumper->dumpNode($configTree));
42 1
    }
43
}
44