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

@@ 239-245 (lines=7) @@
236
237
						$coupon->set_code( $coupon_code );
238
						break;
239
					case 'meta_data' :
240
						if ( is_array( $value ) ) {
241
							foreach ( $value as $meta ) {
242
								$coupon->update_meta_data( $meta['key'], $meta['value'], $meta['id'] );
243
							}
244
						}
245
						break;
246
					case 'description' :
247
						$coupon->set_description( wp_filter_post_kses( $value ) );
248
						break;