Code Duplication    Length = 14-14 lines in 4 locations

includes/cli/class-wc-cli-coupon.php 1 location

@@ 353-366 (lines=14) @@
350
	 * @since      2.5.0
351
	 * @subcommand list
352
	 */
353
	public function list_( $__, $assoc_args ) {
354
		$query_args = $this->merge_wp_query_args( $this->get_list_query_args(), $assoc_args );
355
		$formatter  = $this->get_formatter( $assoc_args );
356
357
		if ( 'ids' === $formatter->format ) {
358
			$query_args['fields'] = 'ids';
359
			$query = new WP_Query( $query_args );
360
			echo implode( ' ', $query->posts );
361
		} else {
362
			$query = new WP_Query( $query_args );
363
			$items = $this->format_posts_to_items( $query->posts );
364
			$formatter->display_items( $items );
365
		}
366
	}
367
368
	/**
369
	 * Get coupon types.

includes/cli/class-wc-cli-customer.php 1 location

@@ 370-383 (lines=14) @@
367
	 * @subcommand list
368
	 * @since      2.5.0
369
	 */
370
	public function list_( $__, $assoc_args ) {
371
		$query_args = $this->merge_wp_user_query_args( $this->get_list_query_args(), $assoc_args );
372
		$formatter  = $this->get_formatter( $assoc_args );
373
374
		if ( 'ids' === $formatter->format ) {
375
			$query_args['fields'] = 'ids';
376
			$query = new WP_User_Query( $query_args );
377
			echo implode( ' ', $query->results );
378
		} else {
379
			$query = new WP_User_Query( $query_args );
380
			$items = $this->format_users_to_items( $query->results );
381
			$formatter->display_items( $items );
382
		}
383
	}
384
385
	/**
386
	 * View customer orders.

includes/cli/class-wc-cli-order.php 1 location

@@ 384-397 (lines=14) @@
381
	 * @subcommand list
382
	 * @since      2.5.0
383
	 */
384
	public function list_( $args, $assoc_args ) {
385
		$query_args = $this->merge_wp_query_args( $this->get_list_query_args( $assoc_args ), $assoc_args );
386
		$formatter  = $this->get_formatter( $assoc_args );
387
388
		if ( 'ids' === $formatter->format ) {
389
			$query_args['fields'] = 'ids';
390
			$query = new WP_Query( $query_args );
391
			echo implode( ' ', $query->posts );
392
		} else {
393
			$query = new WP_Query( $query_args );
394
			$items = $this->format_posts_to_items( $query->posts );
395
			$formatter->display_items( $items );
396
		}
397
	}
398
399
	/**
400
	 * Update an order.

includes/cli/class-wc-cli-product.php 1 location

@@ 490-503 (lines=14) @@
487
	 * @subcommand list
488
	 * @since      2.5.0
489
	 */
490
	public function list_( $args, $assoc_args ) {
491
		$query_args = $this->merge_wp_query_args( $this->get_list_query_args( $assoc_args ), $assoc_args );
492
		$formatter  = $this->get_formatter( $assoc_args );
493
494
		if ( 'ids' === $formatter->format ) {
495
			$query_args['fields'] = 'ids';
496
			$query = new WP_Query( $query_args );
497
			echo implode( ' ', $query->posts );
498
		} else {
499
			$query = new WP_Query( $query_args );
500
			$items = $this->format_posts_to_items( $query->posts );
501
			$formatter->display_items( $items );
502
		}
503
	}
504
505
	/**
506
	 * List of product reviews.