Code Duplication    Length = 14-15 lines in 2 locations

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

@@ 1592-1605 (lines=14) @@
1589
1590
						// Let's determine if this term is active or not.
1591
1592
						if ( in_array( $item['key'], $existing_term_slugs, true ) ) {
1593
							$active = true;
1594
1595
							$slug_count = count( $existing_term_slugs );
1596
1597
							if ( $slug_count > 1 ) {
1598
								$remove_url = Jetpack_Search_Helpers::add_query_arg(
1599
									$tax_query_var,
1600
									rawurlencode( implode( '+', array_diff( $existing_term_slugs, array( $item['key'] ) ) ) )
1601
								);
1602
							} else {
1603
								$remove_url = Jetpack_Search_Helpers::remove_query_arg( $tax_query_var );
1604
							}
1605
						}
1606
1607
						break;
1608
@@ 1629-1643 (lines=15) @@
1626
							$post_types = array( $post_types );
1627
						}
1628
1629
						if ( in_array( $item['key'], $post_types, true ) ) {
1630
							$active = true;
1631
1632
							$post_type_count = count( $post_types );
1633
1634
							// 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.
1635
							if ( $post_type_count > 1 ) {
1636
								$remove_url = Jetpack_Search_Helpers::add_query_arg(
1637
									'post_type',
1638
									rawurlencode( implode( ',', array_diff( $post_types, array( $item['key'] ) ) ) )
1639
								);
1640
							} else {
1641
								$remove_url = Jetpack_Search_Helpers::remove_query_arg( 'post_type' );
1642
							}
1643
						}
1644
1645
						break;
1646