From 4973f13b63a0944e04fb71cba0d6b02bf8c8afc0 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Thu, 20 Nov 2025 07:44:37 +0100 Subject: [PATCH] Report: Reduce dependency on DOM --- src/Report/Xml/Report.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) 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(