diff --git a/src/Report/Xml/Report.php b/src/Report/Xml/Report.php index 34f882171..5a9c622f0 100644 --- a/src/Report/Xml/Report.php +++ b/src/Report/Xml/Report.php @@ -20,6 +20,8 @@ */ final class Report extends File { + private readonly string $name; + public function __construct(string $name) { $dom = new DOMDocument; @@ -32,11 +34,14 @@ public function __construct(string $name) parent::__construct($contextNode); - $this->setName($name); + $this->name = $name; } public function asDom(): DOMDocument { + $this->contextNode()->setAttribute('name', basename($this->name)); + $this->contextNode()->setAttribute('path', dirname($this->name)); + return $this->dom(); } @@ -85,12 +90,6 @@ public function source(): Source return new Source($source); } - private function setName(string $name): void - { - $this->contextNode()->setAttribute('name', basename($name)); - $this->contextNode()->setAttribute('path', dirname($name)); - } - private function unitObject(string $tagName, string $name): Unit { $node = $this->contextNode()->appendChild(