Code Duplication    Length = 9-9 lines in 2 locations

json-endpoints/class.wpcom-json-api-site-user-endpoint.php 1 location

@@ 53-61 (lines=9) @@
50
		}
51
	}
52
53
	public function get_user( $user_id ) {
54
		$the_user = $this->get_author( $user_id, true );
55
		if ( $the_user && ! is_wp_error( $the_user ) ) {
56
			$userdata = get_userdata( $user_id );
57
			$the_user->roles = ! is_wp_error( $userdata ) ? array_values( $userdata->roles ) : array();
58
		}
59
60
		return $the_user;
61
	}
62
63
	/**
64
	 * Updates user data

json-endpoints/jetpack/class.jetpack-json-api-user-create-endpoint.php 1 location

@@ 51-59 (lines=9) @@
48
		return $this->get_user( $user->ID );
49
	}
50
51
	public function get_user( $user_id ) {
52
		$the_user = $this->get_author( $user_id, true );
53
		if ( $the_user && ! is_wp_error( $the_user ) ) {
54
			$userdata = get_userdata( $user_id );
55
			$the_user->roles = ! is_wp_error( $userdata ) ? $userdata->roles : array();
56
		}
57
58
		return $the_user;
59
	}
60
61
}
62