Code Duplication    Length = 14-15 lines in 2 locations

modules/search/class.jetpack-search.php 2 locations

@@ 1593-1606 (lines=14) @@
1590
1591
						// Let's determine if this term is active or not.
1592
1593
						if ( in_array( $item['key'], $existing_term_slugs, true ) ) {
1594
							$active = true;
1595
1596
							$slug_count = count( $existing_term_slugs );
1597
1598
							if ( $slug_count > 1 ) {
1599
								$remove_url = Jetpack_Search_Helpers::add_query_arg(
1600
									$tax_query_var,
1601
									rawurlencode( implode( '+', array_diff( $existing_term_slugs, array( $item['key'] ) ) ) )
1602
								);
1603
							} else {
1604
								$remove_url = Jetpack_Search_Helpers::remove_query_arg( $tax_query_var );
1605
							}
1606
						}
1607
1608
						break;
1609
@@ 1630-1644 (lines=15) @@
1627
							$post_types = array( $post_types );
1628
						}
1629
1630
						if ( in_array( $item['key'], $post_types, true ) ) {
1631
							$active = true;
1632
1633
							$post_type_count = count( $post_types );
1634
1635
							// For the right 'remove filter' url, we need to remove the post type from the array, or remove the param entirely if it's the only one.
1636
							if ( $post_type_count > 1 ) {
1637
								$remove_url = Jetpack_Search_Helpers::add_query_arg(
1638
									'post_type',
1639
									rawurlencode( implode( ',', array_diff( $post_types, array( $item['key'] ) ) ) )
1640
								);
1641
							} else {
1642
								$remove_url = Jetpack_Search_Helpers::remove_query_arg( 'post_type' );
1643
							}
1644
						}
1645
1646
						break;
1647