Code Duplication    Length = 14-15 lines in 2 locations

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

@@ 1656-1669 (lines=14) @@
1653
1654
						// Let's determine if this term is active or not.
1655
1656
						if ( in_array( $item['key'], $existing_term_slugs, true ) ) {
1657
							$active = true;
1658
1659
							$slug_count = count( $existing_term_slugs );
1660
1661
							if ( $slug_count > 1 ) {
1662
								$remove_url = Jetpack_Search_Helpers::add_query_arg(
1663
									$tax_query_var,
1664
									rawurlencode( implode( '+', array_diff( $existing_term_slugs, array( $item['key'] ) ) ) )
1665
								);
1666
							} else {
1667
								$remove_url = Jetpack_Search_Helpers::remove_query_arg( $tax_query_var );
1668
							}
1669
						}
1670
1671
						break;
1672
@@ 1693-1707 (lines=15) @@
1690
							$post_types = array( $post_types );
1691
						}
1692
1693
						if ( in_array( $item['key'], $post_types, true ) ) {
1694
							$active = true;
1695
1696
							$post_type_count = count( $post_types );
1697
1698
							// 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.
1699
							if ( $post_type_count > 1 ) {
1700
								$remove_url = Jetpack_Search_Helpers::add_query_arg(
1701
									'post_type',
1702
									rawurlencode( implode( ',', array_diff( $post_types, array( $item['key'] ) ) ) )
1703
								);
1704
							} else {
1705
								$remove_url = Jetpack_Search_Helpers::remove_query_arg( 'post_type' );
1706
							}
1707
						}
1708
1709
						break;
1710