Code Duplication    Length = 17-17 lines in 2 locations

includes/class-wc-order.php 1 location

@@ 154-170 (lines=17) @@
151
	 * @param string $item_type
152
	 * @return string
153
	 */
154
	public function get_item_count_refunded( $item_type = '' ) {
155
		if ( empty( $item_type ) ) {
156
			$item_type = array( 'line_item' );
157
		}
158
		if ( ! is_array( $item_type ) ) {
159
			$item_type = array( $item_type );
160
		}
161
		$count = 0;
162
163
		foreach ( $this->get_refunds() as $refund ) {
164
			foreach ( $refund->get_items( $item_type ) as $refunded_item ) {
165
				$count += empty( $refunded_item['qty'] ) ? 0 : $refunded_item['qty'];
166
			}
167
		}
168
169
		return apply_filters( 'woocommerce_get_item_count_refunded', $count, $item_type, $this );
170
	}
171
172
	/**
173
	 * Get the total number of items refunded.

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

@@ 1197-1213 (lines=17) @@
1194
	 * @param string $item_type
1195
	 * @return string
1196
	 */
1197
	public function get_item_count( $item_type = '' ) {
1198
		if ( empty( $item_type ) ) {
1199
			$item_type = array( 'line_item' );
1200
		}
1201
		if ( ! is_array( $item_type ) ) {
1202
			$item_type = array( $item_type );
1203
		}
1204
1205
		$items = $this->get_items( $item_type );
1206
		$count = 0;
1207
1208
		foreach ( $items as $item ) {
1209
			$count += empty( $item['qty'] ) ? 1 : $item['qty'];
1210
		}
1211
1212
		return apply_filters( 'woocommerce_get_item_count', $count, $item_type, $this );
1213
	}
1214
1215
	/**
1216
	 * Get refunds