Code Duplication    Length = 13-15 lines in 2 locations

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

@@ 1400-1414 (lines=15) @@
1397
	 * @param bool $round (default: true).
1398
	 * @return float
1399
	 */
1400
	public function get_line_subtotal( $item, $inc_tax = false, $round = true ) {
1401
		$subtotal = 0;
1402
1403
		if ( is_callable( array( $item, 'get_subtotal' ) ) ) {
1404
			if ( $inc_tax ) {
1405
				$subtotal = $item->get_subtotal() + $item->get_subtotal_tax();
1406
			} else {
1407
				$subtotal = $item->get_subtotal();
1408
			}
1409
1410
			$subtotal = $round ? round( $subtotal, wc_get_price_decimals() ) : $subtotal;
1411
		}
1412
1413
		return apply_filters( 'woocommerce_order_amount_line_subtotal', $subtotal, $this, $item, $inc_tax, $round );
1414
	}
1415
1416
	/**
1417
	 * Calculate item cost - useful for gateways.
@@ 1448-1460 (lines=13) @@
1445
	 * @param bool $round (default: true).
1446
	 * @return float
1447
	 */
1448
	public function get_line_total( $item, $inc_tax = false, $round = true ) {
1449
		$total = 0;
1450
1451
		if ( is_callable( array( $item, 'get_total' ) ) ) {
1452
			// Check if we need to add line tax to the line total.
1453
			$total = $inc_tax ? $item->get_total() + $item->get_total_tax() : $item->get_total();
1454
1455
			// Check if we need to round.
1456
			$total = $round ? round( $total, wc_get_price_decimals() ) : $total;
1457
		}
1458
1459
		return apply_filters( 'woocommerce_order_amount_line_total', $total, $this, $item, $inc_tax, $round );
1460
	}
1461
1462
	/**
1463
	 * Get item tax - useful for gateways.