Code Duplication    Length = 15-15 lines in 2 locations

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

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