Code Duplication    Length = 6-6 lines in 2 locations

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

@@ 495-500 (lines=6) @@
492
		switch ( $_SERVER['REQUEST_METHOD'] ) {
493
494
			case 'HEAD' :
495
			case 'GET' :
496
				if ( 'read' !== $permissions && 'read_write' !== $permissions ) {
497
					$wc_rest_authentication_error = new WP_Error( 'woocommerce_rest_authentication_error', __( 'The API key provided does not have read permissions.', 'woocommerce' ), array( 'status' => 401 ) );
498
					$valid = false;
499
				}
500
				break;
501
502
			case 'POST' :
503
			case 'PUT' :
@@ 505-510 (lines=6) @@
502
			case 'POST' :
503
			case 'PUT' :
504
			case 'PATCH' :
505
			case 'DELETE' :
506
				if ( 'write' !== $permissions && 'read_write' !== $permissions ) {
507
					$wc_rest_authentication_error = new WP_Error( 'woocommerce_rest_authentication_error', __( 'The API key provided does not have write permissions.', 'woocommerce' ), array( 'status' => 401 ) );
508
					$valid = false;
509
				}
510
				break;
511
		}
512
513
		return $valid;