Code Duplication    Length = 7-8 lines in 4 locations

includes/user/User.php 4 locations

@@ 4804-4811 (lines=8) @@
4801
			'remove-self' => []
4802
		];
4803
4804
		if ( empty( $wgAddGroups[$group] ) ) {
4805
			// Don't add anything to $groups
4806
		} elseif ( $wgAddGroups[$group] === true ) {
4807
			// You get everything
4808
			$groups['add'] = self::getAllGroups();
4809
		} elseif ( is_array( $wgAddGroups[$group] ) ) {
4810
			$groups['add'] = $wgAddGroups[$group];
4811
		}
4812
4813
		// Same thing for remove
4814
		if ( empty( $wgRemoveGroups[$group] ) ) {
@@ 4814-4820 (lines=7) @@
4811
		}
4812
4813
		// Same thing for remove
4814
		if ( empty( $wgRemoveGroups[$group] ) ) {
4815
			// Do nothing
4816
		} elseif ( $wgRemoveGroups[$group] === true ) {
4817
			$groups['remove'] = self::getAllGroups();
4818
		} elseif ( is_array( $wgRemoveGroups[$group] ) ) {
4819
			$groups['remove'] = $wgRemoveGroups[$group];
4820
		}
4821
4822
		// Re-map numeric keys of AddToSelf/RemoveFromSelf to the 'user' key for backwards compatibility
4823
		if ( empty( $wgGroupsAddToSelf['user'] ) || $wgGroupsAddToSelf['user'] !== true ) {
@@ 4840-4847 (lines=8) @@
4837
		}
4838
4839
		// Now figure out what groups the user can add to him/herself
4840
		if ( empty( $wgGroupsAddToSelf[$group] ) ) {
4841
			// Do nothing
4842
		} elseif ( $wgGroupsAddToSelf[$group] === true ) {
4843
			// No idea WHY this would be used, but it's there
4844
			$groups['add-self'] = User::getAllGroups();
4845
		} elseif ( is_array( $wgGroupsAddToSelf[$group] ) ) {
4846
			$groups['add-self'] = $wgGroupsAddToSelf[$group];
4847
		}
4848
4849
		if ( empty( $wgGroupsRemoveFromSelf[$group] ) ) {
4850
			// Do nothing
@@ 4849-4855 (lines=7) @@
4846
			$groups['add-self'] = $wgGroupsAddToSelf[$group];
4847
		}
4848
4849
		if ( empty( $wgGroupsRemoveFromSelf[$group] ) ) {
4850
			// Do nothing
4851
		} elseif ( $wgGroupsRemoveFromSelf[$group] === true ) {
4852
			$groups['remove-self'] = User::getAllGroups();
4853
		} elseif ( is_array( $wgGroupsRemoveFromSelf[$group] ) ) {
4854
			$groups['remove-self'] = $wgGroupsRemoveFromSelf[$group];
4855
		}
4856
4857
		return $groups;
4858
	}