Code Duplication    Length = 11-11 lines in 3 locations

includes/class-wc-order.php 3 locations

@@ 1401-1411 (lines=11) @@
1398
	 * @param  string $item_type type of the item we're checking, if not a line_item
1399
	 * @return integer
1400
	 */
1401
	public function get_qty_refunded_for_item( $item_id, $item_type = 'line_item' ) {
1402
		$qty = 0;
1403
		foreach ( $this->get_refunds() as $refund ) {
1404
			foreach ( $refund->get_items( $item_type ) as $refunded_item ) {
1405
				if ( absint( $refunded_item->get_meta( '_refunded_item_id' ) ) === $item_id ) {
1406
					$qty += $refunded_item->get_qty();
1407
				}
1408
			}
1409
		}
1410
		return $qty;
1411
	}
1412
1413
	/**
1414
	 * Get the refunded amount for a line item.
@@ 1420-1430 (lines=11) @@
1417
	 * @param  string $item_type type of the item we're checking, if not a line_item
1418
	 * @return integer
1419
	 */
1420
	public function get_total_refunded_for_item( $item_id, $item_type = 'line_item' ) {
1421
		$total = 0;
1422
		foreach ( $this->get_refunds() as $refund ) {
1423
			foreach ( $refund->get_items( $item_type ) as $refunded_item ) {
1424
				if ( absint( $refunded_item->get_meta( '_refunded_item_id' ) ) === $item_id ) {
1425
					$total += $refunded_item->get_total();
1426
				}
1427
			}
1428
		}
1429
		return $total * -1;
1430
	}
1431
1432
	/**
1433
	 * Get the refunded amount for a line item.
@@ 1440-1450 (lines=11) @@
1437
	 * @param  string $item_type type of the item we're checking, if not a line_item
1438
	 * @return double
1439
	 */
1440
	public function get_tax_refunded_for_item( $item_id, $tax_id, $item_type = 'line_item' ) {
1441
		$total = 0;
1442
		foreach ( $this->get_refunds() as $refund ) {
1443
			foreach ( $refund->get_items( $item_type ) as $refunded_item ) {
1444
				if ( absint( $refunded_item->get_meta( '_refunded_item_id' ) ) === $item_id ) {
1445
					$total += $refunded_item->get_total_tax();
1446
				}
1447
			}
1448
		}
1449
		return wc_round_tax_total( $total ) * -1;
1450
	}
1451
1452
	/**
1453
	 * Get total tax refunded by rate ID.