Code Duplication    Length = 14-15 lines in 2 locations

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

@@ 1599-1612 (lines=14) @@
1596
1597
						// Let's determine if this term is active or not.
1598
1599
						if ( in_array( $item['key'], $existing_term_slugs, true ) ) {
1600
							$active = true;
1601
1602
							$slug_count = count( $existing_term_slugs );
1603
1604
							if ( $slug_count > 1 ) {
1605
								$remove_url = Jetpack_Search_Helpers::add_query_arg(
1606
									$tax_query_var,
1607
									rawurlencode( implode( '+', array_diff( $existing_term_slugs, array( $item['key'] ) ) ) )
1608
								);
1609
							} else {
1610
								$remove_url = Jetpack_Search_Helpers::remove_query_arg( $tax_query_var );
1611
							}
1612
						}
1613
1614
						break;
1615
@@ 1636-1650 (lines=15) @@
1633
							$post_types = array( $post_types );
1634
						}
1635
1636
						if ( in_array( $item['key'], $post_types, true ) ) {
1637
							$active = true;
1638
1639
							$post_type_count = count( $post_types );
1640
1641
							// 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.
1642
							if ( $post_type_count > 1 ) {
1643
								$remove_url = Jetpack_Search_Helpers::add_query_arg(
1644
									'post_type',
1645
									rawurlencode( implode( ',', array_diff( $post_types, array( $item['key'] ) ) ) )
1646
								);
1647
							} else {
1648
								$remove_url = Jetpack_Search_Helpers::remove_query_arg( 'post_type' );
1649
							}
1650
						}
1651
1652
						break;
1653