Skip to content
This repository was archived by the owner on Sep 15, 2025. It is now read-only.

Commit a99f937

Browse files
committed
feat: Add traits property and method for managing traits in Node class
1 parent 92b89c6 commit a99f937

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/ClassDiagramRenderer/Node/Node.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ abstract class Node
1616
protected Nodes $implements;
1717
protected Nodes $properties;
1818
protected Nodes $depends;
19+
protected Nodes $traits;
1920
/** @var array<Relationship> */
2021
protected array $extraRelationships;
2122

@@ -25,6 +26,7 @@ public function __construct(protected string $name)
2526
$this->implements = Nodes::empty();
2627
$this->properties = Nodes::empty();
2728
$this->depends = Nodes::empty();
29+
$this->traits = Nodes::empty();
2830
$this->extraRelationships = [];
2931
}
3032

@@ -49,10 +51,10 @@ public function depend(Node $node): void
4951
{
5052
$this->depends->add($node);
5153
}
52-
53-
public function addRelationship(Relationship $relationship): void
54+
55+
public function useTrait(Node $trait): void
5456
{
55-
$this->extraRelationships[] = $relationship;
57+
$this->traits->add($trait);
5658
}
5759

5860
public function nodeName(): string

0 commit comments

Comments
 (0)