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;
@@ 577-579 (lines=3) @@
574
        $amount = $whole . '.' . $part;
575
    }
576
577
    if ( $thousands_sep == ',' && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) {
578
        $amount = str_replace( ',', '', $amount );
579
    }
580
581
    if ( $thousands_sep == ' ' && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) {
582
        $amount = str_replace( ' ', '', $amount );
@@ 581-583 (lines=3) @@
578
        $amount = str_replace( ',', '', $amount );
579
    }
580
581
    if ( $thousands_sep == ' ' && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) {
582
        $amount = str_replace( ' ', '', $amount );
583
    }
584
585
    if ( empty( $amount ) ) {
586
        $amount = 0;