public static function addViolation($rule, $srcAtom, $tgtAtom) { $session = Session::singleton(); $ruleHash = hash('md5', $rule['name']); $ruleMessage = $rule['message'] ? $rule['message'] : "Violation of rule '" . $rule['name'] . "'"; $pairView = RuleEngine::getPairView($srcAtom, $rule['srcConcept'], $tgtAtom, $rule['tgtConcept'], $rule['pairView']); self::$violations[$ruleHash]['ruleMessage'] = $ruleMessage; self::$violations[$ruleHash]['interfaceIds'] = $pairView['interfaceIds']; $violationMessage = empty($pairView['violationMessage']) ? $srcAtom . " - " . $tgtAtom : $pairView['violationMessage']; // Make links to interfaces $links = array(); foreach ($session->getInterfacesToReadConcept($rule['srcConcept']) as $interface) { $links[] = '#/' . $interface->id . '/' . $srcAtom; } foreach ($session->getInterfacesToReadConcept($rule['tgtConcept']) as $interface) { $links[] = '#/' . $interface->id . '/' . $tgtAtom; } $links = array_unique($links); self::$violations[$ruleHash]['tuples'][] = array('violationMessage' => $violationMessage, 'links' => $links); self::addLog($violationMessage . ' - ' . $violationMessage, 'VIOLATION'); }