Skip to content

Commit bc41506

Browse files
staabmsebastianbergmann
authored andcommitted
Project: Reduce dependency on DOM
1 parent 2e64511 commit bc41506

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/Report/Xml/Project.php

Lines changed: 6 additions & 7 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
public function __construct(string $directory)
2224
{
2325
$dom = new DOMDocument;
@@ -30,12 +32,12 @@ public function __construct(string $directory)
3032
)->item(0),
3133
);
3234

33-
$this->setProjectSourceDirectory($directory);
35+
$this->directory = $directory;
3436
}
3537

3638
public function projectSourceDirectory(): string
3739
{
38-
return $this->contextNode()->getAttribute('source');
40+
return $this->directory;
3941
}
4042

4143
public function buildInformation(): BuildInformation
@@ -82,11 +84,8 @@ public function tests(): Tests
8284

8385
public function asDom(): DOMDocument
8486
{
85-
return $this->dom();
86-
}
87+
$this->contextNode()->setAttribute('source', $this->directory);
8788

88-
private function setProjectSourceDirectory(string $name): void
89-
{
90-
$this->contextNode()->setAttribute('source', $name);
89+
return $this->dom();
9190
}
9291
}

0 commit comments

Comments
 (0)