Code Duplication    Length = 9-9 lines in 2 locations

includes/wpinv-invoice-functions.php 2 locations

@@ 338-346 (lines=9) @@
335
    $items              = $invoice->get_items();
336
    $invoice_currency   = $invoice->get_currency();
337
338
    if ( !empty( $items ) && is_array( $items ) ) {
339
        foreach ( $items as $key => $item ) {
340
            $items[$key]['currency'] = $invoice_currency;
341
342
            if ( !isset( $cart_item['subtotal'] ) ) {
343
                $items[$key]['subtotal'] = $items[$key]['amount'] * 1;
344
            }
345
        }
346
    }
347
348
    return apply_filters( 'wpinv_get_items', $items, $invoice_id );
349
}
@@ 779-787 (lines=9) @@
776
777
    $invoice_currency = $invoice->currency;
778
779
    if ( ! empty( $cart_details ) && is_array( $cart_details ) ) {
780
        foreach ( $cart_details as $key => $cart_item ) {
781
            $cart_details[ $key ]['currency'] = $invoice_currency;
782
783
            if ( ! isset( $cart_item['subtotal'] ) ) {
784
                $cart_details[ $key ]['subtotal'] = $cart_item['price'];
785
            }
786
        }
787
    }
788
789
    return apply_filters( 'wpinv_get_cart_details', $cart_details, $invoice_id );
790
}