Code Duplication    Length = 9-9 lines in 2 locations

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

@@ 151-159 (lines=9) @@
148
		}
149
	}
150
151
	public function get_user( $user_id ) {
152
		$the_user = $this->get_author( $user_id, true );
153
		if ( $the_user && ! is_wp_error( $the_user ) ) {
154
			$userdata = get_userdata( $user_id );
155
			$the_user->roles = ! is_wp_error( $userdata ) ? array_values( $userdata->roles ) : array();
156
		}
157
158
		return $the_user;
159
	}
160
161
	/**
162
	 * Updates user data

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

@@ 64-72 (lines=9) @@
61
		return $this->get_user( $user->ID );
62
	}
63
64
	public function get_user( $user_id ) {
65
		$the_user = $this->get_author( $user_id, true );
66
		if ( $the_user && ! is_wp_error( $the_user ) ) {
67
			$userdata = get_userdata( $user_id );
68
			$the_user->roles = ! is_wp_error( $userdata ) ? $userdata->roles : array();
69
		}
70
71
		return $the_user;
72
	}
73
74
}
75