Code Duplication    Length = 15-15 lines in 2 locations

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

@@ 1321-1335 (lines=15) @@
1318
	 * @param bool $round (default: true).
1319
	 * @return float
1320
	 */
1321
	public function get_item_subtotal( $item, $inc_tax = false, $round = true ) {
1322
		$subtotal = 0;
1323
1324
		if ( is_callable( array( $item, 'get_subtotal' ) ) ) {
1325
			if ( $inc_tax ) {
1326
				$subtotal = ( $item->get_subtotal() + $item->get_subtotal_tax() ) / max( 1, $item->get_qty() );
1327
			} else {
1328
				$subtotal = ( $item->get_subtotal() / max( 1, $item->get_qty() ) );
1329
			}
1330
1331
			$subtotal = $round ? number_format( (float) $subtotal, wc_get_price_decimals(), '.', '' ) : $subtotal;
1332
		}
1333
1334
		return apply_filters( 'woocommerce_order_amount_item_subtotal', $subtotal, $this, $item, $inc_tax, $round );
1335
	}
1336
1337
	/**
1338
	 * Get line subtotal - this is the cost before discount.
@@ 1369-1383 (lines=15) @@
1366
	 * @param bool $round (default: true).
1367
	 * @return float
1368
	 */
1369
	public function get_item_total( $item, $inc_tax = false, $round = true ) {
1370
		$total = 0;
1371
1372
		if ( is_callable( array( $item, 'get_total' ) ) ) {
1373
			if ( $inc_tax ) {
1374
				$total = ( $item->get_total() + $item->get_total_tax() ) / max( 1, $item->get_qty() );
1375
			} else {
1376
				$total = $item->get_total() / max( 1, $item->get_qty() );
1377
			}
1378
1379
			$total = $round ? round( $total, wc_get_price_decimals() ) : $total;
1380
		}
1381
1382
		return apply_filters( 'woocommerce_order_amount_item_total', $total, $this, $item, $inc_tax, $round );
1383
	}
1384
1385
	/**
1386
	 * Calculate line total - useful for gateways.