Code Duplication    Length = 20-20 lines in 2 locations

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

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