Code Duplication    Length = 11-16 lines in 2 locations

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

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

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

@@ 922-937 (lines=16) @@
919
				$terms = (array) $terms;
920
921
				if ( count( $terms ) && mb_strlen( $tax ) ) {
922
					switch ( $tax ) {
923
						case 'post_tag':
924
							$tax_fld = 'tag.slug';
925
926
							break;
927
928
						case 'category':
929
							$tax_fld = 'category.slug';
930
931
							break;
932
933
						default:
934
							$tax_fld = 'taxonomy.' . $tax . '.slug';
935
936
							break;
937
					}
938
939
					foreach ( $terms as $term ) {
940
						$parser->add_filter( array(