Code Duplication    Length = 17-17 lines in 2 locations

includes/class-wc-order.php 1 location

@@ 143-159 (lines=17) @@
140
	 * @param string $item_type
141
	 * @return string
142
	 */
143
	public function get_item_count_refunded( $item_type = '' ) {
144
		if ( empty( $item_type ) ) {
145
			$item_type = array( 'line_item' );
146
		}
147
		if ( ! is_array( $item_type ) ) {
148
			$item_type = array( $item_type );
149
		}
150
		$count = 0;
151
152
		foreach ( $this->get_refunds() as $refund ) {
153
			foreach ( $refund->get_items( $item_type ) as $refunded_item ) {
154
				$count += empty( $refunded_item['qty'] ) ? 0 : $refunded_item['qty'];
155
			}
156
		}
157
158
		return apply_filters( 'woocommerce_get_item_count_refunded', $count, $item_type, $this );
159
	}
160
161
	/**
162
	 * Get the total number of items refunded.

includes/abstracts/abstract-wc-order.php 1 location

@@ 1284-1300 (lines=17) @@
1281
	 * @param string $item_type
1282
	 * @return string
1283
	 */
1284
	public function get_item_count( $item_type = '' ) {
1285
		if ( empty( $item_type ) ) {
1286
			$item_type = array( 'line_item' );
1287
		}
1288
		if ( ! is_array( $item_type ) ) {
1289
			$item_type = array( $item_type );
1290
		}
1291
1292
		$items = $this->get_items( $item_type );
1293
		$count = 0;
1294
1295
		foreach ( $items as $item ) {
1296
			$count += empty( $item['qty'] ) ? 1 : $item['qty'];
1297
		}
1298
1299
		return apply_filters( 'woocommerce_get_item_count', $count, $item_type, $this );
1300
	}
1301
1302
	/**
1303
	 * Get refunds