Code Duplication    Length = 11-16 lines in 2 locations

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

@@ 1023-1038 (lines=16) @@
1020
				$terms = (array) $terms;
1021
1022
				if ( count( $terms ) && mb_strlen( $tax ) ) {
1023
					switch ( $tax ) {
1024
						case 'post_tag':
1025
							$tax_fld = 'tag.slug';
1026
1027
							break;
1028
1029
						case 'category':
1030
							$tax_fld = 'category.slug';
1031
1032
							break;
1033
1034
						default:
1035
							$tax_fld = 'taxonomy.' . $tax . '.slug';
1036
1037
							break;
1038
					}
1039
1040
					foreach ( $terms as $term ) {
1041
						$parser->add_filter( array(

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

@@ 812-822 (lines=11) @@
809
		if ( ! empty( $args['has_terms'] ) ) {
810
			foreach( (array)$args['has_terms'] as $term ) {
811
				if ( mb_strlen( $term->taxonomy ) ) {
812
					switch ( $term->taxonomy ) {
813
						case 'post_tag':
814
							$tax_fld = 'tag.slug';
815
							break;
816
						case 'category':
817
							$tax_fld = 'category.slug';
818
							break;
819
						default:
820
							$tax_fld = 'taxonomy.' . $term->taxonomy . '.slug';
821
							break;
822
					}
823
					$filters[] = array( 'term' => array( $tax_fld => $term->slug ) );
824
				}
825
			}