Code Duplication    Length = 9-10 lines in 3 locations

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

@@ 564-572 (lines=9) @@
561
	 *
562
	 * @return string|int Returns the ID of the connection owner or False if no connection owner found.
563
	 */
564
	public function get_connection_owner_id() {
565
		$user_token       = $this->get_access_token( self::JETPACK_MASTER_USER );
566
		$connection_owner = false;
567
		if ( $user_token && is_object( $user_token ) && isset( $user_token->external_user_id ) ) {
568
			$connection_owner = $user_token->external_user_id;
569
		}
570
571
		return $connection_owner;
572
	}
573
574
	/**
575
	 * Returns an array of user_id's that have user tokens for communicating with wpcom.
@@ 639-648 (lines=10) @@
636
	 *
637
	 * @return object|false False if no connection owner found.
638
	 */
639
	public function get_connection_owner() {
640
		$user_token = $this->get_access_token( self::JETPACK_MASTER_USER );
641
642
		$connection_owner = false;
643
		if ( $user_token && is_object( $user_token ) && isset( $user_token->external_user_id ) ) {
644
			$connection_owner = get_userdata( $user_token->external_user_id );
645
		}
646
647
		return $connection_owner;
648
	}
649
650
	/**
651
	 * Returns true if the provided user is the Jetpack connection owner.
@@ 657-665 (lines=9) @@
654
	 * @param Integer|Boolean $user_id the user identifier. False for current user.
655
	 * @return Boolean True the user the connection owner, false otherwise.
656
	 */
657
	public function is_connection_owner( $user_id = false ) {
658
		if ( ! $user_id ) {
659
			$user_id = get_current_user_id();
660
		}
661
662
		$user_token = $this->get_access_token( self::JETPACK_MASTER_USER );
663
664
		return $user_token && is_object( $user_token ) && isset( $user_token->external_user_id ) && $user_id === $user_token->external_user_id;
665
	}
666
667
	/**
668
	 * Connects the user with a specified ID to a WordPress.com user using the