Code Duplication    Length = 21-21 lines in 2 locations

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

@@ 1324-1344 (lines=21) @@
1321
	 */
1322
	protected function _generate_related_post_context( $post_id ) {
1323
		$categories = get_the_category( $post_id );
1324
		if ( is_array( $categories ) ) {
1325
			foreach ( $categories as $category ) {
1326
				if ( 'uncategorized' != $category->slug && '' != trim( $category->name ) ) {
1327
					$post_cat_context = sprintf(
1328
						_x( 'In "%s"', 'in {category/tag name}', 'jetpack' ),
1329
						$category->name
1330
					);
1331
					/**
1332
					 * Filter the "In Category" line displayed in the post context below each Related Post.
1333
					 *
1334
					 * @module related-posts
1335
					 *
1336
					 * @since 3.2.0
1337
					 *
1338
					 * @param string $post_cat_context "In Category" line displayed in the post context below each Related Post.
1339
					 * @param array $category Array containing information about the category.
1340
					 */
1341
					return apply_filters( 'jetpack_relatedposts_post_category_context', $post_cat_context, $category );
1342
				}
1343
			}
1344
		}
1345
1346
		$tags = get_the_terms( $post_id, 'post_tag' );
1347
		if ( is_array( $tags ) ) {
@@ 1347-1367 (lines=21) @@
1344
		}
1345
1346
		$tags = get_the_terms( $post_id, 'post_tag' );
1347
		if ( is_array( $tags ) ) {
1348
			foreach ( $tags as $tag ) {
1349
				if ( '' != trim( $tag->name ) ) {
1350
					$post_tag_context = sprintf(
1351
						_x( 'In "%s"', 'in {category/tag name}', 'jetpack' ),
1352
						$tag->name
1353
					);
1354
					/**
1355
					 * Filter the "In Tag" line displayed in the post context below each Related Post.
1356
					 *
1357
					 * @module related-posts
1358
					 *
1359
					 * @since 3.2.0
1360
					 *
1361
					 * @param string $post_tag_context "In Tag" line displayed in the post context below each Related Post.
1362
					 * @param array $tag Array containing information about the tag.
1363
					 */
1364
					return apply_filters( 'jetpack_relatedposts_post_tag_context', $post_tag_context, $tag );
1365
				}
1366
			}
1367
		}
1368
1369
		$comment_count = get_comments_number( $post_id );
1370
		if ( $comment_count > 0 ) {