Code Duplication    Length = 7-8 lines in 4 locations

includes/user/User.php 4 locations

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