Code Duplication    Length = 7-8 lines in 4 locations

includes/user/User.php 4 locations

@@ 4775-4782 (lines=8) @@
4772
			'remove-self' => []
4773
		];
4774
4775
		if ( empty( $wgAddGroups[$group] ) ) {
4776
			// Don't add anything to $groups
4777
		} elseif ( $wgAddGroups[$group] === true ) {
4778
			// You get everything
4779
			$groups['add'] = self::getAllGroups();
4780
		} elseif ( is_array( $wgAddGroups[$group] ) ) {
4781
			$groups['add'] = $wgAddGroups[$group];
4782
		}
4783
4784
		// Same thing for remove
4785
		if ( empty( $wgRemoveGroups[$group] ) ) {
@@ 4785-4791 (lines=7) @@
4782
		}
4783
4784
		// Same thing for remove
4785
		if ( empty( $wgRemoveGroups[$group] ) ) {
4786
			// Do nothing
4787
		} elseif ( $wgRemoveGroups[$group] === true ) {
4788
			$groups['remove'] = self::getAllGroups();
4789
		} elseif ( is_array( $wgRemoveGroups[$group] ) ) {
4790
			$groups['remove'] = $wgRemoveGroups[$group];
4791
		}
4792
4793
		// Re-map numeric keys of AddToSelf/RemoveFromSelf to the 'user' key for backwards compatibility
4794
		if ( empty( $wgGroupsAddToSelf['user'] ) || $wgGroupsAddToSelf['user'] !== true ) {
@@ 4811-4818 (lines=8) @@
4808
		}
4809
4810
		// Now figure out what groups the user can add to him/herself
4811
		if ( empty( $wgGroupsAddToSelf[$group] ) ) {
4812
			// Do nothing
4813
		} elseif ( $wgGroupsAddToSelf[$group] === true ) {
4814
			// No idea WHY this would be used, but it's there
4815
			$groups['add-self'] = User::getAllGroups();
4816
		} elseif ( is_array( $wgGroupsAddToSelf[$group] ) ) {
4817
			$groups['add-self'] = $wgGroupsAddToSelf[$group];
4818
		}
4819
4820
		if ( empty( $wgGroupsRemoveFromSelf[$group] ) ) {
4821
			// Do nothing
@@ 4820-4826 (lines=7) @@
4817
			$groups['add-self'] = $wgGroupsAddToSelf[$group];
4818
		}
4819
4820
		if ( empty( $wgGroupsRemoveFromSelf[$group] ) ) {
4821
			// Do nothing
4822
		} elseif ( $wgGroupsRemoveFromSelf[$group] === true ) {
4823
			$groups['remove-self'] = User::getAllGroups();
4824
		} elseif ( is_array( $wgGroupsRemoveFromSelf[$group] ) ) {
4825
			$groups['remove-self'] = $wgGroupsRemoveFromSelf[$group];
4826
		}
4827
4828
		return $groups;
4829
	}