Code Duplication    Length = 7-8 lines in 4 locations

includes/user/User.php 4 locations

@@ 4827-4834 (lines=8) @@
4824
			'remove-self' => []
4825
		];
4826
4827
		if ( empty( $wgAddGroups[$group] ) ) {
4828
			// Don't add anything to $groups
4829
		} elseif ( $wgAddGroups[$group] === true ) {
4830
			// You get everything
4831
			$groups['add'] = self::getAllGroups();
4832
		} elseif ( is_array( $wgAddGroups[$group] ) ) {
4833
			$groups['add'] = $wgAddGroups[$group];
4834
		}
4835
4836
		// Same thing for remove
4837
		if ( empty( $wgRemoveGroups[$group] ) ) {
@@ 4837-4843 (lines=7) @@
4834
		}
4835
4836
		// Same thing for remove
4837
		if ( empty( $wgRemoveGroups[$group] ) ) {
4838
			// Do nothing
4839
		} elseif ( $wgRemoveGroups[$group] === true ) {
4840
			$groups['remove'] = self::getAllGroups();
4841
		} elseif ( is_array( $wgRemoveGroups[$group] ) ) {
4842
			$groups['remove'] = $wgRemoveGroups[$group];
4843
		}
4844
4845
		// Re-map numeric keys of AddToSelf/RemoveFromSelf to the 'user' key for backwards compatibility
4846
		if ( empty( $wgGroupsAddToSelf['user'] ) || $wgGroupsAddToSelf['user'] !== true ) {
@@ 4863-4870 (lines=8) @@
4860
		}
4861
4862
		// Now figure out what groups the user can add to him/herself
4863
		if ( empty( $wgGroupsAddToSelf[$group] ) ) {
4864
			// Do nothing
4865
		} elseif ( $wgGroupsAddToSelf[$group] === true ) {
4866
			// No idea WHY this would be used, but it's there
4867
			$groups['add-self'] = User::getAllGroups();
4868
		} elseif ( is_array( $wgGroupsAddToSelf[$group] ) ) {
4869
			$groups['add-self'] = $wgGroupsAddToSelf[$group];
4870
		}
4871
4872
		if ( empty( $wgGroupsRemoveFromSelf[$group] ) ) {
4873
			// Do nothing
@@ 4872-4878 (lines=7) @@
4869
			$groups['add-self'] = $wgGroupsAddToSelf[$group];
4870
		}
4871
4872
		if ( empty( $wgGroupsRemoveFromSelf[$group] ) ) {
4873
			// Do nothing
4874
		} elseif ( $wgGroupsRemoveFromSelf[$group] === true ) {
4875
			$groups['remove-self'] = User::getAllGroups();
4876
		} elseif ( is_array( $wgGroupsRemoveFromSelf[$group] ) ) {
4877
			$groups['remove-self'] = $wgGroupsRemoveFromSelf[$group];
4878
		}
4879
4880
		return $groups;
4881
	}