Code Duplication    Length = 7-7 lines in 2 locations

backend/controllers/ModuleController.php 1 location

@@ 163-169 (lines=7) @@
160
                Yii::$app->getSession()->setFlash('success', Yii::t('writesdown', 'Module successfully installed'));
161
162
                return $this->redirect(['index']);
163
            } else {
164
                if (!$model->hasErrors('directory')) {
165
                    FileHelper::removeDirectory($this->_dir . $baseDir);
166
                }
167
168
                $errors = ArrayHelper::merge($errors, $model->getFirstErrors());
169
            }
170
        }
171
172
        return $this->render('create', [

backend/controllers/WidgetController.php 1 location

@@ 195-201 (lines=7) @@
192
                Yii::$app->getSession()->setFlash('success', Yii::t('writesdown', 'Widget successfully installed.'));
193
194
                return $this->redirect(['index']);
195
            } else {
196
                if (!ArrayHelper::getValue($errors, 'dirExist')) {
197
                    FileHelper::removeDirectory($this->_dir . $baseDir);
198
                }
199
200
                $errors = ArrayHelper::merge($errors, $model->getFirstErrors());
201
            }
202
        }
203
204
        return $this->render('create', [