Code Duplication    Length = 6-6 lines in 2 locations

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

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