Code Duplication    Length = 14-15 lines in 2 locations

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

@@ 1673-1686 (lines=14) @@
1670
1671
						// Let's determine if this term is active or not.
1672
1673
						if ( in_array( $item['key'], $existing_term_slugs, true ) ) {
1674
							$active = true;
1675
1676
							$slug_count = count( $existing_term_slugs );
1677
1678
							if ( $slug_count > 1 ) {
1679
								$remove_url = Jetpack_Search_Helpers::add_query_arg(
1680
									$tax_query_var,
1681
									rawurlencode( implode( '+', array_diff( $existing_term_slugs, array( $item['key'] ) ) ) )
1682
								);
1683
							} else {
1684
								$remove_url = Jetpack_Search_Helpers::remove_query_arg( $tax_query_var );
1685
							}
1686
						}
1687
1688
						break;
1689
@@ 1710-1724 (lines=15) @@
1707
							$post_types = array( $post_types );
1708
						}
1709
1710
						if ( in_array( $item['key'], $post_types, true ) ) {
1711
							$active = true;
1712
1713
							$post_type_count = count( $post_types );
1714
1715
							// 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.
1716
							if ( $post_type_count > 1 ) {
1717
								$remove_url = Jetpack_Search_Helpers::add_query_arg(
1718
									'post_type',
1719
									rawurlencode( implode( ',', array_diff( $post_types, array( $item['key'] ) ) ) )
1720
								);
1721
							} else {
1722
								$remove_url = Jetpack_Search_Helpers::remove_query_arg( 'post_type' );
1723
							}
1724
						}
1725
1726
						break;
1727