Code Duplication    Length = 14-15 lines in 2 locations

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

@@ 1650-1663 (lines=14) @@
1647
1648
						// Let's determine if this term is active or not.
1649
1650
						if ( in_array( $item['key'], $existing_term_slugs, true ) ) {
1651
							$active = true;
1652
1653
							$slug_count = count( $existing_term_slugs );
1654
1655
							if ( $slug_count > 1 ) {
1656
								$remove_url = Jetpack_Search_Helpers::add_query_arg(
1657
									$tax_query_var,
1658
									rawurlencode( implode( '+', array_diff( $existing_term_slugs, array( $item['key'] ) ) ) )
1659
								);
1660
							} else {
1661
								$remove_url = Jetpack_Search_Helpers::remove_query_arg( $tax_query_var );
1662
							}
1663
						}
1664
1665
						break;
1666
@@ 1687-1701 (lines=15) @@
1684
							$post_types = array( $post_types );
1685
						}
1686
1687
						if ( in_array( $item['key'], $post_types, true ) ) {
1688
							$active = true;
1689
1690
							$post_type_count = count( $post_types );
1691
1692
							// 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.
1693
							if ( $post_type_count > 1 ) {
1694
								$remove_url = Jetpack_Search_Helpers::add_query_arg(
1695
									'post_type',
1696
									rawurlencode( implode( ',', array_diff( $post_types, array( $item['key'] ) ) ) )
1697
								);
1698
							} else {
1699
								$remove_url = Jetpack_Search_Helpers::remove_query_arg( 'post_type' );
1700
							}
1701
						}
1702
1703
						break;
1704