diff options
Diffstat (limited to 'src/model/entities/Node.php')
-rw-r--r-- | src/model/entities/Node.php | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/model/entities/Node.php b/src/model/entities/Node.php index 93363d3..7cf395c 100644 --- a/src/model/entities/Node.php +++ b/src/model/entities/Node.php | |||
@@ -161,6 +161,15 @@ class Node | |||
161 | { | 161 | { |
162 | return $this->children; | 162 | return $this->children; |
163 | } | 163 | } |
164 | public function getNodeByName(string $name): ?Node | ||
165 | { | ||
166 | foreach($this->children as $child){ | ||
167 | if($child->getName() === $name){ | ||
168 | return $child; | ||
169 | } | ||
170 | } | ||
171 | return null; | ||
172 | } | ||
164 | public function addChild(self $child): void | 173 | public function addChild(self $child): void |
165 | { | 174 | { |
166 | $this->children[] = $child; | 175 | $this->children[] = $child; |