Code Duplication    Length = 7-8 lines in 2 locations

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

@@ 364-371 (lines=8) @@
361
	 *
362
	 * @return bool|WP_Error True if user is able to disconnect the site.
363
	 */
364
	public static function connect_url_permission_callback() {
365
		if ( current_user_can( 'jetpack_connect_user' ) ) {
366
			return true;
367
		}
368
369
		return new WP_Error( 'invalid_user_permission_jetpack_disconnect', self::$user_permissions_error_msg, array( 'status' => self::rest_authorization_required_code() ) );
370
371
	}
372
373
	/**
374
	 * Verify that a user can get the data about the current user.
@@ 383-389 (lines=7) @@
380
	 *
381
	 * @return bool|WP_Error True if user is able to unlink.
382
	 */
383
	public static function get_user_connection_data_permission_callback() {
384
		if ( current_user_can( 'jetpack_connect_user' ) ) {
385
			return true;
386
		}
387
388
		return new WP_Error( 'invalid_user_permission_user_connection_data', self::$user_permissions_error_msg, array( 'status' => self::rest_authorization_required_code() ) );
389
	}
390
391
	/**
392
	 * Verify that a user can use the /connection/user endpoint. Has to be a registered user and be currently linked.