Code Duplication    Length = 19-20 lines in 2 locations

includes/class-give-comment.php 2 locations

@@ 511-530 (lines=20) @@
508
			remove_filter( 'comments_clauses', array( self::$instance, 'hide_comments_pre_wp_41' ), 10 );
509
510
			switch ( $comment_type ) {
511
				case 'payment':
512
					$comment_args['meta_query'] = ! empty( $comment_args['meta_query'] )
513
						? $comment_args['meta_query']
514
						: array(
515
							array(
516
								'key'     => '_give_donor_id',
517
								'compare' => 'NOT EXISTS',
518
							),
519
						);
520
521
					$comments = get_comments( wp_parse_args(
522
						$comment_args,
523
						array(
524
							'post_id' => $id,
525
							'order'   => 'ASC',
526
							'search'  => $search,
527
							'type'    => 'give_payment_note',
528
						)
529
					) );
530
					break;
531
532
				case 'donor':
533
					$comment_args['meta_query'] = ! empty( $comment_args['meta_query'] )
@@ 532-550 (lines=19) @@
529
					) );
530
					break;
531
532
				case 'donor':
533
					$comment_args['meta_query'] = ! empty( $comment_args['meta_query'] )
534
						? $comment_args['meta_query']
535
						: array(
536
							array(
537
								'key'   => "_give_{$comment_type}_id",
538
								'value' => $id,
539
							),
540
						);
541
542
					$comments = get_comments( wp_parse_args(
543
						$comment_args,
544
						array(
545
							'order'  => 'ASC',
546
							'search' => $search,
547
							'type'   => 'give_donor_note',
548
						)
549
					) );
550
					break;
551
			}
552
553
			add_action( 'pre_get_comments', array( self::$instance, 'hide_comments' ), 10, 1 );