Aggiornato Composer

This commit is contained in:
Paolo A
2024-05-17 12:24:19 +00:00
parent 4ac62108b5
commit ec201d75b2
2238 changed files with 38684 additions and 59785 deletions

View File

@@ -9,10 +9,14 @@
*/
namespace SebastianBergmann\CodeCoverage\Report;
use function basename;
use function count;
use function dirname;
use function file_put_contents;
use function preg_match;
use function range;
use function str_replace;
use function strpos;
use function time;
use DOMImplementation;
use SebastianBergmann\CodeCoverage\CodeCoverage;
@@ -25,7 +29,7 @@ final class Cobertura
/**
* @throws WriteOperationFailedException
*/
public function process(CodeCoverage $coverage, ?string $target = null, ?string $name = null): string
public function process(CodeCoverage $coverage, ?string $target = null): string
{
$time = (string) time();
@@ -84,9 +88,8 @@ final class Cobertura
$packageElement = $document->createElement('package');
$packageComplexity = 0;
$packageName = $name ?? '';
$packageElement->setAttribute('name', $packageName);
$packageElement->setAttribute('name', str_replace($report->pathAsString() . DIRECTORY_SEPARATOR, '', $item->pathAsString()));
$linesValid = $item->numberOfExecutableLines();
$linesCovered = $item->numberOfExecutedLines();
@@ -191,7 +194,7 @@ final class Cobertura
}
}
if ($report->numberOfFunctions() === 0) {
if ($item->numberOfFunctions() === 0) {
$packageElement->setAttribute('complexity', (string) $packageComplexity);
continue;
@@ -215,7 +218,7 @@ final class Cobertura
$classElement->appendChild($classLinesElement);
$functions = $report->functions();
$functions = $item->functions();
foreach ($functions as $functionName => $function) {
if ($function['executableLines'] === 0) {
@@ -292,7 +295,9 @@ final class Cobertura
$buffer = $document->saveXML();
if ($target !== null) {
Filesystem::createDirectory(dirname($target));
if (!strpos($target, '://') !== false) {
Filesystem::createDirectory(dirname($target));
}
if (@file_put_contents($target, $buffer) === false) {
throw new WriteOperationFailedException($target);