Code Duplication    Length = 12-12 lines in 2 locations

core/EE_Capabilities.core.php 2 locations

@@ 681-692 (lines=12) @@
678
        );
679
        $update_capabilities_map = false;
680
        // if not reset, see what caps are new for each role. if they're new, add them.
681
        foreach ($capabilities_to_add as $role => $caps_for_role) {
682
            if (is_array($caps_for_role)) {
683
                foreach ($caps_for_role as $cap) {
684
                    if (
685
                        ! $this->capHasBeenAddedToRole($role, $cap)
686
                        && $this->add_cap_to_role($role, $cap, true, false)
687
                    ) {
688
                        $update_capabilities_map = true;
689
                    }
690
                }
691
            }
692
        }
693
        // now let's just save the cap that has been set but only if there's been a change.
694
        $updated = $this->updateCapabilitiesMap($update_capabilities_map);
695
        do_action('AHEE__EE_Capabilities__addCaps__complete', $this->capabilities_map, $updated);
@@ 715-726 (lines=12) @@
712
            return false;
713
        }
714
        $update_capabilities_map = false;
715
        foreach ($caps_map as $role => $caps_for_role) {
716
            if (is_array($caps_for_role)) {
717
                foreach ($caps_for_role as $cap) {
718
                    if (
719
                        $this->capHasBeenAddedToRole($role, $cap)
720
                        && $this->remove_cap_from_role($role, $cap, false)
721
                    ) {
722
                        $update_capabilities_map = true;
723
                    }
724
                }
725
            }
726
        }
727
        // maybe resave the caps
728
        return $this->updateCapabilitiesMap($update_capabilities_map);
729
    }