Code Duplication    Length = 12-12 lines in 2 locations

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

@@ 845-856 (lines=12) @@
842
		$billing_state    = ! empty( $_POST['billing_state'] ) ? wc_clean( $_POST['billing_state'] ) : '';
843
		$shipping_state   = ! empty( $_POST['shipping_state'] ) ? wc_clean( $_POST['shipping_state'] ) : '';
844
845
		if ( $billing_state && $billing_country ) {
846
			$valid_states = WC()->countries->get_states( $billing_country );
847
848
			// Valid states found for country.
849
			if ( ! empty( $valid_states ) && is_array( $valid_states ) && sizeof( $valid_states ) > 0 ) {
850
				foreach ( $valid_states as $state_abbr => $state ) {
851
					if ( preg_match( '/' . preg_quote( $state ) . '/i', $billing_state ) ) {
852
						$_POST['billing_state'] = $state_abbr;
853
					}
854
				}
855
			}
856
		}
857
858
		if ( $shipping_state && $shipping_country ) {
859
			$valid_states = WC()->countries->get_states( $shipping_country );
@@ 858-869 (lines=12) @@
855
			}
856
		}
857
858
		if ( $shipping_state && $shipping_country ) {
859
			$valid_states = WC()->countries->get_states( $shipping_country );
860
861
			// Valid states found for country.
862
			if ( ! empty( $valid_states ) && is_array( $valid_states ) && sizeof( $valid_states ) > 0 ) {
863
				foreach ( $valid_states as $state_abbr => $state ) {
864
					if ( preg_match( '/' . preg_quote( $state ) . '/i', $shipping_state ) ) {
865
						$_POST['shipping_state'] = $state_abbr;
866
					}
867
				}
868
			}
869
		}
870
	}
871
872
	/**