Code Duplication    Length = 9-9 lines in 2 locations

includes/wpinv-gateway-functions.php 1 location

@@ 746-754 (lines=9) @@
743
    // Convert collected post data to an array
744
    parse_str( $encoded_data, $data );
745
746
    foreach ( $data as $key => $value ) {
747
        if ( false !== strpos( $key, 'amp;' ) ) {
748
            $new_key = str_replace( '&', '&', $key );
749
            $new_key = str_replace( 'amp;', '&' , $new_key );
750
751
            unset( $data[ $key ] );
752
            $data[ $new_key ] = sanitize_text_field( $value );
753
        }
754
    }
755
    
756
    return $data;
757
}

includes/gateways/paypal.php 1 location

@@ 263-271 (lines=9) @@
260
	// Convert collected post data to an array
261
	parse_str( $encoded_data, $encoded_data_array );
262
263
	foreach ( $encoded_data_array as $key => $value ) {
264
		if ( false !== strpos( $key, 'amp;' ) ) {
265
			$new_key = str_replace( '&', '&', $key );
266
			$new_key = str_replace( 'amp;', '&' , $new_key );
267
268
			unset( $encoded_data_array[ $key ] );
269
			$encoded_data_array[ $new_key ] = $value;
270
		}
271
	}
272
273
	// Get the PayPal redirect uri
274
	$paypal_redirect = wpinv_get_paypal_redirect( true );