Code Duplication    Length = 20-20 lines in 2 locations

projects/packages/sync/src/modules/class-users.php 2 locations

@@ 415-434 (lines=20) @@
412
	 *
413
	 * @param int $user_id ID of the deleted user.
414
	 */
415
	public function user_register_handler( $user_id ) {
416
		// Ensure we only sync users who are members of the current blog.
417
		if ( ! is_user_member_of_blog( $user_id, get_current_blog_id() ) ) {
418
			return;
419
		}
420
421
		if ( Jetpack_Constants::is_true( 'JETPACK_INVITE_ACCEPTED' ) ) {
422
			$this->add_flags( $user_id, array( 'invitation_accepted' => true ) );
423
		}
424
		/**
425
		 * Fires when a new user is registered on a site
426
		 *
427
		 * @since 4.9.0
428
		 *
429
		 * @param object The WP_User object
430
		 */
431
		do_action( 'jetpack_sync_register_user', $user_id, $this->get_flags( $user_id ) );
432
		$this->clear_flags( $user_id );
433
434
	}
435
436
	/**
437
	 * Handler for user addition to the current blog.
@@ 443-462 (lines=20) @@
440
	 *
441
	 * @param int $user_id ID of the user.
442
	 */
443
	public function add_user_to_blog_handler( $user_id ) {
444
		// Ensure we only sync users who are members of the current blog.
445
		if ( ! is_user_member_of_blog( $user_id, get_current_blog_id() ) ) {
446
			return;
447
		}
448
449
		if ( Jetpack_Constants::is_true( 'JETPACK_INVITE_ACCEPTED' ) ) {
450
			$this->add_flags( $user_id, array( 'invitation_accepted' => true ) );
451
		}
452
453
		/**
454
		 * Fires when a user is added on a site
455
		 *
456
		 * @since 4.9.0
457
		 *
458
		 * @param object The WP_User object
459
		 */
460
		do_action( 'jetpack_sync_add_user', $user_id, $this->get_flags( $user_id ) );
461
		$this->clear_flags( $user_id );
462
	}
463
464
	/**
465
	 * Handler for user save.