Code Duplication    Length = 7-7 lines in 3 locations

main/inc/lib/usergroup.lib.php 3 locations

@@ 609-615 (lines=7) @@
606
                }
607
            }
608
        }
609
        if (!empty($current_list)) {
610
            foreach ($current_list as $session_id) {
611
                if (!in_array($session_id, $list)) {
612
                    $delete_items[] = $session_id;
613
                }
614
            }
615
        }
616
617
        // Deleting items
618
        if (!empty($delete_items)) {
@@ 665-671 (lines=7) @@
662
            }
663
        }
664
665
        if (!empty($current_list)) {
666
            foreach ($current_list as $id) {
667
                if (!in_array($id, $list)) {
668
                    $delete_items[] = $id;
669
                }
670
            }
671
        }
672
673
        if ($delete_groups) {
674
            self::unsubscribe_courses_from_usergroup($usergroup_id, $delete_items);
@@ 740-746 (lines=7) @@
737
            }
738
        }
739
740
        if (!empty($current_list)) {
741
            foreach ($current_list as $user_id) {
742
                if (!in_array($user_id, $list)) {
743
                    $delete_items[] = $user_id;
744
                }
745
            }
746
        }
747
748
        // Deleting items
749
        if (!empty($delete_items) && $delete_users_not_present_in_list) {