Code Duplication    Length = 20-20 lines in 2 locations

backend/controllers/TaxonomyController.php 2 locations

@@ 86-105 (lines=20) @@
83
     * @param integer $id
84
     * @return mixed
85
     */
86
    public function actionView($id)
87
    {
88
        $term = new Term();
89
        $searchModel = new TermSearch();
90
        $dataProvider = $searchModel->search(Yii::$app->request->queryParams, $id);
91
92
        if ($term->load(Yii::$app->request->post())) {
93
            $term->taxonomy_id = $id;
94
            if ($term->save()) {
95
                return $this->redirect(['/taxonomy/view', 'id' => $id]);
96
            }
97
        }
98
99
        return $this->render('view', [
100
            'model' => $this->findModel($id),
101
            'term' => $term,
102
            'searchModel' => $searchModel,
103
            'dataProvider' => $dataProvider,
104
        ]);
105
    }
106
107
    /**
108
     * Creates a new Taxonomy model.
@@ 184-203 (lines=20) @@
181
     * @return string|\yii\web\Response
182
     * @see actionView
183
     */
184
    public function actionUpdateTerm($id, $term)
185
    {
186
        $term = $this->findTerm($term);
187
        $searchModel = new TermSearch();
188
        $dataProvider = $searchModel->search(Yii::$app->request->queryParams, $id);
189
190
        if ($term->load(Yii::$app->request->post())) {
191
            $term->taxonomy_id = $id;
192
            if ($term->save()) {
193
                return $this->redirect(['/taxonomy/view', 'id' => $id]);
194
            }
195
        }
196
197
        return $this->render('view', [
198
            'model' => $this->findModel($id),
199
            'term' => $term,
200
            'searchModel' => $searchModel,
201
            'dataProvider' => $dataProvider,
202
        ]);
203
    }
204
205
    /**
206
     * Delete an existing Term of a taxonomy on 'view taxonomy' page.