Code Duplication    Length = 9-11 lines in 2 locations

application/modules/cfcm/admin.php 2 locations

@@ 75-85 (lines=11) @@
72
73
                    //write relations
74
                    $toInsert = [];
75
                    if (count($groups)) {
76
                        foreach ($groups as $group) {
77
                            $toInsert[] = [
78
                                           'field_name' => $data['field_name'],
79
                                           'group_id'   => $group,
80
                                          ];
81
                        }
82
83
                        if (count($toInsert)) {
84
                            $this->db->insert_batch('content_fields_groups_relations', $toInsert);
85
                        }
86
                    }
87
88
                    $this->lib_admin->log(lang('Field created', 'cfcm') . ' - field_' . $this->input->post('field_name'));
@@ 255-263 (lines=9) @@
252
                $data['field_name'] = end($this->uri->segment_array());
253
254
                $this->db->delete('content_fields_groups_relations', ['field_name' => $data['field_name']]);
255
                if (count($groups)) {
256
                    foreach ($groups as $group) {
257
                        $toInsert[] = [
258
                                       'field_name' => $data['field_name'],
259
                                       'group_id'   => $group,
260
                                      ];
261
                    }
262
263
                    $this->db->insert_batch('content_fields_groups_relations', $toInsert);
264
                }
265
266
                $this->lib_admin->log(lang('Field has been updated', 'cfcm') . ' - ' . $name);