Skip to content

Commit

Permalink
Remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
dvdoug committed Feb 3, 2024
1 parent 27ea892 commit 2a04dc0
Showing 1 changed file with 33 additions and 55 deletions.
88 changes: 33 additions & 55 deletions src/Service/ReportService.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
namespace DVDoug\Behat\CodeCoverage\Service;

use Composer\InstalledVersions;
use Composer\Semver\VersionParser;
use SebastianBergmann\CodeCoverage\CodeCoverage;
use SebastianBergmann\CodeCoverage\Report\Clover;
use SebastianBergmann\CodeCoverage\Report\Cobertura;
Expand Down Expand Up @@ -54,65 +53,44 @@ public function generateReport(CodeCoverage $coverage): void
$report->process($coverage, $config['target'], $config['name']);
break;
case 'html':
if (InstalledVersions::satisfies(new VersionParser(), 'phpunit/php-code-coverage', '^9.0')) {
$report = new HtmlFacade(
$config['lowUpperBound'],
$config['highLowerBound'],
sprintf(
' and <a href="https://behat.cc">Behat Code Coverage %s</a>',
InstalledVersions::getPrettyVersion('dvdoug/behat-code-coverage')
)
);
$thresholds = Thresholds::from(
$config['lowUpperBound'],
$config['highLowerBound'],
);
$colors = Colors::from(
$config['colors']['successLow'],
$config['colors']['successMedium'],
$config['colors']['successHigh'],
$config['colors']['warning'],
$config['colors']['danger'],
);
if ($config['customCSSFile']) {
$customCss = CustomCssFile::from($config['customCSSFile']);
} else {
$thresholds = Thresholds::from(
$config['lowUpperBound'],
$config['highLowerBound'],
);
$colors = Colors::from(
$config['colors']['successLow'],
$config['colors']['successMedium'],
$config['colors']['successHigh'],
$config['colors']['warning'],
$config['colors']['danger'],
);
if ($config['customCSSFile']) {
$customCss = CustomCssFile::from($config['customCSSFile']);
} else {
$customCss = CustomCssFile::default();
}
$report = new HtmlFacade(
sprintf(
' and <a href="https://behat.cc">Behat Code Coverage %s</a>',
InstalledVersions::getPrettyVersion('dvdoug/behat-code-coverage')
),
$colors,
$thresholds,
$customCss
);
$customCss = CustomCssFile::default();
}
$report = new HtmlFacade(
sprintf(
' and <a href="https://behat.cc">Behat Code Coverage %s</a>',
InstalledVersions::getPrettyVersion('dvdoug/behat-code-coverage')
),
$colors,
$thresholds,
$customCss
);
$report->process($coverage, $config['target']);
break;
case 'text':
if (InstalledVersions::satisfies(new VersionParser(), 'phpunit/php-code-coverage', '^9.0')) {
$report = new Text(
$config['lowUpperBound'],
$config['highLowerBound'],
$config['showUncoveredFiles'],
$config['showOnlySummary']
);
echo $report->process($coverage, $config['showColors']);
} else {
$thresholds = Thresholds::from(
$config['lowUpperBound'],
$config['highLowerBound'],
);
$report = new Text(
$thresholds,
$config['showUncoveredFiles'],
$config['showOnlySummary']
);
echo $report->process($coverage, $config['showColors']);
}
$thresholds = Thresholds::from(
$config['lowUpperBound'],
$config['highLowerBound'],
);
$report = new Text(
$thresholds,
$config['showUncoveredFiles'],
$config['showOnlySummary']
);
echo $report->process($coverage, $config['showColors']);
break;
case 'xml':
$report = new XmlFacade('');
Expand Down

0 comments on commit 2a04dc0

Please sign in to comment.