Code Duplication    Length = 12-12 lines in 2 locations

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

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