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

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