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

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