Code Duplication    Length = 15-15 lines in 2 locations

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

@@ 2423-2437 (lines=15) @@
2420
     * @param bool $round (default: true).
2421
     * @return float
2422
     */
2423
    public function get_item_subtotal( $item, $inc_tax = false, $round = true ) {
2424
        $subtotal = 0;
2425
2426
        if ( is_callable( array( $item, 'get_subtotal' ) ) ) {
2427
            if ( $inc_tax ) {
2428
                $subtotal = ( $item->get_subtotal() + $item->get_subtotal_tax() ) / max( 1, $item->get_qty() );
2429
            } else {
2430
                $subtotal = ( $item->get_subtotal() / max( 1, $item->get_qty() ) );
2431
            }
2432
2433
            $subtotal = $round ? number_format( (float) $subtotal, wc_get_price_decimals(), '.', '' ) : $subtotal;
2434
        }
2435
2436
        return apply_filters( 'woocommerce_order_amount_item_subtotal', $subtotal, $this, $item, $inc_tax, $round );
2437
    }
2438
2439
    /**
2440
     * Get line subtotal - this is the cost before discount.
@@ 2471-2485 (lines=15) @@
2468
     * @param bool $round (default: true).
2469
     * @return float
2470
     */
2471
    public function get_item_total( $item, $inc_tax = false, $round = true ) {
2472
        $total = 0;
2473
2474
        if ( is_callable( array( $item, 'get_total' ) ) ) {
2475
            if ( $inc_tax ) {
2476
                $total = ( $item->get_total() + $item->get_total_tax() ) / max( 1, $item->get_qty() );
2477
            } else {
2478
                $total = $item->get_total() / max( 1, $item->get_qty() );
2479
            }
2480
2481
            $total = $round ? round( $total, wc_get_price_decimals() ) : $total;
2482
        }
2483
2484
        return apply_filters( 'woocommerce_order_amount_item_total', $total, $this, $item, $inc_tax, $round );
2485
    }
2486
2487
    /**
2488
     * Calculate line total - useful for gateways.