Code Duplication    Length = 13-15 lines in 2 locations

includes/abstracts/abstract-wc-order.php 2 locations

@@ 2379-2393 (lines=15) @@
2376
     * @param bool $round (default: true).
2377
     * @return float
2378
     */
2379
    public function get_line_subtotal( $item, $inc_tax = false, $round = true ) {
2380
        $subtotal = 0;
2381
2382
        if ( is_callable( array( $item, 'get_subtotal' ) ) ) {
2383
            if ( $inc_tax ) {
2384
                $subtotal = $item->get_subtotal() + $item->get_subtotal_tax();
2385
            } else {
2386
                $subtotal = $item->get_subtotal();
2387
            }
2388
2389
            $subtotal = $round ? round( $subtotal, wc_get_price_decimals() ) : $subtotal;
2390
        }
2391
2392
        return apply_filters( 'woocommerce_order_amount_line_subtotal', $subtotal, $this, $item, $inc_tax, $round );
2393
    }
2394
2395
    /**
2396
     * Calculate item cost - useful for gateways.
@@ 2427-2439 (lines=13) @@
2424
     * @param bool $round (default: true).
2425
     * @return float
2426
     */
2427
    public function get_line_total( $item, $inc_tax = false, $round = true ) {
2428
        $total = 0;
2429
2430
        if ( is_callable( array( $item, 'get_total' ) ) ) {
2431
            // Check if we need to add line tax to the line total.
2432
            $total = $inc_tax ? $item->get_total() + $item->get_total_tax() : $item->get_total();
2433
2434
            // Check if we need to round.
2435
            $total = $round ? round( $total, wc_get_price_decimals() ) : $total;
2436
        }
2437
2438
        return apply_filters( 'woocommerce_order_amount_line_total', $total, $this, $item, $inc_tax, $round );
2439
    }
2440
2441
    /**
2442
     * Get item tax - useful for gateways.