|
16 | 16 | use Hal\Component\Result\ResultCollection; |
17 | 17 | use Symfony\Component\Console\Output\BufferedOutput; |
18 | 18 | use Symfony\Component\Console\Output\OutputInterface; |
| 19 | +use Symfony\Component\Console\Helper\TableCell; |
| 20 | +use Symfony\Component\Console\Helper\TableSeparator; |
19 | 21 |
|
20 | 22 |
|
21 | 23 | /** |
@@ -84,36 +86,63 @@ public function terminate(ResultCollection $collection, ResultCollection $groupe |
84 | 86 |
|
85 | 87 | $hasOOP = null !== $total->getSum('instability'); |
86 | 88 |
|
| 89 | + $output->writeln('1 - Complexity'); |
| 90 | + $output->writeln('2 - Myer Distance: derivated from Cyclomatic complexity'); |
| 91 | + $output->writeln('3 - Maintainability'); |
| 92 | + $output->writeln('4 - LLOC: Number of logical lines of code'); |
| 93 | + $output->writeln('5 - Comment weight: measure the ratio between logical code and comments'); |
| 94 | + $output->writeln('6 - Vocabulary used in code'); |
| 95 | + $output->writeln('7 - Volume'); |
| 96 | + $output->writeln('8 - Bugs: Number of estimated bugs by file'); |
| 97 | + $output->writeln('9 - Difficulty of the code'); |
| 98 | + $output->writeln('A - LCOM: Lack of cohesion of methods measures the cohesiveness of a class'); |
| 99 | + $output->writeln('B - System complexity'); |
| 100 | + $output->writeln('C - Instability: Indicates the class is resilience to change'); |
| 101 | + $output->writeln('D - Abstractness: Number of abstract classes'); |
| 102 | + $output->writeln('E - Efferent coupling (CE): Number of classes that the class depend'); |
| 103 | + $output->writeln('F - Afferent coupling (CA): Number of classes affected by this class'); |
| 104 | + |
| 105 | + $output->writeln(''); |
| 106 | + |
| 107 | + $output->writeln('More details about metrics: http://www.phpmetrics.org/documentation/index.html'); |
| 108 | + |
87 | 109 | $table = new \Symfony\Component\Console\Helper\Table($output); |
88 | 110 | $table |
89 | 111 | ->setHeaders(array_merge( |
90 | 112 | array( |
91 | | - 'Name' |
92 | | - , 'Complexity' |
93 | | - , 'Myer Distance' |
94 | | - , 'Maintainability' |
95 | | - , 'LLOC' |
96 | | - , 'Comment weight' |
97 | | - , 'Vocabulary' |
98 | | - , 'Volume' |
99 | | - , 'Bugs' |
100 | | - , 'Difficulty' |
| 113 | + '1' |
| 114 | + , '2' |
| 115 | + , '3' |
| 116 | + , '4' |
| 117 | + , '5' |
| 118 | + , '6' |
| 119 | + , '7' |
| 120 | + , '8' |
| 121 | + , '9' |
101 | 122 | ) |
102 | 123 | , ($hasOOP ? array( |
103 | | - 'lcom' |
104 | | - , 'SysComplexity' |
105 | | - , 'Instability' |
106 | | - , 'Abstractness' |
107 | | - , 'ce' |
108 | | - , 'ca' |
| 124 | + 'A' |
| 125 | + , 'B' |
| 126 | + , 'C' |
| 127 | + , 'D' |
| 128 | + , 'E' |
| 129 | + , 'F' |
109 | 130 | ) : array()) |
110 | 131 | )); |
111 | 132 |
|
112 | | - foreach($groupedResults as $result) { |
| 133 | + foreach($groupedResults as $key => $result) { |
| 134 | + if($result->getDepth()>1){ |
| 135 | + $table->addRow(new TableSeparator()); |
| 136 | + } |
| 137 | + |
| 138 | + $table->addRow(array( |
| 139 | + new TableCell($result->getName(), array('colspan' => 15)) |
| 140 | + ) |
| 141 | + ); |
| 142 | + $table->addRow(new TableSeparator()); |
| 143 | + |
113 | 144 | $table->addRow(array_merge( |
114 | | - array( |
115 | | - str_repeat(' ', $result->getDepth()).$result->getName() |
116 | | - , $this->getRow($result->getBounds(), 'cyclomaticComplexity', 'average', 0) |
| 145 | + array($this->getRow($result->getBounds(), 'cyclomaticComplexity', 'average', 0) |
117 | 146 | , $this->getRow($result->getBounds(), 'myerDistance', 'average', 0) |
118 | 147 | , $this->getRow($result->getBounds(), 'maintainabilityIndex', 'average', 0) |
119 | 148 | , $this->getRow($result->getBounds(), 'logicalLoc', 'sum', 0) |
|
0 commit comments