Beispiel #1
0
function generate_output_txt($coverageInfos)
{
    $functionCoverageValues = CoverageInfo::getFunctionCoverageValues($coverageInfos);
    $lineCoverageValues = CoverageInfo::getLineCoverageValues($coverageInfos);
    $lineCoverageWeightedAverage = CoverageInfo::getLineCoverageWeightedAverage($coverageInfos);
    $effectiveLinesSum = CoverageInfo::getEffectiveLinesSum($coverageInfos);
    echo "Report generated " . date("H:i d.m.Y") . "\n\n";
    printf("Line coverage average, weighted by effective lines of code %s: %.2f\n", '%', round($lineCoverageWeightedAverage, 2));
    printf("Line coverage deviation %s: %.2f\n", '%', round(standardDeviation($lineCoverageValues), 2));
    printf("Function coverage average %s: %.2f\n", '%', round(average($functionCoverageValues), 2));
    printf("Function coverage deviation %s: %.2f\n", '%', round(standardDeviation($functionCoverageValues), 2));
    printf("Total effective lines of code: %d\n\n", $effectiveLinesSum);
    printf("%10s\t%10s\t%6s\t%s\n", "LineCov%", "FuncCov%", "ELOC", "Name\n");
    foreach ($coverageInfos as $coverageInfo) {
        printf("%10.2f\t%10.2f\t%6d\t%s\n", $coverageInfo->lineCoverage, $coverageInfo->functionCoverage, $coverageInfo->effectiveLines, $coverageInfo->name);
    }
}
         } else {
             if ($method == "nb") {
                 $data = getNumOfFeatures($map, $layer, $attribute);
                 $breaks = jenks($data, $classes);
                 $colors = getColors(hex2rgb($startColor), hex2rgb($endColor), count($breaks));
                 saveToMapFile($map, $layer, $attribute, $type, $breaks, $colors, $mapFile);
             } else {
                 if ($method == "quec") {
                     $data = getNumOfFeatures($map, $layer, $attribute);
                     $breaks = quantile($data, $classes);
                     $colors = getColors(hex2rgb($startColor), hex2rgb($endColor), count($breaks));
                     saveToMapFile($map, $layer, $attribute, $type, $breaks, $colors, $mapFile);
                 } else {
                     if ($method == "sd") {
                         $data = getNumOfFeatures($map, $layer, $attribute);
                         $breaks = standardDeviation($data, $classes);
                         $colors = getColors(hex2rgb($startColor), hex2rgb($endColor), count($breaks));
                         saveToMapFile($map, $layer, $attribute, $type, $breaks, $colors, $mapFile);
                     } else {
                         if ($method == "pb") {
                             $data = getNumOfFeatures($map, $layer, $attribute);
                             $breaks = pretty($data, $classes);
                             $colors = getColors(hex2rgb($startColor), hex2rgb($endColor), count($breaks));
                             saveToMapFile($map, $layer, $attribute, $type, $breaks, $colors, $mapFile);
                         }
                     }
                 }
             }
         }
     }
 }