Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions Build.php
Original file line number Diff line number Diff line change
Expand Up @@ -12038,10 +12038,11 @@ private function calculateTextLength110(string $s)

private function buildBadge(string $name, int $covered, int $valid, float $limit, string $outputFile): void
{
$coverage = (($valid === 0) ? 100.0 : number_format(($covered * 100) / $valid, 1, '.')) . '%';
$coverage = (($valid === 0) ? 100.0 : number_format(($covered * 100) / $valid, 1, '.'));
$color = $coverage >= $limit ? '#4c1' : '#e54';
$template = self::$templateSvg;
$coverageLength = $this->calculateTextLength110($coverage);
$coverageText = $coverage . '%';
$coverageLength = $this->calculateTextLength110($coverageText);
$nameTextLength = $this->calculateTextLength110($name);
$rightWidth = ceil($coverageLength / 10) + 10;
$leftWidth = ceil($nameTextLength / 10) + 10;
Expand All @@ -12052,7 +12053,7 @@ private function buildBadge(string $name, int $covered, int $valid, float $limi
$leftCenter = 10 + $leftWidth * 5;
$template = str_replace('{{ name }}', $name, $template);
$template = str_replace('{{ nameTextLength }}', $nameTextLength, $template);
$template = str_replace('{{ coverage }}', $coverage, $template);
$template = str_replace('{{ coverage }}', $coverageText, $template);
$template = str_replace('{{ coverageLength }}', $coverageLength, $template);
$template = str_replace('{{ color }}', $color, $template);
$template = str_replace('{{ rightWidth }}', $rightWidth, $template);
Expand Down Expand Up @@ -12096,7 +12097,7 @@ public function run()
} else {
throw new BuildException('Report type not supported: ' . $reportType);
}

var_dump($metric);

$this->buildBadge(
$coverageLineBadgeName,
Expand Down