Code Duplication    Length = 6-6 lines in 2 locations

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

@@ 373-378 (lines=6) @@
370
		switch ( $_SERVER['REQUEST_METHOD'] ) {
371
372
			case 'HEAD' :
373
			case 'GET' :
374
				if ( 'read' !== $permissions && 'read_write' !== $permissions ) {
375
					$wc_rest_authentication_error = new WP_Error( 'woocommerce_rest_authentication_error', __( 'The API key provided does not have read permissions.', 'woocommerce' ), array( 'status' => 401 ) );
376
					$valid = false;
377
				}
378
				break;
379
380
			case 'POST' :
381
			case 'PUT' :
@@ 383-388 (lines=6) @@
380
			case 'POST' :
381
			case 'PUT' :
382
			case 'PATCH' :
383
			case 'DELETE' :
384
				if ( 'write' !== $permissions && 'read_write' !== $permissions ) {
385
					$wc_rest_authentication_error = new WP_Error( 'woocommerce_rest_authentication_error', __( 'The API key provided does not have write permissions.', 'woocommerce' ), array( 'status' => 401 ) );
386
					$valid = false;
387
				}
388
				break;
389
		}
390
391
		return $valid;