Code Duplication    Length = 20-20 lines in 2 locations

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

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