diff --git a/Build.php b/Build.php index 9173d03..9e7f5e0 100644 --- a/Build.php +++ b/Build.php @@ -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; @@ -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); @@ -12096,7 +12097,7 @@ public function run() } else { throw new BuildException('Report type not supported: ' . $reportType); } - +var_dump($metric); $this->buildBadge( $coverageLineBadgeName,