DumpReferenceCommand   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Test Coverage

Coverage 36.36%

Importance

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