Code Duplication    Length = 24-24 lines in 2 locations

includes/api/legacy/v1/class-wc-api-orders.php 1 location

@@ 355-378 (lines=24) @@
352
	 * @param array $args request arguments for filtering query
353
	 * @return WP_Query
354
	 */
355
	private function query_orders( $args ) {
356
357
		// set base query arguments
358
		$query_args = array(
359
			'fields'      => 'ids',
360
			'post_type'   => 'shop_order',
361
			'post_status' => array_keys( wc_get_order_statuses() )
362
		);
363
364
		// add status argument
365
		if ( ! empty( $args['status'] ) ) {
366
367
			$statuses                  = 'wc-' . str_replace( ',', ',wc-', $args['status'] );
368
			$statuses                  = explode( ',', $statuses );
369
			$query_args['post_status'] = $statuses;
370
371
			unset( $args['status'] );
372
373
		}
374
375
		$query_args = $this->merge_query_args( $query_args, $args );
376
377
		return new WP_Query( $query_args );
378
	}
379
380
	/**
381
	 * Helper method to get the order subtotal

includes/api/legacy/v2/class-wc-api-orders.php 1 location

@@ 682-705 (lines=24) @@
679
	 * @param array $args request arguments for filtering query
680
	 * @return WP_Query
681
	 */
682
	protected function query_orders( $args ) {
683
684
		// set base query arguments
685
		$query_args = array(
686
			'fields'      => 'ids',
687
			'post_type'   => $this->post_type,
688
			'post_status' => array_keys( wc_get_order_statuses() )
689
		);
690
691
		// add status argument
692
		if ( ! empty( $args['status'] ) ) {
693
694
			$statuses                  = 'wc-' . str_replace( ',', ',wc-', $args['status'] );
695
			$statuses                  = explode( ',', $statuses );
696
			$query_args['post_status'] = $statuses;
697
698
			unset( $args['status'] );
699
700
		}
701
702
		$query_args = $this->merge_query_args( $query_args, $args );
703
704
		return new WP_Query( $query_args );
705
	}
706
707
	/**
708
	 * Helper method to set/update the billing & shipping addresses for