Code Duplication    Length = 7-8 lines in 4 locations

includes/user/User.php 4 locations

@@ 4867-4874 (lines=8) @@
4864
			'remove-self' => []
4865
		];
4866
4867
		if ( empty( $wgAddGroups[$group] ) ) {
4868
			// Don't add anything to $groups
4869
		} elseif ( $wgAddGroups[$group] === true ) {
4870
			// You get everything
4871
			$groups['add'] = self::getAllGroups();
4872
		} elseif ( is_array( $wgAddGroups[$group] ) ) {
4873
			$groups['add'] = $wgAddGroups[$group];
4874
		}
4875
4876
		// Same thing for remove
4877
		if ( empty( $wgRemoveGroups[$group] ) ) {
@@ 4877-4883 (lines=7) @@
4874
		}
4875
4876
		// Same thing for remove
4877
		if ( empty( $wgRemoveGroups[$group] ) ) {
4878
			// Do nothing
4879
		} elseif ( $wgRemoveGroups[$group] === true ) {
4880
			$groups['remove'] = self::getAllGroups();
4881
		} elseif ( is_array( $wgRemoveGroups[$group] ) ) {
4882
			$groups['remove'] = $wgRemoveGroups[$group];
4883
		}
4884
4885
		// Re-map numeric keys of AddToSelf/RemoveFromSelf to the 'user' key for backwards compatibility
4886
		if ( empty( $wgGroupsAddToSelf['user'] ) || $wgGroupsAddToSelf['user'] !== true ) {
@@ 4903-4910 (lines=8) @@
4900
		}
4901
4902
		// Now figure out what groups the user can add to him/herself
4903
		if ( empty( $wgGroupsAddToSelf[$group] ) ) {
4904
			// Do nothing
4905
		} elseif ( $wgGroupsAddToSelf[$group] === true ) {
4906
			// No idea WHY this would be used, but it's there
4907
			$groups['add-self'] = User::getAllGroups();
4908
		} elseif ( is_array( $wgGroupsAddToSelf[$group] ) ) {
4909
			$groups['add-self'] = $wgGroupsAddToSelf[$group];
4910
		}
4911
4912
		if ( empty( $wgGroupsRemoveFromSelf[$group] ) ) {
4913
			// Do nothing
@@ 4912-4918 (lines=7) @@
4909
			$groups['add-self'] = $wgGroupsAddToSelf[$group];
4910
		}
4911
4912
		if ( empty( $wgGroupsRemoveFromSelf[$group] ) ) {
4913
			// Do nothing
4914
		} elseif ( $wgGroupsRemoveFromSelf[$group] === true ) {
4915
			$groups['remove-self'] = User::getAllGroups();
4916
		} elseif ( is_array( $wgGroupsRemoveFromSelf[$group] ) ) {
4917
			$groups['remove-self'] = $wgGroupsRemoveFromSelf[$group];
4918
		}
4919
4920
		return $groups;
4921
	}