/** * @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; }