Code Duplication    Length = 11-11 lines in 3 locations

includes/class-wc-order.php 3 locations

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