Code Duplication    Length = 8-10 lines in 2 locations

lib/AbstractPicoPlugin.php 2 locations

@@ 173-180 (lines=8) @@
170
            // plugins which don't implement PicoPluginInterface are always enabled
171
            if (is_a($plugin, 'PicoPluginInterface') && !$plugin->isEnabled()) {
172
                if ($recursive) {
173
                    if (!$plugin->isStatusChanged()) {
174
                        $plugin->setEnabled(true, true, true);
175
                    } else {
176
                        throw new RuntimeException(
177
                            "Unable to enable plugin '" . get_called_class() . "':"
178
                            . "Required plugin '" . $pluginName . "' was disabled manually"
179
                        );
180
                    }
181
                } else {
182
                    throw new RuntimeException(
183
                        "Unable to enable plugin '" . get_called_class() . "':"
@@ 213-222 (lines=10) @@
210
        if (!empty($dependants)) {
211
            if ($recursive) {
212
                foreach ($this->getDependants() as $pluginName => $plugin) {
213
                    if ($plugin->isEnabled()) {
214
                        if (!$plugin->isStatusChanged()) {
215
                            $plugin->setEnabled(false, true, true);
216
                        } else {
217
                            throw new RuntimeException(
218
                                "Unable to disable plugin '" . get_called_class() . "': "
219
                                . "Required by manually enabled plugin '" . $pluginName . "'"
220
                            );
221
                        }
222
                    }
223
                }
224
            } else {
225
                $dependantsList = 'plugin' . ((count($dependants) > 1) ? 's' : '') . ' ';