Skip to content

Commit 2a04dc0

Browse files
committed
Remove dead code
1 parent 27ea892 commit 2a04dc0

File tree

1 file changed

+33
-55
lines changed

1 file changed

+33
-55
lines changed

src/Service/ReportService.php

Lines changed: 33 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
namespace DVDoug\Behat\CodeCoverage\Service;
88

99
use Composer\InstalledVersions;
10-
use Composer\Semver\VersionParser;
1110
use SebastianBergmann\CodeCoverage\CodeCoverage;
1211
use SebastianBergmann\CodeCoverage\Report\Clover;
1312
use SebastianBergmann\CodeCoverage\Report\Cobertura;
@@ -54,65 +53,44 @@ public function generateReport(CodeCoverage $coverage): void
5453
$report->process($coverage, $config['target'], $config['name']);
5554
break;
5655
case 'html':
57-
if (InstalledVersions::satisfies(new VersionParser(), 'phpunit/php-code-coverage', '^9.0')) {
58-
$report = new HtmlFacade(
59-
$config['lowUpperBound'],
60-
$config['highLowerBound'],
61-
sprintf(
62-
' and <a href="https://behat.cc">Behat Code Coverage %s</a>',
63-
InstalledVersions::getPrettyVersion('dvdoug/behat-code-coverage')
64-
)
65-
);
56+
$thresholds = Thresholds::from(
57+
$config['lowUpperBound'],
58+
$config['highLowerBound'],
59+
);
60+
$colors = Colors::from(
61+
$config['colors']['successLow'],
62+
$config['colors']['successMedium'],
63+
$config['colors']['successHigh'],
64+
$config['colors']['warning'],
65+
$config['colors']['danger'],
66+
);
67+
if ($config['customCSSFile']) {
68+
$customCss = CustomCssFile::from($config['customCSSFile']);
6669
} else {
67-
$thresholds = Thresholds::from(
68-
$config['lowUpperBound'],
69-
$config['highLowerBound'],
70-
);
71-
$colors = Colors::from(
72-
$config['colors']['successLow'],
73-
$config['colors']['successMedium'],
74-
$config['colors']['successHigh'],
75-
$config['colors']['warning'],
76-
$config['colors']['danger'],
77-
);
78-
if ($config['customCSSFile']) {
79-
$customCss = CustomCssFile::from($config['customCSSFile']);
80-
} else {
81-
$customCss = CustomCssFile::default();
82-
}
83-
$report = new HtmlFacade(
84-
sprintf(
85-
' and <a href="https://behat.cc">Behat Code Coverage %s</a>',
86-
InstalledVersions::getPrettyVersion('dvdoug/behat-code-coverage')
87-
),
88-
$colors,
89-
$thresholds,
90-
$customCss
91-
);
70+
$customCss = CustomCssFile::default();
9271
}
72+
$report = new HtmlFacade(
73+
sprintf(
74+
' and <a href="https://behat.cc">Behat Code Coverage %s</a>',
75+
InstalledVersions::getPrettyVersion('dvdoug/behat-code-coverage')
76+
),
77+
$colors,
78+
$thresholds,
79+
$customCss
80+
);
9381
$report->process($coverage, $config['target']);
9482
break;
9583
case 'text':
96-
if (InstalledVersions::satisfies(new VersionParser(), 'phpunit/php-code-coverage', '^9.0')) {
97-
$report = new Text(
98-
$config['lowUpperBound'],
99-
$config['highLowerBound'],
100-
$config['showUncoveredFiles'],
101-
$config['showOnlySummary']
102-
);
103-
echo $report->process($coverage, $config['showColors']);
104-
} else {
105-
$thresholds = Thresholds::from(
106-
$config['lowUpperBound'],
107-
$config['highLowerBound'],
108-
);
109-
$report = new Text(
110-
$thresholds,
111-
$config['showUncoveredFiles'],
112-
$config['showOnlySummary']
113-
);
114-
echo $report->process($coverage, $config['showColors']);
115-
}
84+
$thresholds = Thresholds::from(
85+
$config['lowUpperBound'],
86+
$config['highLowerBound'],
87+
);
88+
$report = new Text(
89+
$thresholds,
90+
$config['showUncoveredFiles'],
91+
$config['showOnlySummary']
92+
);
93+
echo $report->process($coverage, $config['showColors']);
11694
break;
11795
case 'xml':
11896
$report = new XmlFacade('');

0 commit comments

Comments
 (0)