|
17 | 17 | use function sprintf; |
18 | 18 | use function str_pad; |
19 | 19 | use function strlen; |
20 | | -use SebastianBergmann\CodeCoverage\CodeCoverage; |
| 20 | +use SebastianBergmann\CodeCoverage\Node\Directory; |
21 | 21 | use SebastianBergmann\CodeCoverage\Node\File; |
22 | 22 | use SebastianBergmann\CodeCoverage\Util\Percentage; |
23 | 23 |
|
@@ -58,12 +58,9 @@ public function __construct(Thresholds $thresholds, bool $showUncoveredFiles = f |
58 | 58 | $this->showOnlySummary = $showOnlySummary; |
59 | 59 | } |
60 | 60 |
|
61 | | - public function process(CodeCoverage $coverage, bool $showColors = false): string |
| 61 | + public function process(Directory $report, bool $pathCoverage, bool $showColors = false): string |
62 | 62 | { |
63 | | - $hasBranchCoverage = !empty($coverage->getData(true)->functionCoverage()); |
64 | | - |
65 | 63 | $output = PHP_EOL . PHP_EOL; |
66 | | - $report = $coverage->getReport(); |
67 | 64 |
|
68 | 65 | $colors = [ |
69 | 66 | 'header' => '', |
@@ -128,7 +125,7 @@ public function process(CodeCoverage $coverage, bool $showColors = false): strin |
128 | 125 | $paths = ''; |
129 | 126 | $branches = ''; |
130 | 127 |
|
131 | | - if ($hasBranchCoverage) { |
| 128 | + if ($pathCoverage) { |
132 | 129 | $paths = sprintf( |
133 | 130 | ' Paths: %6s (%d/%d)', |
134 | 131 | Percentage::fromFractionAndTotal( |
@@ -180,10 +177,11 @@ public function process(CodeCoverage $coverage, bool $showColors = false): strin |
180 | 177 | $output .= $this->format($colors['classes'], $padding, $classes); |
181 | 178 | $output .= $this->format($colors['methods'], $padding, $methods); |
182 | 179 |
|
183 | | - if ($hasBranchCoverage) { |
| 180 | + if ($pathCoverage) { |
184 | 181 | $output .= $this->format($colors['paths'], $padding, $paths); |
185 | 182 | $output .= $this->format($colors['branches'], $padding, $branches); |
186 | 183 | } |
| 184 | + |
187 | 185 | $output .= $this->format($colors['lines'], $padding, $lines); |
188 | 186 |
|
189 | 187 | if ($this->showOnlySummary) { |
@@ -263,10 +261,11 @@ public function process(CodeCoverage $coverage, bool $showColors = false): strin |
263 | 261 | $output .= PHP_EOL . $fullQualifiedPath . PHP_EOL |
264 | 262 | . ' ' . $methodColor . 'Methods: ' . $this->printCoverageCounts($classInfo['methodsCovered'], $classInfo['methodCount'], 2) . $resetColor . ' '; |
265 | 263 |
|
266 | | - if ($hasBranchCoverage) { |
| 264 | + if ($pathCoverage) { |
267 | 265 | $output .= ' ' . $pathsColor . 'Paths: ' . $this->printCoverageCounts($classInfo['pathsCovered'], $classInfo['pathsCount'], 3) . $resetColor . ' ' |
268 | 266 | . ' ' . $branchesColor . 'Branches: ' . $this->printCoverageCounts($classInfo['branchesCovered'], $classInfo['branchesCount'], 3) . $resetColor . ' '; |
269 | 267 | } |
| 268 | + |
270 | 269 | $output .= ' ' . $linesColor . 'Lines: ' . $this->printCoverageCounts($classInfo['statementsCovered'], $classInfo['statementCount'], 3) . $resetColor; |
271 | 270 | } |
272 | 271 | } |
|
0 commit comments