Ingo_Storage::copyRule PHP Method

copyRule() public method

The created copy is added to the filters list after the original rule.
public copyRule ( Ingo_Rule $rule ) : boolean
$rule Ingo_Rule The rule object to copy.
return boolean True if the rule has been found and copied.
    public function copyRule(Ingo_Rule $rule)
    {
        if ($rule instanceof Ingo_Rule_System || ($key = $this->_getRule($rule)) === null) {
            return false;
        }
        $newrule = clone $this->_rules[$key];
        $newrule->name = sprintf(_("Copy of %s"), $newrule->name);
        $newrule->uid = '';
        $this->_rules = array_values(array_merge(array_slice($this->_rules, 0, $key + 1), array($newrule), array_slice($this->_rules, $key + 1)));
        $this->_store(self::STORE_ADD, $newrule);
        return true;
    }