Code Duplication    Length = 6-6 lines in 2 locations

includes/api/class-wc-rest-authentication.php 2 locations

@@ 354-359 (lines=6) @@
351
		switch ( $_SERVER['REQUEST_METHOD'] ) {
352
353
			case 'HEAD' :
354
			case 'GET' :
355
				if ( 'read' !== $permissions && 'read_write' !== $permissions ) {
356
					$wc_rest_authentication_error = new WP_Error( 'woocommerce_rest_authentication_error', __( 'The API key provided does not have read permissions.', 'woocommerce' ), array( 'status' => 401 ) );
357
					$valid = false;
358
				}
359
				break;
360
361
			case 'POST' :
362
			case 'PUT' :
@@ 364-369 (lines=6) @@
361
			case 'POST' :
362
			case 'PUT' :
363
			case 'PATCH' :
364
			case 'DELETE' :
365
				if ( 'write' !== $permissions && 'read_write' !== $permissions ) {
366
					$wc_rest_authentication_error = new WP_Error( 'woocommerce_rest_authentication_error', __( 'The API key provided does not have write permissions.', 'woocommerce' ), array( 'status' => 401 ) );
367
					$valid = false;
368
				}
369
				break;
370
		}
371
372
		return $valid;