Code Duplication    Length = 9-9 lines in 2 locations

includes/wpinv-invoice-functions.php 2 locations

@@ 110-118 (lines=9) @@
107
    $items              = $invoice->get_items();
108
    $invoice_currency   = $invoice->get_currency();
109
110
    if ( !empty( $items ) && is_array( $items ) ) {
111
        foreach ( $items as $key => $item ) {
112
            $items[$key]['currency'] = $invoice_currency;
113
114
            if ( !isset( $cart_item['subtotal'] ) ) {
115
                $items[$key]['subtotal'] = $items[$key]['amount'] * 1;
116
            }
117
        }
118
    }
119
120
    return apply_filters( 'wpinv_get_items', $items, $invoice_id );
121
}
@@ 546-554 (lines=9) @@
543
544
    $invoice_currency = $invoice->currency;
545
546
    if ( ! empty( $cart_details ) && is_array( $cart_details ) ) {
547
        foreach ( $cart_details as $key => $cart_item ) {
548
            $cart_details[ $key ]['currency'] = $invoice_currency;
549
550
            if ( ! isset( $cart_item['subtotal'] ) ) {
551
                $cart_details[ $key ]['subtotal'] = $cart_item['price'];
552
            }
553
        }
554
    }
555
556
    return apply_filters( 'wpinv_get_cart_details', $cart_details, $invoice_id );
557
}