Code Duplication    Length = 13-15 lines in 2 locations

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

@@ 1291-1305 (lines=15) @@
1288
	 * @param bool $round (default: true).
1289
	 * @return float
1290
	 */
1291
	public function get_line_subtotal( $item, $inc_tax = false, $round = true ) {
1292
		$subtotal = 0;
1293
1294
		if ( is_callable( array( $item, 'get_subtotal' ) ) ) {
1295
			if ( $inc_tax ) {
1296
				$subtotal = $item->get_subtotal() + $item->get_subtotal_tax();
1297
			} else {
1298
				$subtotal = $item->get_subtotal();
1299
			}
1300
1301
			$subtotal = $round ? round( $subtotal, wc_get_price_decimals() ) : $subtotal;
1302
		}
1303
1304
		return apply_filters( 'woocommerce_order_amount_line_subtotal', $subtotal, $this, $item, $inc_tax, $round );
1305
	}
1306
1307
	/**
1308
	 * Calculate item cost - useful for gateways.
@@ 1339-1351 (lines=13) @@
1336
	 * @param bool $round (default: true).
1337
	 * @return float
1338
	 */
1339
	public function get_line_total( $item, $inc_tax = false, $round = true ) {
1340
		$total = 0;
1341
1342
		if ( is_callable( array( $item, 'get_total' ) ) ) {
1343
			// Check if we need to add line tax to the line total.
1344
			$total = $inc_tax ? $item->get_total() + $item->get_total_tax() : $item->get_total();
1345
1346
			// Check if we need to round.
1347
			$total = $round ? round( $total, wc_get_price_decimals() ) : $total;
1348
		}
1349
1350
		return apply_filters( 'woocommerce_order_amount_line_total', $total, $this, $item, $inc_tax, $round );
1351
	}
1352
1353
	/**
1354
	 * Get item tax - useful for gateways.