Code Duplication    Length = 13-15 lines in 2 locations

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

@@ 1322-1336 (lines=15) @@
1319
	 * @param bool $round (default: true).
1320
	 * @return float
1321
	 */
1322
	public function get_line_subtotal( $item, $inc_tax = false, $round = true ) {
1323
		$subtotal = 0;
1324
1325
		if ( is_callable( array( $item, 'get_subtotal' ) ) ) {
1326
			if ( $inc_tax ) {
1327
				$subtotal = $item->get_subtotal() + $item->get_subtotal_tax();
1328
			} else {
1329
				$subtotal = $item->get_subtotal();
1330
			}
1331
1332
			$subtotal = $round ? round( $subtotal, wc_get_price_decimals() ) : $subtotal;
1333
		}
1334
1335
		return apply_filters( 'woocommerce_order_amount_line_subtotal', $subtotal, $this, $item, $inc_tax, $round );
1336
	}
1337
1338
	/**
1339
	 * Calculate item cost - useful for gateways.
@@ 1370-1382 (lines=13) @@
1367
	 * @param bool $round (default: true).
1368
	 * @return float
1369
	 */
1370
	public function get_line_total( $item, $inc_tax = false, $round = true ) {
1371
		$total = 0;
1372
1373
		if ( is_callable( array( $item, 'get_total' ) ) ) {
1374
			// Check if we need to add line tax to the line total.
1375
			$total = $inc_tax ? $item->get_total() + $item->get_total_tax() : $item->get_total();
1376
1377
			// Check if we need to round.
1378
			$total = $round ? round( $total, wc_get_price_decimals() ) : $total;
1379
		}
1380
1381
		return apply_filters( 'woocommerce_order_amount_line_total', $total, $this, $item, $inc_tax, $round );
1382
	}
1383
1384
	/**
1385
	 * Get item tax - useful for gateways.