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

DumpDocumentationCommand   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 34
ccs 18
cts 18
cp 1
rs 10
c 1
b 0
f 0
wmc 3
lcom 0
cbo 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 7 1
A execute() 0 17 2
1
<?php
2
3
namespace PHPSA\Command;
4
5
use PHPSA\Analyzer;
6
use Symfony\Component\Console\Command\Command;
7
use Symfony\Component\Console\Input\InputInterface;
8
use Symfony\Component\Console\Output\OutputInterface;
9
10
/**
11
 * Command to dump the analyzer documentation as markdown
12
 */
13
class DumpDocumentationCommand extends Command
14
{
15
    /**
16
     * {@inheritdoc}
17
     */
18 886
    protected function configure()
19
    {
20 886
        $this
21 886
            ->setName('config:dump-documentation')
22 886
            ->setDescription('Dumps the analyzer documentation')
23
        ;
24 886
    }
25
26
    /**
27
     * {@inheritdoc}
28
     */
29 1
    protected function execute(InputInterface $input, OutputInterface $output)
30
    {
31 1
        $metaArray = Analyzer\Factory::getPassesMetadata();
32
        
33 1
        $output->writeln("# Analyzers");
34 1
        $output->writeln("This doc gives an overview about what the different analyzers do.");
35 1
        $output->writeln("");
36
37 1
        foreach ($metaArray as $analyzer) {
38 1
            $output->writeln("#### " . $analyzer->getName());
39 1
            $output->writeln("");
40 1
            $output->writeln($analyzer->getDescription());
41 1
            $output->writeln("");
42 1
        }
43
44 1
        $output->writeln("Next: [How To: Write own Analyzer](./06_HowTo_Own_Analyzer.md)");
45 1
    }
46
}
47