mirror of
https://github.com/Dannecron/coverage-merger.git
synced 2025-12-25 15:52:34 +03:00
create merge clover coverage command
This commit is contained in:
44
src/Clover/Dto/LineDto.php
Normal file
44
src/Clover/Dto/LineDto.php
Normal 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user