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

@@ 1238-1253 (lines=16) @@
1235
				$terms = (array) $terms;
1236
1237
				if ( count( $terms ) && mb_strlen( $tax ) ) {
1238
					switch ( $tax ) {
1239
						case 'post_tag':
1240
							$tax_fld = 'tag.slug';
1241
1242
							break;
1243
1244
						case 'category':
1245
							$tax_fld = 'category.slug';
1246
1247
							break;
1248
1249
						default:
1250
							$tax_fld = 'taxonomy.' . $tax . '.slug';
1251
1252
							break;
1253
					}
1254
1255
					foreach ( $terms as $term ) {
1256
						$parser->add_filter(