Code Duplication    Length = 15-15 lines in 2 locations

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

@@ 1303-1317 (lines=15) @@
1300
	 * @param bool $round (default: true).
1301
	 * @return float
1302
	 */
1303
	public function get_item_subtotal( $item, $inc_tax = false, $round = true ) {
1304
		$subtotal = 0;
1305
1306
		if ( is_callable( array( $item, 'get_subtotal' ) ) ) {
1307
			if ( $inc_tax ) {
1308
				$subtotal = ( $item->get_subtotal() + $item->get_subtotal_tax() ) / max( 1, $item->get_qty() );
1309
			} else {
1310
				$subtotal = ( $item->get_subtotal() / max( 1, $item->get_qty() ) );
1311
			}
1312
1313
			$subtotal = $round ? number_format( (float) $subtotal, wc_get_price_decimals(), '.', '' ) : $subtotal;
1314
		}
1315
1316
		return apply_filters( 'woocommerce_order_amount_item_subtotal', $subtotal, $this, $item, $inc_tax, $round );
1317
	}
1318
1319
	/**
1320
	 * Get line subtotal - this is the cost before discount.
@@ 1351-1365 (lines=15) @@
1348
	 * @param bool $round (default: true).
1349
	 * @return float
1350
	 */
1351
	public function get_item_total( $item, $inc_tax = false, $round = true ) {
1352
		$total = 0;
1353
1354
		if ( is_callable( array( $item, 'get_total' ) ) ) {
1355
			if ( $inc_tax ) {
1356
				$total = ( $item->get_total() + $item->get_total_tax() ) / max( 1, $item->get_qty() );
1357
			} else {
1358
				$total = $item->get_total() / max( 1, $item->get_qty() );
1359
			}
1360
1361
			$total = $round ? round( $total, wc_get_price_decimals() ) : $total;
1362
		}
1363
1364
		return apply_filters( 'woocommerce_order_amount_item_total', $total, $this, $item, $inc_tax, $round );
1365
	}
1366
1367
	/**
1368
	 * Calculate line total - useful for gateways.