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

@@ 223-240 (lines=18) @@
220
 *
221
 * @return array
222
 */
223
function jetpack_master_user_data() {
224
	$masterID = Jetpack_Options::get_option( 'master_user' );
225
	if ( ! get_user_by( 'id', $masterID ) ) {
226
		return false;
227
	}
228
229
	$jetpack_user = get_userdata( $masterID );
230
	$wpcom_user   = Jetpack::get_connected_user_data( $jetpack_user->ID );
231
	$gravatar     = get_avatar( $jetpack_user->ID, 40 );
232
233
	$master_user_data = array(
234
		'jetpackUser' => $jetpack_user,
235
		'wpcomUser'   => $wpcom_user,
236
		'gravatar'    => $gravatar,
237
	);
238
239
	return $master_user_data;
240
}
241
242
/*
243
 * Gather data about the current user.