Example #1
0
 /**
  * @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;
         }
     }
 }
Example #2
0
 /**
  * @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;
 }