Code Duplication    Length = 13-15 lines in 2 locations

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

@@ 1470-1484 (lines=15) @@
1467
	 * @param bool $round (default: true).
1468
	 * @return float
1469
	 */
1470
	public function get_line_subtotal( $item, $inc_tax = false, $round = true ) {
1471
		$subtotal = 0;
1472
1473
		if ( is_callable( array( $item, 'get_subtotal' ) ) ) {
1474
			if ( $inc_tax ) {
1475
				$subtotal = $item->get_subtotal() + $item->get_subtotal_tax();
1476
			} else {
1477
				$subtotal = $item->get_subtotal();
1478
			}
1479
1480
			$subtotal = $round ? round( $subtotal, wc_get_price_decimals() ) : $subtotal;
1481
		}
1482
1483
		return apply_filters( 'woocommerce_order_amount_line_subtotal', $subtotal, $this, $item, $inc_tax, $round );
1484
	}
1485
1486
	/**
1487
	 * Calculate item cost - useful for gateways.
@@ 1518-1530 (lines=13) @@
1515
	 * @param bool $round (default: true).
1516
	 * @return float
1517
	 */
1518
	public function get_line_total( $item, $inc_tax = false, $round = true ) {
1519
		$total = 0;
1520
1521
		if ( is_callable( array( $item, 'get_total' ) ) ) {
1522
			// Check if we need to add line tax to the line total.
1523
			$total = $inc_tax ? $item->get_total() + $item->get_total_tax() : $item->get_total();
1524
1525
			// Check if we need to round.
1526
			$total = $round ? round( $total, wc_get_price_decimals() ) : $total;
1527
		}
1528
1529
		return apply_filters( 'woocommerce_order_amount_line_total', $total, $this, $item, $inc_tax, $round );
1530
	}
1531
1532
	/**
1533
	 * Get item tax - useful for gateways.