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

DumpDocumentationCommand::configure()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 7
ccs 5
cts 5
cp 1
crap 1
rs 9.4285
c 1
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 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