Code Duplication    Length = 14-14 lines in 4 locations

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

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

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

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

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

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

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

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