Code Duplication    Length = 15-15 lines in 2 locations

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

@@ 1466-1480 (lines=15) @@
1463
	 * @param bool $round (default: true).
1464
	 * @return float
1465
	 */
1466
	public function get_item_subtotal( $item, $inc_tax = false, $round = true ) {
1467
		$subtotal = 0;
1468
1469
		if ( is_callable( array( $item, 'get_subtotal' ) ) ) {
1470
			if ( $inc_tax ) {
1471
				$subtotal = ( $item->get_subtotal() + $item->get_subtotal_tax() ) / max( 1, $item->get_qty() );
1472
			} else {
1473
				$subtotal = ( $item->get_subtotal() / max( 1, $item->get_qty() ) );
1474
			}
1475
1476
			$subtotal = $round ? number_format( (float) $subtotal, wc_get_price_decimals(), '.', '' ) : $subtotal;
1477
		}
1478
1479
		return apply_filters( 'woocommerce_order_amount_item_subtotal', $subtotal, $this, $item, $inc_tax, $round );
1480
	}
1481
1482
	/**
1483
	 * Get line subtotal - this is the cost before discount.
@@ 1514-1528 (lines=15) @@
1511
	 * @param bool $round (default: true).
1512
	 * @return float
1513
	 */
1514
	public function get_item_total( $item, $inc_tax = false, $round = true ) {
1515
		$total = 0;
1516
1517
		if ( is_callable( array( $item, 'get_total' ) ) ) {
1518
			if ( $inc_tax ) {
1519
				$total = ( $item->get_total() + $item->get_total_tax() ) / max( 1, $item->get_qty() );
1520
			} else {
1521
				$total = $item->get_total() / max( 1, $item->get_qty() );
1522
			}
1523
1524
			$total = $round ? round( $total, wc_get_price_decimals() ) : $total;
1525
		}
1526
1527
		return apply_filters( 'woocommerce_order_amount_item_total', $total, $this, $item, $inc_tax, $round );
1528
	}
1529
1530
	/**
1531
	 * Calculate line total - useful for gateways.