/** * Only used internally when a rule is renamed to check for it unicity and accurate indexing * @param SecurityRule|NatRule $rule * @param string $oldName */ public function ruleWasRenamed($rule, $oldName) { if ($rule === null) { derr("Rule cannot be null"); } if (!$this->isRuleNameAvailable($rule->name())) { derr("Rule '" . $rule->name() . "' previously named '" . $oldName . "' cannot be renamed because this name is already in use"); } if ($this->isPreOrPost) { if ($rule->isPreRule()) { $this->fastNameToIndex[$rule->name()] = $this->fastNameToIndex[$oldName]; unset($this->fastNameToIndex[$oldName]); } elseif ($rule->isPostRule()) { $this->fastNameToIndex_forPost[$rule->name()] = $this->fastNameToIndex_forPost[$oldName]; unset($this->fastNameToIndex_forPost[$oldName]); } else { derr('unsupported'); } } else { $this->fastNameToIndex[$rule->name()] = $this->fastNameToIndex[$oldName]; unset($this->fastNameToIndex[$oldName]); } }