Code Duplication    Length = 21-21 lines in 2 locations

modules/related-posts/jetpack-related-posts.php 2 locations

@@ 1112-1132 (lines=21) @@
1109
	 */
1110
	protected function _generate_related_post_context( $post_id ) {
1111
		$categories = get_the_category( $post_id );
1112
		if ( is_array( $categories ) ) {
1113
			foreach ( $categories as $category ) {
1114
				if ( 'uncategorized' != $category->slug && '' != trim( $category->name ) ) {
1115
					$post_cat_context = sprintf(
1116
						_x( 'In "%s"', 'in {category/tag name}', 'jetpack' ),
1117
						$category->name
1118
					);
1119
					/**
1120
					 * Filter the "In Category" line displayed in the post context below each Related Post.
1121
					 *
1122
					 * @module related-posts
1123
					 *
1124
					 * @since 3.2.0
1125
					 *
1126
					 * @param string $post_cat_context "In Category" line displayed in the post context below each Related Post.
1127
					 * @param array $category Array containing information about the category.
1128
					 */
1129
					return apply_filters( 'jetpack_relatedposts_post_category_context', $post_cat_context, $category );
1130
				}
1131
			}
1132
		}
1133
1134
		$tags = get_the_terms( $post_id, 'post_tag' );
1135
		if ( is_array( $tags ) ) {
@@ 1135-1155 (lines=21) @@
1132
		}
1133
1134
		$tags = get_the_terms( $post_id, 'post_tag' );
1135
		if ( is_array( $tags ) ) {
1136
			foreach ( $tags as $tag ) {
1137
				if ( '' != trim( $tag->name ) ) {
1138
					$post_tag_context = sprintf(
1139
						_x( 'In "%s"', 'in {category/tag name}', 'jetpack' ),
1140
						$tag->name
1141
					);
1142
					/**
1143
					 * Filter the "In Tag" line displayed in the post context below each Related Post.
1144
					 *
1145
					 * @module related-posts
1146
					 *
1147
					 * @since 3.2.0
1148
					 *
1149
					 * @param string $post_tag_context "In Tag" line displayed in the post context below each Related Post.
1150
					 * @param array $tag Array containing information about the tag.
1151
					 */
1152
					return apply_filters( 'jetpack_relatedposts_post_tag_context', $post_tag_context, $tag );
1153
				}
1154
			}
1155
		}
1156
1157
		$comment_count = get_comments_number( $post_id );
1158
		if ( $comment_count > 0 ) {