Code Duplication    Length = 6-6 lines in 3 locations

includes/wpinv-template-functions.php 2 locations

@@ 1076-1081 (lines=6) @@
1073
                    
1074
                    $item_tax       = '';
1075
                    $tax_rate       = '';
1076
                    if ( $use_taxes && $cart_item['tax'] > 0 && $cart_item['subtotal'] > 0 ) {
1077
                        $item_tax = wpinv_price( wpinv_format_amount( $cart_item['tax'] ) );
1078
                        $tax_rate = !empty( $cart_item['vat_rate'] ) ? $cart_item['vat_rate'] : ( $cart_item['tax'] / $cart_item['subtotal'] ) * 100;
1079
                        $tax_rate = $tax_rate > 0 ? (float)wpinv_format_amount( $tax_rate, 2 ) : '';
1080
                        $tax_rate = $tax_rate != '' ? ' <small class="tax-rate">(' . $tax_rate . '%)</small>' : '';
1081
                    }
1082
                    
1083
                    $line_item_tax = $item_tax . $tax_rate;
1084
                    
@@ 1327-1332 (lines=6) @@
1324
        
1325
        $item_tax       = '';
1326
        $tax_rate       = '';
1327
        if ( $cart_item['tax'] > 0 && $cart_item['subtotal'] > 0 ) {
1328
            $item_tax = wpinv_price( wpinv_format_amount( $cart_item['tax'] ) );
1329
            $tax_rate = !empty( $cart_item['vat_rate'] ) ? $cart_item['vat_rate'] : ( $cart_item['tax'] / $cart_item['subtotal'] ) * 100;
1330
            $tax_rate = $tax_rate > 0 ? (float)wpinv_format_amount( $tax_rate, 2 ) : '';
1331
            $tax_rate = $tax_rate != '' ? ' <span class="tax-rate">(' . $tax_rate . '%)</span>' : '';
1332
        }
1333
        $line_item_tax = $item_tax . $tax_rate;
1334
        
1335
        if ( $line_item_tax === '' ) {

includes/wpinv-item-functions.php 1 location

@@ 461-466 (lines=6) @@
458
    $tax        = '';
459
    $tax_rate   = '';
460
    
461
    if ( isset( $item['tax'] ) && $item['tax'] > 0 && $item['subtotal'] > 0 ) {
462
        $tax      = wpinv_price( wpinv_format_amount( $item['tax'] ) );
463
        $tax_rate = !empty( $item['vat_rate'] ) ? $item['vat_rate'] : ( $item['tax'] / $item['subtotal'] ) * 100;
464
        $tax_rate = $tax_rate > 0 ? (float)wpinv_format_amount( $tax_rate, 2 ) : '';
465
        $tax_rate = $tax_rate != '' ? ' <small class="tax-rate normal small">(' . $tax_rate . '%)</small>' : '';
466
    }
467
    
468
    $tax        = $tax . $tax_rate;
469