Code Duplication    Length = 20-20 lines in 2 locations

packages/sync/src/modules/Users.php 2 locations

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