// Send an email if (isset($_POST["sendEmail"])) { $coverageThreshold = $Project->GetCoverageThreshold(); $userids = $CoverageFile2User->GetUsersFromProject(); foreach ($userids as $userid) { $CoverageFile2User->UserId = $userid; $fileids = $CoverageFile2User->GetFiles(); $files = array(); // For each file check the coverage metric foreach ($fileids as $fileid) { $coveragefile = new CoverageFile(); $CoverageFile2User->FileId = $fileid; $coveragefile->Id = $CoverageFile2User->GetCoverageFileId($buildid); $metric = $coveragefile->GetMetric(); if ($metric < $coverageThreshold / 100.0) { $file['percent'] = $coveragefile->GetLastPercentCoverage(); $file['path'] = $coveragefile->GetPath(); $file['id'] = $fileid; $files[] = $file; } } // Send an email if the number of uncovered file is greater than one if (count($files) > 0) { // Writing the message $messagePlainText = "The following files for the project " . $Project->GetName(); $messagePlainText .= " have a low coverage and "; $messagePlainText .= "you have been identified as one of the authors of these files.\n"; foreach ($files as $file) { $messagePlainText .= $file['path'] . " (" . round($file['percent'], 2) . "%)\n"; } $messagePlainText .= "Details on the submission can be found at ";