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

@@ 1276-1291 (lines=16) @@
1273
				$terms = (array) $terms;
1274
1275
				if ( count( $terms ) && mb_strlen( $tax ) ) {
1276
					switch ( $tax ) {
1277
						case 'post_tag':
1278
							$tax_fld = 'tag.slug';
1279
1280
							break;
1281
1282
						case 'category':
1283
							$tax_fld = 'category.slug';
1284
1285
							break;
1286
1287
						default:
1288
							$tax_fld = 'taxonomy.' . $tax . '.slug';
1289
1290
							break;
1291
					}
1292
1293
					foreach ( $terms as $term ) {
1294
						$parser->add_filter(