Code Duplication    Length = 7-8 lines in 4 locations

includes/user/User.php 4 locations

@@ 4992-4999 (lines=8) @@
4989
			'remove-self' => []
4990
		];
4991
4992
		if ( empty( $wgAddGroups[$group] ) ) {
4993
			// Don't add anything to $groups
4994
		} elseif ( $wgAddGroups[$group] === true ) {
4995
			// You get everything
4996
			$groups['add'] = self::getAllGroups();
4997
		} elseif ( is_array( $wgAddGroups[$group] ) ) {
4998
			$groups['add'] = $wgAddGroups[$group];
4999
		}
5000
5001
		// Same thing for remove
5002
		if ( empty( $wgRemoveGroups[$group] ) ) {
@@ 5002-5008 (lines=7) @@
4999
		}
5000
5001
		// Same thing for remove
5002
		if ( empty( $wgRemoveGroups[$group] ) ) {
5003
			// Do nothing
5004
		} elseif ( $wgRemoveGroups[$group] === true ) {
5005
			$groups['remove'] = self::getAllGroups();
5006
		} elseif ( is_array( $wgRemoveGroups[$group] ) ) {
5007
			$groups['remove'] = $wgRemoveGroups[$group];
5008
		}
5009
5010
		// Re-map numeric keys of AddToSelf/RemoveFromSelf to the 'user' key for backwards compatibility
5011
		if ( empty( $wgGroupsAddToSelf['user'] ) || $wgGroupsAddToSelf['user'] !== true ) {
@@ 5028-5035 (lines=8) @@
5025
		}
5026
5027
		// Now figure out what groups the user can add to him/herself
5028
		if ( empty( $wgGroupsAddToSelf[$group] ) ) {
5029
			// Do nothing
5030
		} elseif ( $wgGroupsAddToSelf[$group] === true ) {
5031
			// No idea WHY this would be used, but it's there
5032
			$groups['add-self'] = User::getAllGroups();
5033
		} elseif ( is_array( $wgGroupsAddToSelf[$group] ) ) {
5034
			$groups['add-self'] = $wgGroupsAddToSelf[$group];
5035
		}
5036
5037
		if ( empty( $wgGroupsRemoveFromSelf[$group] ) ) {
5038
			// Do nothing
@@ 5037-5043 (lines=7) @@
5034
			$groups['add-self'] = $wgGroupsAddToSelf[$group];
5035
		}
5036
5037
		if ( empty( $wgGroupsRemoveFromSelf[$group] ) ) {
5038
			// Do nothing
5039
		} elseif ( $wgGroupsRemoveFromSelf[$group] === true ) {
5040
			$groups['remove-self'] = User::getAllGroups();
5041
		} elseif ( is_array( $wgGroupsRemoveFromSelf[$group] ) ) {
5042
			$groups['remove-self'] = $wgGroupsRemoveFromSelf[$group];
5043
		}
5044
5045
		return $groups;
5046
	}