Code Duplication    Length = 15-15 lines in 2 locations

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

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