Code Duplication    Length = 7-8 lines in 3 locations

_inc/lib/class.core-rest-api-endpoints.php 3 locations

@@ 292-299 (lines=8) @@
289
	 *
290
	 * @return bool|WP_Error True if user is able to disconnect the site.
291
	 */
292
	public static function connect_url_permission_callback() {
293
		if ( current_user_can( 'jetpack_connect_user' ) ) {
294
			return true;
295
		}
296
297
		return new WP_Error( 'invalid_user_permission_jetpack_disconnect', self::$user_permissions_error_msg, array( 'status' => self::rest_authorization_required_code() ) );
298
299
	}
300
301
	/**
302
	 * Verify that a user can use the link endpoint.
@@ 308-314 (lines=7) @@
305
	 *
306
	 * @return bool|WP_Error True if user is able to link to WordPress.com
307
	 */
308
	public static function link_user_permission_callback() {
309
		if ( current_user_can( 'jetpack_connect_user' ) ) {
310
			return true;
311
		}
312
313
		return new WP_Error( 'invalid_user_permission_link_user', self::$user_permissions_error_msg, array( 'status' => self::rest_authorization_required_code() ) );
314
	}
315
316
	/**
317
	 * Verify that a user can get the data about the current user.
@@ 326-332 (lines=7) @@
323
	 *
324
	 * @return bool|WP_Error True if user is able to unlink.
325
	 */
326
	public static function get_user_connection_data_permission_callback() {
327
		if ( current_user_can( 'jetpack_connect_user' ) ) {
328
			return true;
329
		}
330
331
		return new WP_Error( 'invalid_user_permission_unlink_user', self::$user_permissions_error_msg, array( 'status' => self::rest_authorization_required_code() ) );
332
	}
333
334
	/**
335
	 * Verify that a user can use the unlink endpoint.