Code Duplication    Length = 7-7 lines in 2 locations

includes/class-wc-checkout.php 2 locations

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