DumpDocumentationCommand::execute()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 17

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

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