Completed
Pull Request — master (#265)
by Enrico
14:16
created

DumpDocumentationCommand   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 34
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
class DumpDocumentationCommand extends Command
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15
    protected function configure()
16
    {
17
        $this
18
            ->setName('config:dump-documentation')
19
            ->setDescription('Dumps the analyzer documentation')
20
        ;
21
    }
22
23
    /**
24
     * {@inheritdoc}
25
     */
26
    protected function execute(InputInterface $input, OutputInterface $output)
27
    {
28
        $metaArray = Analyzer\Factory::getPassesMetadata();
29
        
30
        $output->writeln("# Analyzers");
31
        $output->writeln("This doc gives an overview about what the different analyzers do.");
32
        $output->writeln("");
33
34
        foreach ($metaArray as $analyzer) {
35
            $output->writeln("#### " . $analyzer->getName());
36
            $output->writeln("");
37
            $output->writeln($analyzer->getDescription());
38
            $output->writeln("");
39
        }
40
41
        $output->writeln("Next: [How To: Write own Analyzer](./06_HowTo_Own_Analyzer.md)");
42
    }
43
}
44