Code Duplication    Length = 14-15 lines in 2 locations

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

@@ 1711-1724 (lines=14) @@
1708
1709
						// Let's determine if this term is active or not.
1710
1711
						if ( in_array( $item['key'], $existing_term_slugs, true ) ) {
1712
							$active = true;
1713
1714
							$slug_count = count( $existing_term_slugs );
1715
1716
							if ( $slug_count > 1 ) {
1717
								$remove_url = Jetpack_Search_Helpers::add_query_arg(
1718
									$tax_query_var,
1719
									rawurlencode( implode( '+', array_diff( $existing_term_slugs, array( $item['key'] ) ) ) )
1720
								);
1721
							} else {
1722
								$remove_url = Jetpack_Search_Helpers::remove_query_arg( $tax_query_var );
1723
							}
1724
						}
1725
1726
						break;
1727
@@ 1748-1762 (lines=15) @@
1745
							$post_types = array( $post_types );
1746
						}
1747
1748
						if ( in_array( $item['key'], $post_types, true ) ) {
1749
							$active = true;
1750
1751
							$post_type_count = count( $post_types );
1752
1753
							// 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.
1754
							if ( $post_type_count > 1 ) {
1755
								$remove_url = Jetpack_Search_Helpers::add_query_arg(
1756
									'post_type',
1757
									rawurlencode( implode( ',', array_diff( $post_types, array( $item['key'] ) ) ) )
1758
								);
1759
							} else {
1760
								$remove_url = Jetpack_Search_Helpers::remove_query_arg( 'post_type' );
1761
							}
1762
						}
1763
1764
						break;
1765