Skip to content

Commit 3d1a562

Browse files
committed
Project: Reduce dependency on DOM
1 parent 6cda094 commit 3d1a562

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/Report/Xml/Project.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
*/
1919
final class Project extends Node
2020
{
21+
private readonly string $directory;
22+
2123
/**
2224
* @phpstan-ignore constructor.missingParentCall
2325
*/
@@ -29,7 +31,7 @@ public function __construct(string $directory)
2931

3032
public function projectSourceDirectory(): string
3133
{
32-
return $this->contextNode()->getAttribute('source');
34+
return $this->directory;
3335
}
3436

3537
public function buildInformation(): BuildInformation
@@ -76,6 +78,8 @@ public function tests(): Tests
7678

7779
public function asDom(): DOMDocument
7880
{
81+
$this->contextNode()->setAttribute('source', $this->directory);
82+
7983
return $this->dom();
8084
}
8185

@@ -92,8 +96,8 @@ private function init(): void
9296
);
9397
}
9498

95-
private function setProjectSourceDirectory(string $name): void
99+
private function setProjectSourceDirectory(string $directory): void
96100
{
97-
$this->contextNode()->setAttribute('source', $name);
101+
$this->directory = $directory;
98102
}
99103
}

0 commit comments

Comments
 (0)