| Conditions | 3 |
| Paths | 3 |
| Total Lines | 10 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 27 | public function getRoot(NodeInterface $node): ?PhpFileModelInterface |
||
| 28 | { |
||
| 29 | $parent = $node->getParentNode(); |
||
| 30 | while ($parent !== null) { |
||
| 31 | if (Validator::instance(PhpFileModelInterface::class)->validate($parent)) { |
||
| 32 | return $parent; |
||
| 33 | } |
||
| 34 | $parent = $this->getRoot($parent); |
||
| 35 | } |
||
| 36 | return null; |
||
| 37 | } |
||
| 39 |