Code Duplication    Length = 3-3 lines in 4 locations

includes/wpinv-helper-functions.php 4 locations

@@ 54-56 (lines=3) @@
51
    if ( $decimal_sep == ',' && false !== ( $found = strpos( $amount, $decimal_sep ) ) ) {
52
        if ( ( $thousands_sep == '.' || $thousands_sep == ' ' ) && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) {
53
            $amount = str_replace( $thousands_sep, '', $amount );
54
        } elseif( empty( $thousands_sep ) && false !== ( $found = strpos( $amount, '.' ) ) ) {
55
            $amount = str_replace( '.', '', $amount );
56
        }
57
58
        $amount = str_replace( $decimal_sep, '.', $amount );
59
    } elseif( $thousands_sep == ',' && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) {
@@ 59-61 (lines=3) @@
56
        }
57
58
        $amount = str_replace( $decimal_sep, '.', $amount );
59
    } elseif( $thousands_sep == ',' && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) {
60
        $amount = str_replace( $thousands_sep, '', $amount );
61
    }
62
63
    if( $amount < 0 ) {
64
        $is_negative = true;
@@ 325-327 (lines=3) @@
322
        $amount = $whole . '.' . $part;
323
    }
324
325
    if ( $thousands_sep == ',' && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) {
326
        $amount = str_replace( ',', '', $amount );
327
    }
328
329
    if ( $thousands_sep == ' ' && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) {
330
        $amount = str_replace( ' ', '', $amount );
@@ 329-331 (lines=3) @@
326
        $amount = str_replace( ',', '', $amount );
327
    }
328
329
    if ( $thousands_sep == ' ' && false !== ( $found = strpos( $amount, $thousands_sep ) ) ) {
330
        $amount = str_replace( ' ', '', $amount );
331
    }
332
333
    if ( empty( $amount ) ) {
334
        $amount = 0;