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

@@ 820-830 (lines=11) @@
817
		if ( ! empty( $args['has_terms'] ) ) {
818
			foreach( (array)$args['has_terms'] as $term ) {
819
				if ( mb_strlen( $term->taxonomy ) ) {
820
					switch ( $term->taxonomy ) {
821
						case 'post_tag':
822
							$tax_fld = 'tag.slug';
823
							break;
824
						case 'category':
825
							$tax_fld = 'category.slug';
826
							break;
827
						default:
828
							$tax_fld = 'taxonomy.' . $term->taxonomy . '.slug';
829
							break;
830
					}
831
					$filters[] = array( 'term' => array( $tax_fld => $term->slug ) );
832
				}
833
			}