Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
100.00% |
1 / 1 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
13 / 13 |
DigraphCommand | |
100.00% |
1 / 1 |
|
100.00% |
3 / 3 |
3 | |
100.00% |
13 / 13 |
getSubname() | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
getFullDesc() | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
processGraph(Graph $graph, OutputInterface $output) | |
100.00% |
1 / 1 |
1 | |
100.00% |
11 / 11 |
<?php | |
/* | |
* Mondrian | |
*/ | |
namespace Trismegiste\Mondrian\Command; | |
use Symfony\Component\Console\Output\OutputInterface; | |
use Trismegiste\Mondrian\Graph\Graph; | |
use Trismegiste\Mondrian\Analysis\CodeMetrics; | |
/** | |
* DigraphCommand transforms a bunch of php files into a digraph | |
* and exports it into a report file. | |
* | |
* It make also some code metrics about it. | |
* | |
*/ | |
class DigraphCommand extends AbstractParse | |
{ | |
protected function getSubname() | |
{ | |
return 'digraph'; | |
} | |
protected function getFullDesc() | |
{ | |
return parent::getFullDesc() . ' and print some metrics'; | |
} | |
protected function processGraph(Graph $graph, OutputInterface $output) | |
{ | |
$stat = new CodeMetrics($graph); | |
$metrics = $stat->getCardinal(); | |
$output->writeln('Classes: ' . $metrics['Class']); | |
$output->writeln('Interfaces: ' . $metrics['Interface']); | |
$output->writeln('Traits: ' . $metrics['Trait']); | |
$output->writeln('Methods: ' . $metrics['Method']); | |
$output->writeln(' - declared in classes: ' . $metrics['MethodDeclaration']['Class']); | |
$output->writeln(' - declared in interfaces: ' . $metrics['MethodDeclaration']['Interface']); | |
$output->writeln(' - declared in traits: ' . $metrics['MethodDeclaration']['Trait']); | |
$output->writeln('Implemented: ' . $metrics['Impl']); | |
return $graph; | |
} | |
} |