Code Duplication    Length = 9-9 lines in 2 locations

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 );

includes/wpinv-gateway-functions.php 1 location

@@ 723-731 (lines=9) @@
720
    // Convert collected post data to an array
721
    parse_str( $encoded_data, $data );
722
723
    foreach ( $data as $key => $value ) {
724
        if ( false !== strpos( $key, 'amp;' ) ) {
725
            $new_key = str_replace( '&', '&', $key );
726
            $new_key = str_replace( 'amp;', '&' , $new_key );
727
728
            unset( $data[ $key ] );
729
            $data[ $new_key ] = sanitize_text_field( $value );
730
        }
731
    }
732
    
733
    return $data;
734
}