Code Duplication    Length = 5-5 lines in 2 locations

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

@@ 163-167 (lines=5) @@
160
		if ( isset( $request['settings'] ) ) {
161
			$gateway->init_form_fields();
162
			$settings = $gateway->settings;
163
			foreach ( $gateway->form_fields as $key => $field ) {
164
				if ( isset( $request['settings'][ $key ] ) ) {
165
					$settings[ $key ] = $request['settings'][ $key ];
166
				}
167
			}
168
			$gateway->settings = $settings;
169
			update_option( $gateway->get_option_key(), apply_filters( 'woocommerce_gateway_' . $gateway->id . '_settings_values', $settings, $gateway ) );
170
		}

includes/api/class-wc-rest-shipping-zone-methods-controller.php 1 location

@@ 267-271 (lines=5) @@
264
		if ( isset( $request['settings'] ) ) {
265
			$method->init_instance_settings();
266
			$instance_settings = $method->instance_settings;
267
			foreach ( $method->get_instance_form_fields() as $key => $field ) {
268
				if ( isset( $request['settings'][ $key ] ) ) {
269
					$instance_settings[ $key ] = $request['settings'][ $key ];
270
				}
271
			}
272
			update_option( $method->get_instance_option_key(), apply_filters( 'woocommerce_shipping_' . $method->id . '_instance_settings_values', $instance_settings, $method ) );
273
		}
274