@@ -163,7 +163,9 @@ public function process(PHP_CodeCoverage $coverage, $target)
163163 ),
164164 'version ' => '@package_version@ ' ,
165165 'php_version ' => PHP_VERSION ,
166- 'generator ' => $ this ->options ['generator ' ]
166+ 'generator ' => $ this ->options ['generator ' ],
167+ 'least_tested_methods ' => $ this ->leastTestedMethods ($ classes ),
168+ 'top_project_risks ' => $ this ->topProjectRisks ($ classes )
167169 )
168170 );
169171
@@ -299,7 +301,7 @@ protected function copyFiles($target)
299301 *
300302 * @param array $classes
301303 * @param integer $max
302- * @return array
304+ * @return string
303305 */
304306 protected function leastTestedMethods (array $ classes , $ max = 20 )
305307 {
@@ -321,15 +323,29 @@ protected function leastTestedMethods(array $classes, $max = 20)
321323
322324 asort ($ methods );
323325
324- return array_slice ($ methods , 0 , min ($ max , count ($ methods )));
326+ $ methods = array_slice ($ methods , 0 , min ($ max , count ($ methods )));
327+ $ buffer = '' ;
328+
329+ foreach ($ methods as $ name => $ coverage ) {
330+ list ($ class , $ method ) = explode (':: ' , $ name );
331+
332+ $ buffer .= sprintf (
333+ ' <li><a href="%s">%s</a> (%d%%)</li> ' ,
334+ $ classes [$ class ]['methods ' ][$ method ]['file ' ],
335+ $ name ,
336+ $ coverage
337+ );
338+ }
339+
340+ return $ buffer ;
325341 }
326342
327343 /**
328344 * Returns the top project risks according to the CRAP index.
329345 *
330346 * @param array $classes
331347 * @param integer $max
332- * @return array
348+ * @return string
333349 */
334350 protected function topProjectRisks (array $ classes , $ max = 20 )
335351 {
@@ -341,6 +357,21 @@ protected function topProjectRisks(array $classes, $max = 20)
341357
342358 asort ($ risks );
343359
344- return array_reverse (array_slice ($ risks , 0 , min ($ max , count ($ risks ))));
360+ $ risks = array_reverse (
361+ array_slice ($ risks , 0 , min ($ max , count ($ risks )))
362+ );
363+
364+ $ buffer = '' ;
365+
366+ foreach ($ risks as $ name => $ crap ) {
367+ $ buffer .= sprintf (
368+ ' <li><a href="%s">%s</a> (%d)</li> ' ,
369+ $ classes [$ name ]['file ' ],
370+ $ name ,
371+ $ crap
372+ );
373+ }
374+
375+ return $ buffer ;
345376 }
346377}
0 commit comments