Code Duplication    Length = 15-15 lines in 2 locations

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

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