/** * @param $name * @param VulnerabilityHost $startNode * @param FieldDescriptor $descriptor * @param bool $onlyRoot * @return null|\VulnModule\Vulnerability * @throws MissingContextVulnerabilityException * @throws MissingFieldVulnerabilityException */ public function _getParentVulnerabilityFromParentNode($name, VulnerabilityHost $startNode = null, FieldDescriptor $descriptor = null, $onlyRoot = false) { if ($descriptor) { foreach ($this->fields as $field) { if ($field->matchesToDescriptor($descriptor)) { if ($field->hasOwnVulnerability($name, $onlyRoot)) { return $field->getVulnerability($name, $onlyRoot); } } } if ($this->getParent()) { return $this->getParent()->getParentVulnerability($name, $startNode, $descriptor, $onlyRoot); } else { throw new MissingFieldVulnerabilityException(); } } else { try { return parent::_getParentVulnerabilityFromParentNode($name, $startNode, null, $onlyRoot); } catch (MissingVulnerabilityInTreeException $e) { throw new MissingContextVulnerabilityException("", 0, $e); } } }