Code Duplication    Length = 15-15 lines in 2 locations

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

@@ 1449-1463 (lines=15) @@
1446
	 * @param bool $round (default: true).
1447
	 * @return float
1448
	 */
1449
	public function get_item_subtotal( $item, $inc_tax = false, $round = true ) {
1450
		$subtotal = 0;
1451
1452
		if ( is_callable( array( $item, 'get_subtotal' ) ) ) {
1453
			if ( $inc_tax ) {
1454
				$subtotal = ( $item->get_subtotal() + $item->get_subtotal_tax() ) / max( 1, $item->get_qty() );
1455
			} else {
1456
				$subtotal = ( $item->get_subtotal() / max( 1, $item->get_qty() ) );
1457
			}
1458
1459
			$subtotal = $round ? number_format( (float) $subtotal, wc_get_price_decimals(), '.', '' ) : $subtotal;
1460
		}
1461
1462
		return apply_filters( 'woocommerce_order_amount_item_subtotal', $subtotal, $this, $item, $inc_tax, $round );
1463
	}
1464
1465
	/**
1466
	 * Get line subtotal - this is the cost before discount.
@@ 1497-1511 (lines=15) @@
1494
	 * @param bool $round (default: true).
1495
	 * @return float
1496
	 */
1497
	public function get_item_total( $item, $inc_tax = false, $round = true ) {
1498
		$total = 0;
1499
1500
		if ( is_callable( array( $item, 'get_total' ) ) ) {
1501
			if ( $inc_tax ) {
1502
				$total = ( $item->get_total() + $item->get_total_tax() ) / max( 1, $item->get_qty() );
1503
			} else {
1504
				$total = $item->get_total() / max( 1, $item->get_qty() );
1505
			}
1506
1507
			$total = $round ? round( $total, wc_get_price_decimals() ) : $total;
1508
		}
1509
1510
		return apply_filters( 'woocommerce_order_amount_item_total', $total, $this, $item, $inc_tax, $round );
1511
	}
1512
1513
	/**
1514
	 * Calculate line total - useful for gateways.