Code Duplication    Length = 13-15 lines in 2 locations

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

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