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

@@ 1215-1230 (lines=16) @@
1212
				$terms = (array) $terms;
1213
1214
				if ( count( $terms ) && mb_strlen( $tax ) ) {
1215
					switch ( $tax ) {
1216
						case 'post_tag':
1217
							$tax_fld = 'tag.slug';
1218
1219
							break;
1220
1221
						case 'category':
1222
							$tax_fld = 'category.slug';
1223
1224
							break;
1225
1226
						default:
1227
							$tax_fld = 'taxonomy.' . $tax . '.slug';
1228
1229
							break;
1230
					}
1231
1232
					foreach ( $terms as $term ) {
1233
						$parser->add_filter(