Code Duplication    Length = 6-6 lines in 2 locations

includes/wpinv-item-functions.php 1 location

@@ 428-433 (lines=6) @@
425
    $tax        = '';
426
    $tax_rate   = '';
427
    
428
    if ( isset( $item['tax'] ) && $item['tax'] > 0 && $item['subtotal'] > 0 ) {
429
        $tax      = wpinv_price( wpinv_format_amount( $item['tax'] ) );
430
        $tax_rate = !empty( $item['vat_rate'] ) ? $item['vat_rate'] : ( $item['tax'] / $item['subtotal'] ) * 100;
431
        $tax_rate = $tax_rate > 0 ? (float)wpinv_round_amount( $tax_rate, 4 ) : '';
432
        $tax_rate = $tax_rate != '' ? ' <small class="tax-rate normal small">(' . $tax_rate . '%)</small>' : '';
433
    }
434
    
435
    $tax        = $tax . $tax_rate;
436
    

includes/wpinv-template-functions.php 1 location

@@ 1045-1050 (lines=6) @@
1042
1043
                    $item_tax       = '';
1044
                    $tax_rate       = '';
1045
                    if ( $use_taxes && $cart_item['tax'] > 0 && $cart_item['subtotal'] > 0 ) {
1046
                        $item_tax = wpinv_price( wpinv_format_amount( $cart_item['tax'] ), $invoice->get_currency() );
1047
                        $tax_rate = !empty( $cart_item['vat_rate'] ) ? $cart_item['vat_rate'] : ( $cart_item['tax'] / $cart_item['subtotal'] ) * 100;
1048
                        $tax_rate = $tax_rate > 0 ? (float)wpinv_round_amount( $tax_rate, 4 ) : '';
1049
                        $tax_rate = $tax_rate != '' ? ' <small class="tax-rate">(' . $tax_rate . '%)</small>' : '';
1050
                    }
1051
1052
                    $line_item_tax = $item_tax . $tax_rate;
1053