Code Duplication    Length = 21-21 lines in 2 locations

htdocs/modules/userconfigs/class/config.php 1 location

@@ 102-122 (lines=21) @@
99
     *
100
     * @return bool
101
     */
102
    public function insertConfig(UserconfigsItem $config)
103
    {
104
        if (!$this->_iHandler->insert($config)) {
105
            return false;
106
        }
107
        $options = $config->getConfOptions();
108
        $count = count($options);
109
        $conf_id = $config->getVar('conf_id');
110
        for ($i = 0; $i < $count; ++$i) {
111
            $options[$i]->setVar('conf_id', $conf_id);
112
            if (!$this->_oHandler->insert($options[$i])) {
113
                foreach ($options[$i]->getErrors() as $msg) {
114
                    $config->setErrors($msg);
115
                }
116
            }
117
        }
118
        if (!empty($this->_cachedConfigs[$config->getVar('conf_modid')][$config->getVar('conf_uid')])) {
119
            unset($this->_cachedConfigs[$config->getVar('conf_modid')][$config->getVar('conf_uid')]);
120
        }
121
        return true;
122
    }
123
124
    /**
125
     * Delete a config from the database

htdocs/xoops_lib/Xoops/Core/Kernel/Handlers/XoopsConfigHandler.php 1 location

@@ 110-130 (lines=21) @@
107
     *
108
     * @return bool
109
     */
110
    public function insertConfig(XoopsConfigItem $config)
111
    {
112
        if (!$this->itemHandler->insert($config)) {
113
            return false;
114
        }
115
        $options = $config->getConfOptions();
116
        $count = count($options);
117
        $conf_id = $config->getVar('conf_id');
118
        for ($i = 0; $i < $count; ++$i) {
119
            $options[$i]->setVar('conf_id', $conf_id);
120
            if (!$this->optionHandler->insert($options[$i])) {
121
                foreach ($options[$i]->getErrors() as $msg) {
122
                    $config->setErrors($msg);
123
                }
124
            }
125
        }
126
        if (!empty($this->cachedConfigs[$config->getVar('conf_modid')][$config->getVar('conf_catid')])) {
127
            unset($this->cachedConfigs[$config->getVar('conf_modid')][$config->getVar('conf_catid')]);
128
        }
129
        return true;
130
    }
131
132
    /**
133
     * Delete a config from the database