Code Duplication    Length = 8-8 lines in 2 locations

includes/specials/SpecialUserrights.php 2 locations

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