Code Duplication    Length = 11-16 lines in 2 locations

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

@@ 1165-1180 (lines=16) @@
1162
				$terms = (array) $terms;
1163
1164
				if ( count( $terms ) && mb_strlen( $tax ) ) {
1165
					switch ( $tax ) {
1166
						case 'post_tag':
1167
							$tax_fld = 'tag.slug';
1168
1169
							break;
1170
1171
						case 'category':
1172
							$tax_fld = 'category.slug';
1173
1174
							break;
1175
1176
						default:
1177
							$tax_fld = 'taxonomy.' . $tax . '.slug';
1178
1179
							break;
1180
					}
1181
1182
					foreach ( $terms as $term ) {
1183
						$parser->add_filter(

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

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