Code Duplication    Length = 14-15 lines in 2 locations

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

@@ 1633-1646 (lines=14) @@
1630
1631
						// Let's determine if this term is active or not.
1632
1633
						if ( in_array( $item['key'], $existing_term_slugs, true ) ) {
1634
							$active = true;
1635
1636
							$slug_count = count( $existing_term_slugs );
1637
1638
							if ( $slug_count > 1 ) {
1639
								$remove_url = Jetpack_Search_Helpers::add_query_arg(
1640
									$tax_query_var,
1641
									rawurlencode( implode( '+', array_diff( $existing_term_slugs, array( $item['key'] ) ) ) )
1642
								);
1643
							} else {
1644
								$remove_url = Jetpack_Search_Helpers::remove_query_arg( $tax_query_var );
1645
							}
1646
						}
1647
1648
						break;
1649
@@ 1670-1684 (lines=15) @@
1667
							$post_types = array( $post_types );
1668
						}
1669
1670
						if ( in_array( $item['key'], $post_types, true ) ) {
1671
							$active = true;
1672
1673
							$post_type_count = count( $post_types );
1674
1675
							// 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.
1676
							if ( $post_type_count > 1 ) {
1677
								$remove_url = Jetpack_Search_Helpers::add_query_arg(
1678
									'post_type',
1679
									rawurlencode( implode( ',', array_diff( $post_types, array( $item['key'] ) ) ) )
1680
								);
1681
							} else {
1682
								$remove_url = Jetpack_Search_Helpers::remove_query_arg( 'post_type' );
1683
							}
1684
						}
1685
1686
						break;
1687