Code Duplication    Length = 21-21 lines in 2 locations

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

@@ 131-151 (lines=21) @@
128
     *
129
     * @return bool
130
     */
131
    public function deleteConfig(UserconfigsItem $config)
132
    {
133
        if (!$this->_iHandler->delete($config, true)) {
134
            return false;
135
        }
136
        $options = $config->getConfOptions();
137
        $count = count($options);
138
        if ($count == 0) {
139
            $options = $this->getConfigOptions(new Criteria('conf_id', $config->getVar('conf_id')));
140
            $count = count($options);
141
        }
142
        if (is_array($options) && $count > 0) {
143
            for ($i = 0; $i < $count; ++$i) {
144
                $this->_oHandler->delete($options[$i], true);
145
            }
146
        }
147
        if (!empty($this->_cachedConfigs[$config->getVar('conf_modid')][$config->getVar('conf_uid')])) {
148
            unset($this->_cachedConfigs[$config->getVar('conf_modid')][$config->getVar('conf_uid')]);
149
        }
150
        return true;
151
    }
152
153
    /**
154
     * get one or more Configs

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

@@ 139-159 (lines=21) @@
136
     *
137
     * @return bool
138
     */
139
    public function deleteConfig(XoopsConfigItem $config)
140
    {
141
        if (!$this->itemHandler->delete($config)) {
142
            return false;
143
        }
144
        $options = $config->getConfOptions();
145
        $count = count($options);
146
        if ($count == 0) {
147
            $options = $this->getConfigOptions(new Criteria('conf_id', $config->getVar('conf_id')));
148
            $count = count($options);
149
        }
150
        if (is_array($options) && $count > 0) {
151
            for ($i = 0; $i < $count; ++$i) {
152
                $this->optionHandler->delete($options[$i]);
153
            }
154
        }
155
        if (!empty($this->cachedConfigs[$config->getVar('conf_modid')][$config->getVar('conf_catid')])) {
156
            unset($this->cachedConfigs[$config->getVar('conf_modid')][$config->getVar('conf_catid')]);
157
        }
158
        return true;
159
    }
160
161
    /**
162
     * get one or more Configs