Code Duplication    Length = 14-16 lines in 4 locations

application/modules/trash/admin.php 4 locations

@@ 168-181 (lines=14) @@
165
                                 ];
166
                        break;
167
168
                    case 'product':
169
                        $route = RouteQuery::create()
170
                            ->filterByEntityId($this->input->post('products'))
171
                            ->filterByType(Route::TYPE_PRODUCT)
172
                            ->findOne();
173
174
                        $array = [
175
                                  'trash_id'            => $this->input->post('products'),
176
                                  'trash_url'           => ltrim($this->input->post('url'), '/'),
177
                                  'trash_redirect_type' => $this->input->post('redirect_type'),
178
                                  'trash_type'          => $this->input->post('type'),
179
                                  'trash_redirect'      => site_url($route->getRouteUrl()),
180
                                 ];
181
                        break;
182
183
                    case 'category':
184
                        $route = RouteQuery::create()
@@ 183-196 (lines=14) @@
180
                                 ];
181
                        break;
182
183
                    case 'category':
184
                        $route = RouteQuery::create()
185
                            ->filterByEntityId($this->input->post('category'))
186
                            ->filterByType(Route::TYPE_SHOP_CATEGORY)
187
                            ->findOne();
188
189
                        $array = [
190
                                  'trash_id'            => $this->input->post('category'),
191
                                  'trash_url'           => ltrim($this->input->post('url'), '/'),
192
                                  'trash_redirect_type' => $this->input->post('redirect_type'),
193
                                  'trash_type'          => $this->input->post('type'),
194
                                  'trash_redirect'      => site_url($route->getRouteUrl()),
195
                                 ];
196
                        break;
197
198
                    case 'basecategory':
199
                        $query = $this->db->get_where('category', ['id' => $this->input->post('category_base')]);
@@ 277-292 (lines=16) @@
274
                             ];
275
                    break;
276
277
                case 'product':
278
                    $route = RouteQuery::create()
279
                        ->filterByEntityId($this->input->post('products'))
280
                        ->filterByType(Route::TYPE_PRODUCT)
281
                        ->findOne();
282
283
                    $array = [
284
                              'id'                  => $this->input->post('id'),
285
                              'trash_id'            => $this->input->post('products'),
286
                              'trash_url'           => $this->input->post('old_url'),
287
                              'trash_redirect_type' => $this->input->post('redirect_type'),
288
                              'trash_type'          => $this->input->post('type'),
289
                              'trash_redirect'      => site_url($route->getRouteUrl()),
290
291
                             ];
292
                    break;
293
294
                case 'category':
295
                    $route = RouteQuery::create()
@@ 294-308 (lines=15) @@
291
                             ];
292
                    break;
293
294
                case 'category':
295
                    $route = RouteQuery::create()
296
                        ->filterByEntityId($this->input->post('category'))
297
                        ->filterByType(Route::TYPE_SHOP_CATEGORY)
298
                        ->findOne();
299
                    $array = [
300
                              'id'                  => $this->input->post('id'),
301
                              'trash_id'            => $this->input->post('category'),
302
                              'trash_url'           => $this->input->post('old_url'),
303
                              'trash_redirect_type' => $this->input->post('redirect_type'),
304
                              'trash_type'          => $this->input->post('type'),
305
                              'trash_redirect'      => site_url($route->getRouteUrl()),
306
307
                             ];
308
                    break;
309
310
                case 'basecategory':
311
                    $query = $this->db->get_where('category', ['id' => $this->input->post('category_base')]);