Code Duplication    Length = 15-15 lines in 2 locations

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

@@ 105-119 (lines=15) @@
102
			return new WP_Error( 'rest_invalid_param', sprintf( __( '%s is not of type %s' ), $param, 'string' ) );
103
		}
104
105
		if ( isset( $args['format'] ) ) {
106
			switch ( $args['format'] ) {
107
				case 'date-time' :
108
					if ( ! rest_parse_date( $value ) ) {
109
						return new WP_Error( 'rest_invalid_date', __( 'The date you provided is invalid.' ) );
110
					}
111
					break;
112
113
				case 'email' :
114
					if ( ! is_email( $value ) ) {
115
						return new WP_Error( 'rest_invalid_email', __( 'The email address you provided is invalid.' ) );
116
					}
117
					break;
118
			}
119
		}
120
121
		if ( in_array( $args['type'], array( 'numeric', 'integer' ) ) && ( isset( $args['minimum'] ) || isset( $args['maximum'] ) ) ) {
122
			if ( isset( $args['minimum'] ) && ! isset( $args['maximum'] ) ) {

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

@@ 181-195 (lines=15) @@
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'] ) {
183
				case 'date-time' :
184
					if ( ! rest_parse_date( $value ) ) {
185
						return new WP_Error( 'rest_invalid_date', __( 'The date you provided is invalid.', 'woocommerce' ) );
186
					}
187
					break;
188
189
				case 'email' :
190
					if ( ! is_email( $value ) ) {
191
						return new WP_Error( 'rest_invalid_email', __( 'The email address you provided is invalid.', 'woocommerce' ) );
192
					}
193
					break;
194
			}
195
		}
196
197
		if ( in_array( $args['type'], array( 'numeric', 'integer' ) ) && ( isset( $args['minimum'] ) || isset( $args['maximum'] ) ) ) {
198
			if ( isset( $args['minimum'] ) && ! isset( $args['maximum'] ) ) {