Code Duplication    Length = 6-6 lines in 3 locations

backend/controllers/ModuleController.php 1 location

@@ 99-104 (lines=6) @@
96
        if (($model->file = UploadedFile::getInstance($model, 'file')) && $model->validate(['file'])) {
97
            $tmpPath = $this->_tmp . $model->file->name;
98
99
            if (!$model->file->saveAs($tmpPath)) {
100
                return $this->render('create', [
101
                    'model' => $model,
102
                    'error' => [Yii::t('writesdown', 'Failed to move uploaded file.')],
103
                ]);
104
            }
105
106
            $zipArchive = new \ZipArchive();
107
            $zipArchive->open($tmpPath);

backend/controllers/WidgetController.php 1 location

@@ 142-147 (lines=6) @@
139
        if (($model->file = UploadedFile::getInstance($model, 'file')) && $model->validate(['file'])) {
140
            $tmpPath = $this->_tmp . $model->file->name;
141
142
            if (!$model->file->saveAs($tmpPath)) {
143
                return $this->render('create', [
144
                    'model' => $model,
145
                    'errors' => [Yii::t('writesdown', 'Failed to move uploaded file')],
146
                ]);
147
            }
148
149
            $zipArchive = new \ZipArchive();
150
            $zipArchive->open($tmpPath);

backend/controllers/ThemeController.php 1 location

@@ 137-142 (lines=6) @@
134
        if (($model->file = UploadedFile::getInstance($model, 'file')) && $model->validate()) {
135
            $themeTempPath = $this->_tmp . $model->file->name;
136
137
            if (!$model->file->saveAs($themeTempPath)) {
138
                return $this->render('upload', [
139
                    'model' => $model,
140
                    'errors' => [Yii::t('writesdown', 'Failed to move uploaded file')],
141
                ]);
142
            }
143
144
            $zipArchive = new \ZipArchive();
145
            $zipArchive->open($themeTempPath);