Code Duplication    Length = 21-21 lines in 2 locations

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

@@ 1454-1474 (lines=21) @@
1451
	 */
1452
	protected function _generate_related_post_context( $post_id ) {
1453
		$categories = get_the_category( $post_id );
1454
		if ( is_array( $categories ) ) {
1455
			foreach ( $categories as $category ) {
1456
				if ( 'uncategorized' != $category->slug && '' != trim( $category->name ) ) {
1457
					$post_cat_context = sprintf(
1458
						_x( 'In "%s"', 'in {category/tag name}', 'jetpack' ),
1459
						$category->name
1460
					);
1461
					/**
1462
					 * Filter the "In Category" line displayed in the post context below each Related Post.
1463
					 *
1464
					 * @module related-posts
1465
					 *
1466
					 * @since 3.2.0
1467
					 *
1468
					 * @param string $post_cat_context "In Category" line displayed in the post context below each Related Post.
1469
					 * @param array $category Array containing information about the category.
1470
					 */
1471
					return apply_filters( 'jetpack_relatedposts_post_category_context', $post_cat_context, $category );
1472
				}
1473
			}
1474
		}
1475
1476
		$tags = get_the_terms( $post_id, 'post_tag' );
1477
		if ( is_array( $tags ) ) {
@@ 1477-1497 (lines=21) @@
1474
		}
1475
1476
		$tags = get_the_terms( $post_id, 'post_tag' );
1477
		if ( is_array( $tags ) ) {
1478
			foreach ( $tags as $tag ) {
1479
				if ( '' != trim( $tag->name ) ) {
1480
					$post_tag_context = sprintf(
1481
						_x( 'In "%s"', 'in {category/tag name}', 'jetpack' ),
1482
						$tag->name
1483
					);
1484
					/**
1485
					 * Filter the "In Tag" line displayed in the post context below each Related Post.
1486
					 *
1487
					 * @module related-posts
1488
					 *
1489
					 * @since 3.2.0
1490
					 *
1491
					 * @param string $post_tag_context "In Tag" line displayed in the post context below each Related Post.
1492
					 * @param array $tag Array containing information about the tag.
1493
					 */
1494
					return apply_filters( 'jetpack_relatedposts_post_tag_context', $post_tag_context, $tag );
1495
				}
1496
			}
1497
		}
1498
1499
		$comment_count = get_comments_number( $post_id );
1500
		if ( $comment_count > 0 ) {