| Conditions | 7 |
| Paths | 7 |
| Total Lines | 17 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 45 | public function hasParent($parent = null, bool $recursive = false): bool |
||
| 46 | { |
||
| 47 | if ($parent === null) { |
||
| 48 | return $this->parent !== null; |
||
| 49 | } |
||
| 50 | |||
| 51 | if ($parent instanceof Node) { |
||
| 52 | $foundParent = $this->parent === $parent; |
||
| 53 | } else { |
||
| 54 | $foundParent = isset($this->parent) && get_class($this->parent) === $parent; |
||
|
1 ignored issue
–
show
|
|||
| 55 | } |
||
| 56 | |||
| 57 | if ($recursive === true && isset($this->parent) && $foundParent === false) { |
||
| 58 | return $this->parent->hasParent($parent, true); |
||
| 59 | } |
||
| 60 | |||
| 61 | return $foundParent; |
||
| 62 | } |
||
| 64 |