Code Duplication    Length = 14-14 lines in 2 locations

backend/controllers/MenuController.php 2 locations

@@ 162-175 (lines=14) @@
159
            }
160
        }
161
162
        if (Yii::$app->request->post('type') === 'post' && $postIds = Yii::$app->request->post('postIds')) {
163
            foreach ($postIds as $postId) {
164
                if ($post = $this->findPost($postId)) {
165
                    $model = new MenuItem([
166
                        'menu_id' => $id,
167
                        'label' => $post->title,
168
                        'url' => $post->getUrl(),
169
                    ]);
170
                    if ($model->save()) {
171
                        $items .= $this->renderPartial('_render-item', ['item' => $model, 'wrap' => 'true']);
172
                    }
173
                }
174
            }
175
        }
176
177
        if (Yii::$app->request->post('type') === 'taxonomy' && $termIds = Yii::$app->request->post('termIds')) {
178
            foreach ($termIds as $termId) {
@@ 177-190 (lines=14) @@
174
            }
175
        }
176
177
        if (Yii::$app->request->post('type') === 'taxonomy' && $termIds = Yii::$app->request->post('termIds')) {
178
            foreach ($termIds as $termId) {
179
                if ($term = $this->findTerm($termId)) {
180
                    $model = new MenuItem([
181
                        'menu_id' => $id,
182
                        'label' => $term->name,
183
                        'url' => $term->getUrl(),
184
                    ]);
185
                    if ($model->save()) {
186
                        $items .= $this->renderPartial('_render-item', ['item' => $model, 'wrap' => 'true']);
187
                    }
188
                }
189
            }
190
        }
191
192
        return $items;
193
    }