Code Duplication    Length = 7-7 lines in 2 locations

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 );

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

@@ 248-254 (lines=7) @@
245
246
						$coupon->set_code( $coupon_code );
247
						break;
248
					case 'meta_data' :
249
						if ( is_array( $value ) ) {
250
							foreach ( $value as $meta ) {
251
								$coupon->update_meta_data( $meta['key'], $meta['value'], $meta['id'] );
252
							}
253
						}
254
						break;
255
					case 'description' :
256
						$coupon->set_description( wp_filter_post_kses( $value ) );
257
						break;