diff --git a/src/Report/Xml/File.php b/src/Report/Xml/File.php index b7c90efa5..e6dd5c4ba 100644 --- a/src/Report/Xml/File.php +++ b/src/Report/Xml/File.php @@ -19,7 +19,7 @@ */ class File { - private readonly DOMDocument $dom; + protected readonly DOMDocument $dom; private readonly DOMElement $contextNode; private ?DOMNode $lineCoverage = null; @@ -71,9 +71,4 @@ protected function contextNode(): DOMElement { return $this->contextNode; } - - protected function dom(): DOMDocument - { - return $this->dom; - } } diff --git a/src/Report/Xml/Node.php b/src/Report/Xml/Node.php index 5c94a0883..86fe70df4 100644 --- a/src/Report/Xml/Node.php +++ b/src/Report/Xml/Node.php @@ -18,7 +18,7 @@ */ abstract class Node { - private readonly DOMDocument $dom; + protected readonly DOMDocument $dom; private readonly DOMElement $contextNode; public function __construct(DOMElement $context) @@ -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; @@ -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', ); @@ -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', ); diff --git a/src/Report/Xml/Project.php b/src/Report/Xml/Project.php index 5036a4785..a91fb2e47 100644 --- a/src/Report/Xml/Project.php +++ b/src/Report/Xml/Project.php @@ -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', ), @@ -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', ), @@ -91,6 +91,6 @@ public function asDom(): DOMDocument { $this->contextNode()->setAttribute('source', $this->directory); - return $this->dom(); + return $this->dom; } } diff --git a/src/Report/Xml/Report.php b/src/Report/Xml/Report.php index 6f4400a02..ee9b401de 100644 --- a/src/Report/Xml/Report.php +++ b/src/Report/Xml/Report.php @@ -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( @@ -56,7 +56,7 @@ public function functionObject( string $crap ): void { $node = $this->contextNode()->appendChild( - $this->dom()->createElementNS( + $this->dom->createElementNS( Facade::XML_NAMESPACE, 'function', ), @@ -86,7 +86,7 @@ public function classObject( float $crap ): Unit { $node = $this->contextNode()->appendChild( - $this->dom()->createElementNS( + $this->dom->createElementNS( Facade::XML_NAMESPACE, 'class', ), @@ -106,7 +106,7 @@ public function traitObject( float $crap ): Unit { $node = $this->contextNode()->appendChild( - $this->dom()->createElementNS( + $this->dom->createElementNS( Facade::XML_NAMESPACE, 'trait', ), @@ -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', ),