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

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