Code Duplication    Length = 12-12 lines in 2 locations

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

@@ 863-874 (lines=12) @@
860
		$billing_state    = ! empty( $_POST['billing_state'] ) ? wc_clean( $_POST['billing_state'] ) : '';
861
		$shipping_state   = ! empty( $_POST['shipping_state'] ) ? wc_clean( $_POST['shipping_state'] ) : '';
862
863
		if ( $billing_state && $billing_country ) {
864
			$valid_states = WC()->countries->get_states( $billing_country );
865
866
			// Valid states found for country.
867
			if ( ! empty( $valid_states ) && is_array( $valid_states ) && sizeof( $valid_states ) > 0 ) {
868
				foreach ( $valid_states as $state_abbr => $state ) {
869
					if ( preg_match( '/' . preg_quote( $state ) . '/i', $billing_state ) ) {
870
						$_POST['billing_state'] = $state_abbr;
871
					}
872
				}
873
			}
874
		}
875
876
		if ( $shipping_state && $shipping_country ) {
877
			$valid_states = WC()->countries->get_states( $shipping_country );
@@ 876-887 (lines=12) @@
873
			}
874
		}
875
876
		if ( $shipping_state && $shipping_country ) {
877
			$valid_states = WC()->countries->get_states( $shipping_country );
878
879
			// Valid states found for country.
880
			if ( ! empty( $valid_states ) && is_array( $valid_states ) && sizeof( $valid_states ) > 0 ) {
881
				foreach ( $valid_states as $state_abbr => $state ) {
882
					if ( preg_match( '/' . preg_quote( $state ) . '/i', $shipping_state ) ) {
883
						$_POST['shipping_state'] = $state_abbr;
884
					}
885
				}
886
			}
887
		}
888
	}
889
890
	/**