Code Duplication    Length = 11-11 lines in 3 locations

includes/class-wc-order.php 3 locations

@@ 1567-1577 (lines=11) @@
1564
	 * @param  string $item_type type of the item we're checking, if not a line_item
1565
	 * @return integer
1566
	 */
1567
	public function get_qty_refunded_for_item( $item_id, $item_type = 'line_item' ) {
1568
		$qty = 0;
1569
		foreach ( $this->get_refunds() as $refund ) {
1570
			foreach ( $refund->get_items( $item_type ) as $refunded_item ) {
1571
				if ( absint( $refunded_item->get_meta( '_refunded_item_id' ) ) === $item_id ) {
1572
					$qty += $refunded_item->get_quantity();
1573
				}
1574
			}
1575
		}
1576
		return $qty;
1577
	}
1578
1579
	/**
1580
	 * Get the refunded amount for a line item.
@@ 1586-1596 (lines=11) @@
1583
	 * @param  string $item_type type of the item we're checking, if not a line_item
1584
	 * @return integer
1585
	 */
1586
	public function get_total_refunded_for_item( $item_id, $item_type = 'line_item' ) {
1587
		$total = 0;
1588
		foreach ( $this->get_refunds() as $refund ) {
1589
			foreach ( $refund->get_items( $item_type ) as $refunded_item ) {
1590
				if ( absint( $refunded_item->get_meta( '_refunded_item_id' ) ) === $item_id ) {
1591
					$total += $refunded_item->get_total();
1592
				}
1593
			}
1594
		}
1595
		return $total * -1;
1596
	}
1597
1598
	/**
1599
	 * Get the refunded amount for a line item.
@@ 1606-1616 (lines=11) @@
1603
	 * @param  string $item_type type of the item we're checking, if not a line_item
1604
	 * @return double
1605
	 */
1606
	public function get_tax_refunded_for_item( $item_id, $tax_id, $item_type = 'line_item' ) {
1607
		$total = 0;
1608
		foreach ( $this->get_refunds() as $refund ) {
1609
			foreach ( $refund->get_items( $item_type ) as $refunded_item ) {
1610
				if ( absint( $refunded_item->get_meta( '_refunded_item_id' ) ) === $item_id ) {
1611
					$total += $refunded_item->get_total_tax();
1612
				}
1613
			}
1614
		}
1615
		return wc_round_tax_total( $total ) * -1;
1616
	}
1617
1618
	/**
1619
	 * Get total tax refunded by rate ID.