Code Duplication    Length = 15-15 lines in 2 locations

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

@@ 1289-1303 (lines=15) @@
1286
	 * @param bool $round (default: true).
1287
	 * @return float
1288
	 */
1289
	public function get_item_subtotal( $item, $inc_tax = false, $round = true ) {
1290
		$subtotal = 0;
1291
1292
		if ( is_callable( array( $item, 'get_subtotal' ) ) ) {
1293
			if ( $inc_tax ) {
1294
				$subtotal = ( $item->get_subtotal() + $item->get_subtotal_tax() ) / max( 1, $item->get_quantity() );
1295
			} else {
1296
				$subtotal = ( $item->get_subtotal() / max( 1, $item->get_quantity() ) );
1297
			}
1298
1299
			$subtotal = $round ? number_format( (float) $subtotal, wc_get_price_decimals(), '.', '' ) : $subtotal;
1300
		}
1301
1302
		return apply_filters( 'woocommerce_order_amount_item_subtotal', $subtotal, $this, $item, $inc_tax, $round );
1303
	}
1304
1305
	/**
1306
	 * Get line subtotal - this is the cost before discount.
@@ 1337-1351 (lines=15) @@
1334
	 * @param bool $round (default: true).
1335
	 * @return float
1336
	 */
1337
	public function get_item_total( $item, $inc_tax = false, $round = true ) {
1338
		$total = 0;
1339
1340
		if ( is_callable( array( $item, 'get_total' ) ) ) {
1341
			if ( $inc_tax ) {
1342
				$total = ( $item->get_total() + $item->get_total_tax() ) / max( 1, $item->get_quantity() );
1343
			} else {
1344
				$total = $item->get_total() / max( 1, $item->get_quantity() );
1345
			}
1346
1347
			$total = $round ? round( $total, wc_get_price_decimals() ) : $total;
1348
		}
1349
1350
		return apply_filters( 'woocommerce_order_amount_item_total', $total, $this, $item, $inc_tax, $round );
1351
	}
1352
1353
	/**
1354
	 * Calculate line total - useful for gateways.