Code Duplication    Length = 12-12 lines in 2 locations

includes/payment-methods/class-wc-stripe-payment-request.php 2 locations

@@ 961-972 (lines=12) @@
958
		$billing_state    = ! empty( $_POST['billing_state'] ) ? wc_clean( $_POST['billing_state'] ) : '';
959
		$shipping_state   = ! empty( $_POST['shipping_state'] ) ? wc_clean( $_POST['shipping_state'] ) : '';
960
961
		if ( $billing_state && $billing_country ) {
962
			$valid_states = WC()->countries->get_states( $billing_country );
963
964
			// Valid states found for country.
965
			if ( ! empty( $valid_states ) && is_array( $valid_states ) && sizeof( $valid_states ) > 0 ) {
966
				foreach ( $valid_states as $state_abbr => $state ) {
967
					if ( preg_match( '/' . preg_quote( $state ) . '/i', $billing_state ) ) {
968
						$_POST['billing_state'] = $state_abbr;
969
					}
970
				}
971
			}
972
		}
973
974
		if ( $shipping_state && $shipping_country ) {
975
			$valid_states = WC()->countries->get_states( $shipping_country );
@@ 974-985 (lines=12) @@
971
			}
972
		}
973
974
		if ( $shipping_state && $shipping_country ) {
975
			$valid_states = WC()->countries->get_states( $shipping_country );
976
977
			// Valid states found for country.
978
			if ( ! empty( $valid_states ) && is_array( $valid_states ) && sizeof( $valid_states ) > 0 ) {
979
				foreach ( $valid_states as $state_abbr => $state ) {
980
					if ( preg_match( '/' . preg_quote( $state ) . '/i', $shipping_state ) ) {
981
						$_POST['shipping_state'] = $state_abbr;
982
					}
983
				}
984
			}
985
		}
986
	}
987
988
	/**