Code Duplication    Length = 18-20 lines in 2 locations

_inc/lib/admin-pages/class.jetpack-my-jetpack-page.php 1 location

@@ 110-129 (lines=20) @@
107
	 *
108
	 * @return array
109
	 */
110
	function jetpack_master_user_data() {
111
		// If the master user has disappeared, none of this is useful.
112
		// @todo throw up a warning and offer a solution
113
		$master = Jetpack_Options::get_option( 'master_user' );
114
		if ( ! get_user_by( 'id', $master ) ) {
115
			return false;
116
		}
117
118
		$master_user           = get_userdata( $master );
119
		$master_user_data_com  = Jetpack::get_connected_user_data( $master_user->ID );
120
		$gravatar              = sprintf( '<a href="%s">%s</a>', get_edit_user_link( $master_user->ID ), get_avatar( $master_user->ID, 40 ) );
121
122
		$master_user_data = array(
123
			'masterUser'     => $master_user,
124
			'masterDataCom'  => $master_user_data_com,
125
			'gravatar'       => $gravatar,
126
		);
127
128
		return $master_user_data;
129
	}
130
131
	/*
132
	 * All the data we'll need about the Current User

_inc/lib/admin-pages/class.jetpack-react-page.php 1 location

@@ 242-259 (lines=18) @@
239
 *
240
 * @return array
241
 */
242
function jetpack_master_user_data() {
243
	$masterID = Jetpack_Options::get_option( 'master_user' );
244
	if ( ! get_user_by( 'id', $masterID ) ) {
245
		return false;
246
	}
247
248
	$jetpack_user = get_userdata( $masterID );
249
	$wpcom_user   = Jetpack::get_connected_user_data( $jetpack_user->ID );
250
	$gravatar     = get_avatar( $jetpack_user->ID, 40 );
251
252
	$master_user_data = array(
253
		'jetpackUser' => $jetpack_user,
254
		'wpcomUser'   => $wpcom_user,
255
		'gravatar'    => $gravatar,
256
	);
257
258
	return $master_user_data;
259
}
260
261
/*
262
 * Gather data about the current user.