Code Duplication    Length = 11-16 lines in 2 locations

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

@@ 1033-1048 (lines=16) @@
1030
				$terms = (array) $terms;
1031
1032
				if ( count( $terms ) && mb_strlen( $tax ) ) {
1033
					switch ( $tax ) {
1034
						case 'post_tag':
1035
							$tax_fld = 'tag.slug';
1036
1037
							break;
1038
1039
						case 'category':
1040
							$tax_fld = 'category.slug';
1041
1042
							break;
1043
1044
						default:
1045
							$tax_fld = 'taxonomy.' . $tax . '.slug';
1046
1047
							break;
1048
					}
1049
1050
					foreach ( $terms as $term ) {
1051
						$parser->add_filter( array(

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

@@ 683-693 (lines=11) @@
680
		if ( ! empty( $args['has_terms'] ) ) {
681
			foreach( (array)$args['has_terms'] as $term ) {
682
				if ( mb_strlen( $term->taxonomy ) ) {
683
					switch ( $term->taxonomy ) {
684
						case 'post_tag':
685
							$tax_fld = 'tag.slug';
686
							break;
687
						case 'category':
688
							$tax_fld = 'category.slug';
689
							break;
690
						default:
691
							$tax_fld = 'taxonomy.' . $term->taxonomy . '.slug';
692
							break;
693
					}
694
					$filters[] = array( 'term' => array( $tax_fld => $term->slug ) );
695
				}
696
			}