Code Duplication    Length = 7-7 lines in 2 locations

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

@@ 232-238 (lines=7) @@
229
230
						$coupon->set_code( $coupon_code );
231
						break;
232
					case 'meta_data' :
233
						if ( is_array( $value ) ) {
234
							foreach ( $value as $meta ) {
235
								$coupon->update_meta_data( $meta['key'], $meta['value'], $meta['id'] );
236
							}
237
						}
238
						break;
239
					case 'description' :
240
						$coupon->set_description( wp_filter_post_kses( $value ) );
241
						break;

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

@@ 365-371 (lines=7) @@
362
							}
363
						}
364
						break;
365
					case 'meta_data' :
366
						if ( is_array( $value ) ) {
367
							foreach ( $value as $meta ) {
368
								$order->update_meta_data( $meta['key'], $meta['value'], $meta['id'] );
369
							}
370
						}
371
						break;
372
					default :
373
						if ( is_callable( array( $order, "set_{$key}" ) ) ) {
374
							$order->{"set_{$key}"}( $value );