Code Duplication    Length = 7-8 lines in 3 locations

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

@@ 280-287 (lines=8) @@
277
	 *
278
	 * @return bool|WP_Error True if user is able to disconnect the site.
279
	 */
280
	public static function connect_url_permission_callback() {
281
		if ( current_user_can( 'jetpack_connect_user' ) ) {
282
			return true;
283
		}
284
285
		return new WP_Error( 'invalid_user_permission_jetpack_disconnect', self::$user_permissions_error_msg, array( 'status' => self::rest_authorization_required_code() ) );
286
287
	}
288
289
	/**
290
	 * Verify that a user can use the link endpoint.
@@ 296-302 (lines=7) @@
293
	 *
294
	 * @return bool|WP_Error True if user is able to link to WordPress.com
295
	 */
296
	public static function link_user_permission_callback() {
297
		if ( current_user_can( 'jetpack_connect_user' ) ) {
298
			return true;
299
		}
300
301
		return new WP_Error( 'invalid_user_permission_link_user', self::$user_permissions_error_msg, array( 'status' => self::rest_authorization_required_code() ) );
302
	}
303
304
	/**
305
	 * Verify that a user can get the data about the current user.
@@ 314-320 (lines=7) @@
311
	 *
312
	 * @return bool|WP_Error True if user is able to unlink.
313
	 */
314
	public static function get_user_connection_data_permission_callback() {
315
		if ( current_user_can( 'jetpack_connect_user' ) ) {
316
			return true;
317
		}
318
319
		return new WP_Error( 'invalid_user_permission_unlink_user', self::$user_permissions_error_msg, array( 'status' => self::rest_authorization_required_code() ) );
320
	}
321
322
	/**
323
	 * Verify that a user can use the unlink endpoint.