Code Duplication    Length = 8-8 lines in 2 locations

includes/specials/SpecialUserrights.php 2 locations

@@ 273-280 (lines=8) @@
270
		$newGroups = $oldGroups;
271
272
		// Remove then add groups
273
		if ( $remove ) {
274
			foreach ( $remove as $index => $group ) {
275
				if ( !$user->removeGroup( $group ) ) {
276
					unset( $remove[$index] );
277
				}
278
			}
279
			$newGroups = array_diff( $newGroups, $remove );
280
		}
281
		if ( $add ) {
282
			foreach ( $add as $index => $group ) {
283
				if ( !$user->addGroup( $group ) ) {
@@ 281-288 (lines=8) @@
278
			}
279
			$newGroups = array_diff( $newGroups, $remove );
280
		}
281
		if ( $add ) {
282
			foreach ( $add as $index => $group ) {
283
				if ( !$user->addGroup( $group ) ) {
284
					unset( $add[$index] );
285
				}
286
			}
287
			$newGroups = array_merge( $newGroups, $add );
288
		}
289
		$newGroups = array_unique( $newGroups );
290
291
		// Ensure that caches are cleared