Code Duplication    Length = 7-7 lines in 2 locations

includes/class-wc-checkout.php 2 locations

@@ 349-355 (lines=7) @@
346
			if ( apply_filters( 'woocommerce_checkout_update_customer_data', true, $this ) ) {
347
				$customer = new WC_Customer( $this->customer_id );
348
349
				if ( $keys = array_keys( $this->checkout_fields['billing'] ) ) {
350
					foreach ( $keys as $key ) {
351
						if ( is_callable( array( $customer, "set_{$key}" ) ) ) {
352
							$customer->{"set_{$key}"}( $this->get_posted_address_data( str_replace( array( 'billing_', 'shipping_' ), '', $key ) ) );
353
						}
354
					}
355
				}
356
357
				if ( WC()->cart->needs_shipping() && ( $keys = array_keys( $this->checkout_fields['shipping'] ) ) ) {
358
					foreach ( $keys as $key ) {
@@ 357-363 (lines=7) @@
354
					}
355
				}
356
357
				if ( WC()->cart->needs_shipping() && ( $keys = array_keys( $this->checkout_fields['shipping'] ) ) ) {
358
					foreach ( $keys as $key ) {
359
						if ( is_callable( array( $customer, "set_{$key}" ) ) ) {
360
							$customer->{"set_{$key}"}( $this->get_posted_address_data( str_replace( array( 'billing_', 'shipping_' ), '', $key ), 'shipping' ) );
361
						}
362
					}
363
				}
364
365
				$customer->save();
366
			}