Aggiornato Composer
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user