Code Duplication    Length = 13-15 lines in 2 locations

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

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