create merge clover coverage command

This commit is contained in:
2023-09-21 14:57:44 +07:00
parent d00d552447
commit 82f26e10e9
20 changed files with 1084 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
<?php
declare(strict_types=1);
namespace Dannecron\CoverageMerger\Clover\Dto;
class LineDto
{
/**
* @param array<string, string> $properties Other properties on the line.
* E.g. name, visibility, complexity, crap
* @param int $count Number of hits on this line
*/
public function __construct(
private array $properties,
private int $count,
) {
}
public function getCount(): int
{
return $this->count;
}
public function getProperties(): array
{
return $this->properties;
}
public function getNum(): ?int
{
return isset($this->properties['num'])
? (int) $this->properties['num']
: null;
}
public function merge(LineDto $otherLine): self
{
$this->properties = \array_merge($otherLine->getProperties(), $this->properties);
$this->count += $otherLine->getCount();
return $this;
}
}