Code Duplication    Length = 3-3 lines in 4 locations

includes/wpinv-helper-functions.php 4 locations

@@ 56-58 (lines=3) @@
53
    if ( $decimal_sep == ',' && false !== ( $found = strpos( $amount, $decimal_sep ) ) ) {
54
        if ( ( $thousands_sep == '.' || $thousands_sep == ' ' ) && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) {
55
            $amount = str_replace( $thousands_sep, '', $amount );
56
        } elseif( empty( $thousands_sep ) && false !== ( $found = strpos( $amount, '.' ) ) ) {
57
            $amount = str_replace( '.', '', $amount );
58
        }
59
60
        $amount = str_replace( $decimal_sep, '.', $amount );
61
    } elseif( $thousands_sep == ',' && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) {
@@ 61-63 (lines=3) @@
58
        }
59
60
        $amount = str_replace( $decimal_sep, '.', $amount );
61
    } elseif( $thousands_sep == ',' && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) {
62
        $amount = str_replace( $thousands_sep, '', $amount );
63
    }
64
65
    if( $amount < 0 ) {
66
        $is_negative = true;
@@ 578-580 (lines=3) @@
575
        $amount = $whole . '.' . $part;
576
    }
577
578
    if ( $thousands_sep == ',' && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) {
579
        $amount = str_replace( ',', '', $amount );
580
    }
581
582
    if ( $thousands_sep == ' ' && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) {
583
        $amount = str_replace( ' ', '', $amount );
@@ 582-584 (lines=3) @@
579
        $amount = str_replace( ',', '', $amount );
580
    }
581
582
    if ( $thousands_sep == ' ' && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) {
583
        $amount = str_replace( ' ', '', $amount );
584
    }
585
586
    if ( empty( $amount ) ) {
587
        $amount = 0;