Code Duplication    Length = 6-6 lines in 3 locations

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
    

includes/wpinv-template-functions.php 2 locations

@@ 1083-1088 (lines=6) @@
1080
                    
1081
                    $item_tax       = '';
1082
                    $tax_rate       = '';
1083
                    if ( $use_taxes && $cart_item['tax'] > 0 && $cart_item['subtotal'] > 0 ) {
1084
                        $item_tax = wpinv_price( wpinv_format_amount( $cart_item['tax'] ) );
1085
                        $tax_rate = !empty( $cart_item['vat_rate'] ) ? $cart_item['vat_rate'] : ( $cart_item['tax'] / $cart_item['subtotal'] ) * 100;
1086
                        $tax_rate = $tax_rate > 0 ? (float)wpinv_format_amount( $tax_rate, 2 ) : '';
1087
                        $tax_rate = $tax_rate != '' ? ' <small class="tax-rate">(' . $tax_rate . '%)</small>' : '';
1088
                    }
1089
                    
1090
                    $line_item_tax = $item_tax . $tax_rate;
1091
                    
@@ 1334-1339 (lines=6) @@
1331
        
1332
        $item_tax       = '';
1333
        $tax_rate       = '';
1334
        if ( $cart_item['tax'] > 0 && $cart_item['subtotal'] > 0 ) {
1335
            $item_tax = wpinv_price( wpinv_format_amount( $cart_item['tax'] ) );
1336
            $tax_rate = !empty( $cart_item['vat_rate'] ) ? $cart_item['vat_rate'] : ( $cart_item['tax'] / $cart_item['subtotal'] ) * 100;
1337
            $tax_rate = $tax_rate > 0 ? (float)wpinv_format_amount( $tax_rate, 2 ) : '';
1338
            $tax_rate = $tax_rate != '' ? ' <span class="tax-rate">(' . $tax_rate . '%)</span>' : '';
1339
        }
1340
        $line_item_tax = $item_tax . $tax_rate;
1341
        
1342
        if ( $line_item_tax === '' ) {