Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions src/Report/Xml/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
*/
class File
{
private readonly DOMDocument $dom;
protected readonly DOMDocument $dom;
private readonly DOMElement $contextNode;
private ?DOMNode $lineCoverage = null;

Expand Down Expand Up @@ -71,9 +71,4 @@ protected function contextNode(): DOMElement
{
return $this->contextNode;
}

protected function dom(): DOMDocument
{
return $this->dom;
}
}
11 changes: 3 additions & 8 deletions src/Report/Xml/Node.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
abstract class Node
{
private readonly DOMDocument $dom;
protected readonly DOMDocument $dom;
private readonly DOMElement $contextNode;

public function __construct(DOMElement $context)
Expand All @@ -27,11 +27,6 @@ public function __construct(DOMElement $context)
$this->contextNode = $context;
}

public function dom(): DOMDocument
{
return $this->dom;
}

public function totals(): Totals
{
$totalsContainer = $this->contextNode()->firstChild;
Expand All @@ -52,7 +47,7 @@ public function totals(): Totals

public function addDirectory(string $name): Directory
{
$dirNode = $this->dom()->createElementNS(
$dirNode = $this->dom->createElementNS(
Facade::XML_NAMESPACE,
'directory',
);
Expand All @@ -65,7 +60,7 @@ public function addDirectory(string $name): Directory

public function addFile(string $name, string $href): File
{
$fileNode = $this->dom()->createElementNS(
$fileNode = $this->dom->createElementNS(
Facade::XML_NAMESPACE,
'file',
);
Expand Down
10 changes: 5 additions & 5 deletions src/Report/Xml/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ public function buildInformation(
string $phpUnitVersion,
string $coverageVersion
): void {
$buildNode = $this->dom()->getElementsByTagNameNS(
$buildNode = $this->dom->getElementsByTagNameNS(
Facade::XML_NAMESPACE,
'build',
)->item(0);

if ($buildNode === null) {
$buildNode = $this->dom()->documentElement->appendChild(
$this->dom()->createElementNS(
$buildNode = $this->dom->documentElement->appendChild(
$this->dom->createElementNS(
Facade::XML_NAMESPACE,
'build',
),
Expand All @@ -76,7 +76,7 @@ public function buildInformation(
public function tests(): Tests
{
$testsNode = $this->contextNode()->appendChild(
$this->dom()->createElementNS(
$this->dom->createElementNS(
Facade::XML_NAMESPACE,
'tests',
),
Expand All @@ -91,6 +91,6 @@ public function asDom(): DOMDocument
{
$this->contextNode()->setAttribute('source', $this->directory);

return $this->dom();
return $this->dom;
}
}
10 changes: 5 additions & 5 deletions src/Report/Xml/Report.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function asDom(): DOMDocument
$this->contextNode()->setAttribute('name', basename($this->name));
$this->contextNode()->setAttribute('path', dirname($this->name));

return $this->dom();
return $this->dom;
}

public function functionObject(
Expand All @@ -56,7 +56,7 @@ public function functionObject(
string $crap
): void {
$node = $this->contextNode()->appendChild(
$this->dom()->createElementNS(
$this->dom->createElementNS(
Facade::XML_NAMESPACE,
'function',
),
Expand Down Expand Up @@ -86,7 +86,7 @@ public function classObject(
float $crap
): Unit {
$node = $this->contextNode()->appendChild(
$this->dom()->createElementNS(
$this->dom->createElementNS(
Facade::XML_NAMESPACE,
'class',
),
Expand All @@ -106,7 +106,7 @@ public function traitObject(
float $crap
): Unit {
$node = $this->contextNode()->appendChild(
$this->dom()->createElementNS(
$this->dom->createElementNS(
Facade::XML_NAMESPACE,
'trait',
),
Expand All @@ -120,7 +120,7 @@ public function traitObject(
public function source(): Source
{
$source = $this->contextNode()->appendChild(
$this->dom()->createElementNS(
$this->dom->createElementNS(
Facade::XML_NAMESPACE,
'source',
),
Expand Down