Code Duplication    Length = 9-9 lines in 2 locations

includes/wpinv-invoice-functions.php 2 locations

@@ 567-575 (lines=9) @@
564
    $items              = $invoice->get_items();
565
    $invoice_currency   = $invoice->get_currency();
566
567
    if ( !empty( $items ) && is_array( $items ) ) {
568
        foreach ( $items as $key => $item ) {
569
            $items[$key]['currency'] = $invoice_currency;
570
571
            if ( !isset( $cart_item['subtotal'] ) ) {
572
                $items[$key]['subtotal'] = $items[$key]['amount'] * 1;
573
            }
574
        }
575
    }
576
577
    return apply_filters( 'wpinv_get_items', $items, $invoice_id );
578
}
@@ 1008-1016 (lines=9) @@
1005
1006
    $invoice_currency = $invoice->currency;
1007
1008
    if ( ! empty( $cart_details ) && is_array( $cart_details ) ) {
1009
        foreach ( $cart_details as $key => $cart_item ) {
1010
            $cart_details[ $key ]['currency'] = $invoice_currency;
1011
1012
            if ( ! isset( $cart_item['subtotal'] ) ) {
1013
                $cart_details[ $key ]['subtotal'] = $cart_item['price'];
1014
            }
1015
        }
1016
    }
1017
1018
    return apply_filters( 'wpinv_get_cart_details', $cart_details, $invoice_id );
1019
}