Code Duplication    Length = 7-7 lines in 2 locations

includes/class-wc-checkout.php 2 locations

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