Code Duplication    Length = 15-15 lines in 2 locations

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

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