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

@@ 364-381 (lines=18) @@
361
 *
362
 * @return array
363
 */
364
function jetpack_master_user_data() {
365
	$masterID = Jetpack_Options::get_option( 'master_user' );
366
	if ( ! get_user_by( 'id', $masterID ) ) {
367
		return false;
368
	}
369
370
	$jetpack_user = get_userdata( $masterID );
371
	$wpcom_user   = Jetpack::get_connected_user_data( $jetpack_user->ID );
372
	$gravatar     = get_avatar( $jetpack_user->ID, 40 );
373
374
	$master_user_data = array(
375
		'jetpackUser' => $jetpack_user,
376
		'wpcomUser'   => $wpcom_user,
377
		'gravatar'    => $gravatar,
378
	);
379
380
	return $master_user_data;
381
}
382
383
/**
384
 * Gather data about the current user.