Code Duplication    Length = 7-8 lines in 2 locations

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

@@ 340-347 (lines=8) @@
337
	 *
338
	 * @return bool|WP_Error True if user is able to disconnect the site.
339
	 */
340
	public static function connect_url_permission_callback() {
341
		if ( current_user_can( 'jetpack_connect_user' ) ) {
342
			return true;
343
		}
344
345
		return new WP_Error( 'invalid_user_permission_jetpack_disconnect', self::$user_permissions_error_msg, array( 'status' => self::rest_authorization_required_code() ) );
346
347
	}
348
349
	/**
350
	 * Verify that a user can get the data about the current user.
@@ 359-365 (lines=7) @@
356
	 *
357
	 * @return bool|WP_Error True if user is able to unlink.
358
	 */
359
	public static function get_user_connection_data_permission_callback() {
360
		if ( current_user_can( 'jetpack_connect_user' ) ) {
361
			return true;
362
		}
363
364
		return new WP_Error( 'invalid_user_permission_user_connection_data', self::$user_permissions_error_msg, array( 'status' => self::rest_authorization_required_code() ) );
365
	}
366
367
	/**
368
	 * Verify that a user can use the /connection/user endpoint. Has to be a registered user and be currently linked.