Code Duplication    Length = 13-15 lines in 2 locations

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

@@ 1310-1324 (lines=15) @@
1307
	 * @param bool $round (default: true).
1308
	 * @return float
1309
	 */
1310
	public function get_line_subtotal( $item, $inc_tax = false, $round = true ) {
1311
		$subtotal = 0;
1312
1313
		if ( is_callable( array( $item, 'get_subtotal' ) ) ) {
1314
			if ( $inc_tax ) {
1315
				$subtotal = $item->get_subtotal() + $item->get_subtotal_tax();
1316
			} else {
1317
				$subtotal = $item->get_subtotal();
1318
			}
1319
1320
			$subtotal = $round ? round( $subtotal, wc_get_price_decimals() ) : $subtotal;
1321
		}
1322
1323
		return apply_filters( 'woocommerce_order_amount_line_subtotal', $subtotal, $this, $item, $inc_tax, $round );
1324
	}
1325
1326
	/**
1327
	 * Calculate item cost - useful for gateways.
@@ 1358-1370 (lines=13) @@
1355
	 * @param bool $round (default: true).
1356
	 * @return float
1357
	 */
1358
	public function get_line_total( $item, $inc_tax = false, $round = true ) {
1359
		$total = 0;
1360
1361
		if ( is_callable( array( $item, 'get_total' ) ) ) {
1362
			// Check if we need to add line tax to the line total.
1363
			$total = $inc_tax ? $item->get_total() + $item->get_total_tax() : $item->get_total();
1364
1365
			// Check if we need to round.
1366
			$total = $round ? round( $total, wc_get_price_decimals() ) : $total;
1367
		}
1368
1369
		return apply_filters( 'woocommerce_order_amount_line_total', $total, $this, $item, $inc_tax, $round );
1370
	}
1371
1372
	/**
1373
	 * Get item tax - useful for gateways.