| @@ 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'] ) { |
|
| @@ 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}$#'; |
|