Code Duplication    Length = 3-3 lines in 2 locations

includes/vendor/wp-rest-functions.php 1 location

@@ 177-179 (lines=3) @@
174
			return new WP_Error( 'rest_invalid_param', sprintf( __( '%s is not of type %s', 'woocommerce' ), $param, 'integer' ) );
175
		}
176
177
		if ( 'string' === $args['type'] && ! is_string( $value ) ) {
178
			return new WP_Error( 'rest_invalid_param', sprintf( __( '%s is not of type %s', 'woocommerce' ), $param, 'string' ) );
179
		}
180
181
		if ( isset( $args['format'] ) ) {
182
			switch ( $args['format'] ) {

includes/wc-rest-functions.php 1 location

@@ 165-167 (lines=3) @@
162
	}
163
	$args = $attributes['args'][ $param ];
164
165
	if ( 'string' === $args['type'] && ! is_string( $value ) ) {
166
		return new WP_Error( 'woocommerce_rest_invalid_param', sprintf( __( '%1$s is not of type %2$s', 'woocommerce' ), $param, 'string' ) );
167
	}
168
169
	if ( 'date' === $args['format'] ) {
170
		$regex = '#^\d{4}-\d{2}-\d{2}$#';