Code Duplication    Length = 15-15 lines in 2 locations

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

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