/** * @param string|Context $child * @return bool */ public function has($child) { if ($child instanceof Context) { return $this->currentContext->hasChild($child); } else { if (is_string($child)) { return $this->currentContext->hasChildByName($child); } else { return false; } } }
/** * @param VulnerabilityHost $parent */ public function setParent(VulnerabilityHost $parent) { if ($this->parent === $parent) { return; } if (!$parent instanceof Context) { throw new \InvalidArgumentException("Context can only be a child of other context."); } if ($this->parent && $this->parent->hasChild($this)) { $this->parent->removeChild($this); } $this->parent = $parent; }