Code Duplication    Length = 11-16 lines in 2 locations

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

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

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

@@ 900-910 (lines=11) @@
897
		if ( ! empty( $args['has_terms'] ) ) {
898
			foreach( (array)$args['has_terms'] as $term ) {
899
				if ( mb_strlen( $term->taxonomy ) ) {
900
					switch ( $term->taxonomy ) {
901
						case 'post_tag':
902
							$tax_fld = 'tag.slug';
903
							break;
904
						case 'category':
905
							$tax_fld = 'category.slug';
906
							break;
907
						default:
908
							$tax_fld = 'taxonomy.' . $term->taxonomy . '.slug';
909
							break;
910
					}
911
					$filters[] = array( 'term' => array( $tax_fld => $term->slug ) );
912
				}
913
			}