Code Duplication    Length = 3-3 lines in 2 locations

includes/api/class-wc-rest-product-attributes-controller.php 1 location

@@ 638-640 (lines=3) @@
635
			return new WP_Error( 'woocommerce_rest_invalid_product_attribute_slug_too_long', sprintf( __( 'Slug "%s" is too long (28 characters max).', 'woocommerce' ), $slug ), array( 'status' => 400 ) );
636
		} elseif ( wc_check_if_attribute_name_is_reserved( $slug ) ) {
637
			return new WP_Error( 'woocommerce_rest_invalid_product_attribute_slug_reserved_name', sprintf( __( 'Slug "%s" is not allowed because it is a reserved term.', 'woocommerce' ), $slug ), array( 'status' => 400 ) );
638
		} elseif ( $new_data && taxonomy_exists( wc_attribute_taxonomy_name( $slug ) ) ) {
639
			return new WP_Error( 'woocommerce_rest_invalid_product_attribute_slug_already_exists', sprintf( __( 'Slug "%s" is already in use.', 'woocommerce' ), $slug ), array( 'status' => 400 ) );
640
		}
641
642
		return true;
643
	}

includes/wc-rest-functions.php 1 location

@@ 69-71 (lines=3) @@
66
67
	if ( is_wp_error( $response ) ) {
68
		return new WP_Error( 'woocommerce_rest_invalid_remote_image_url', sprintf( __( 'Error getting remote image %s.', 'woocommerce' ), $image_url ) . ' ' . sprintf( __( 'Error: %s.', 'woocommerce' ), $response->get_error_message() ), array( 'status' => 400 ) );
69
	} elseif ( 200 !== wp_remote_retrieve_response_code( $response ) ) {
70
		return new WP_Error( 'woocommerce_rest_invalid_remote_image_url', sprintf( __( 'Error getting remote image %s.', 'woocommerce' ), $image_url ), array( 'status' => 400 ) );
71
	}
72
73
	// Ensure we have a file name and type.
74
	if ( ! $wp_filetype['type'] ) {