' . PHP_EOL;
@@ -381,9 +502,23 @@ EOT;
foreach($this->unfilteredTraces as $fileType)
{
$fileType = str_replace('.php', '', $fileType);
- $methodCount = $this->getClassMethodCount($module, $fileType);
-
- $summaryTable .= isset($moduleCoverageList[$fileType]) ? "| " . round($moduleCoverageList[$fileType] / $methodCount, 2) * 100 . '% | ' . PHP_EOL : '0% | ' . PHP_EOL;
+ if(empty($moduleTraces[$fileType]))
+ {
+ $summaryTable .= '0% | ' . PHP_EOL;
+ continue;
+ }
+ if($reportType == 'web')
+ {
+ $methodLines = $this->getClassMethodLines($module, $fileType);
+ $execLines = empty($moduleTraces[$fileType]['executeLines']) ? 0 : count($moduleTraces[$fileType]['executeLines']);
+ $coverage = $methodLines == 0 ? 0 : round($execLines / $methodLines, 2) * 100;
+ $summaryTable .= "" . $coverage . '% | ' . PHP_EOL;
+ }
+ else
+ {
+ $methodCount = $this->getClassMethodCount($module, $fileType);
+ $summaryTable .= "" . round($moduleCoverageList[$fileType] / $methodCount, 2) * 100 . '% | ' . PHP_EOL;
+ }
}
$summaryTable .= '
' . PHP_EOL;
@@ -396,10 +531,11 @@ EOT;
* @param string $module
* @param string $file
* @param array $fileTraces
+ * @param string $reportType
* @access private
* @return string
*/
- private function genCoverageTableByFile(string $module, string $file, array $fileTraces): string
+ private function genCoverageTableByFile(string $module, string $file, array $fileTraces, string $reportType = ''): string
{
$file = $this->getClassFile($module, $file);
$coverageTable = <<