Code Duplication    Length = 9-10 lines in 3 locations

packages/connection/src/class-manager.php 3 locations

@@ 553-561 (lines=9) @@
550
	 *
551
	 * @return string|int Returns the ID of the connection owner or False if no connection owner found.
552
	 */
553
	public function get_connection_owner_id() {
554
		$user_token       = $this->get_access_token( self::JETPACK_MASTER_USER );
555
		$connection_owner = false;
556
		if ( $user_token && is_object( $user_token ) && isset( $user_token->external_user_id ) ) {
557
			$connection_owner = $user_token->external_user_id;
558
		}
559
560
		return $connection_owner;
561
	}
562
563
	/**
564
	 * Returns an array of user_id's that have user tokens for communicating with wpcom.
@@ 628-637 (lines=10) @@
625
	 *
626
	 * @return object|false False if no connection owner found.
627
	 */
628
	public function get_connection_owner() {
629
		$user_token = $this->get_access_token( self::JETPACK_MASTER_USER );
630
631
		$connection_owner = false;
632
		if ( $user_token && is_object( $user_token ) && isset( $user_token->external_user_id ) ) {
633
			$connection_owner = get_userdata( $user_token->external_user_id );
634
		}
635
636
		return $connection_owner;
637
	}
638
639
	/**
640
	 * Returns true if the provided user is the Jetpack connection owner.
@@ 646-654 (lines=9) @@
643
	 * @param Integer|Boolean $user_id the user identifier. False for current user.
644
	 * @return Boolean True the user the connection owner, false otherwise.
645
	 */
646
	public function is_connection_owner( $user_id = false ) {
647
		if ( ! $user_id ) {
648
			$user_id = get_current_user_id();
649
		}
650
651
		$user_token = $this->get_access_token( self::JETPACK_MASTER_USER );
652
653
		return $user_token && is_object( $user_token ) && isset( $user_token->external_user_id ) && $user_id === $user_token->external_user_id;
654
	}
655
656
	/**
657
	 * Connects the user with a specified ID to a WordPress.com user using the