Code Duplication    Length = 11-16 lines in 2 locations

modules/related-posts/jetpack-related-posts.php 1 location

@@ 897-907 (lines=11) @@
894
		if ( ! empty( $args['has_terms'] ) ) {
895
			foreach( (array)$args['has_terms'] as $term ) {
896
				if ( mb_strlen( $term->taxonomy ) ) {
897
					switch ( $term->taxonomy ) {
898
						case 'post_tag':
899
							$tax_fld = 'tag.slug';
900
							break;
901
						case 'category':
902
							$tax_fld = 'category.slug';
903
							break;
904
						default:
905
							$tax_fld = 'taxonomy.' . $term->taxonomy . '.slug';
906
							break;
907
					}
908
					$filters[] = array( 'term' => array( $tax_fld => $term->slug ) );
909
				}
910
			}

modules/search/class.jetpack-search.php 1 location

@@ 1158-1173 (lines=16) @@
1155
				$terms = (array) $terms;
1156
1157
				if ( count( $terms ) && mb_strlen( $tax ) ) {
1158
					switch ( $tax ) {
1159
						case 'post_tag':
1160
							$tax_fld = 'tag.slug';
1161
1162
							break;
1163
1164
						case 'category':
1165
							$tax_fld = 'category.slug';
1166
1167
							break;
1168
1169
						default:
1170
							$tax_fld = 'taxonomy.' . $tax . '.slug';
1171
1172
							break;
1173
					}
1174
1175
					foreach ( $terms as $term ) {
1176
						$parser->add_filter(