Code Duplication    Length = 21-21 lines in 2 locations

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

@@ 1473-1493 (lines=21) @@
1470
	 */
1471
	protected function _generate_related_post_context( $post_id ) {
1472
		$categories = get_the_category( $post_id );
1473
		if ( is_array( $categories ) ) {
1474
			foreach ( $categories as $category ) {
1475
				if ( 'uncategorized' != $category->slug && '' != trim( $category->name ) ) {
1476
					$post_cat_context = sprintf(
1477
						_x( 'In "%s"', 'in {category/tag name}', 'jetpack' ),
1478
						$category->name
1479
					);
1480
					/**
1481
					 * Filter the "In Category" line displayed in the post context below each Related Post.
1482
					 *
1483
					 * @module related-posts
1484
					 *
1485
					 * @since 3.2.0
1486
					 *
1487
					 * @param string $post_cat_context "In Category" line displayed in the post context below each Related Post.
1488
					 * @param array $category Array containing information about the category.
1489
					 */
1490
					return apply_filters( 'jetpack_relatedposts_post_category_context', $post_cat_context, $category );
1491
				}
1492
			}
1493
		}
1494
1495
		$tags = get_the_terms( $post_id, 'post_tag' );
1496
		if ( is_array( $tags ) ) {
@@ 1496-1516 (lines=21) @@
1493
		}
1494
1495
		$tags = get_the_terms( $post_id, 'post_tag' );
1496
		if ( is_array( $tags ) ) {
1497
			foreach ( $tags as $tag ) {
1498
				if ( '' != trim( $tag->name ) ) {
1499
					$post_tag_context = sprintf(
1500
						_x( 'In "%s"', 'in {category/tag name}', 'jetpack' ),
1501
						$tag->name
1502
					);
1503
					/**
1504
					 * Filter the "In Tag" line displayed in the post context below each Related Post.
1505
					 *
1506
					 * @module related-posts
1507
					 *
1508
					 * @since 3.2.0
1509
					 *
1510
					 * @param string $post_tag_context "In Tag" line displayed in the post context below each Related Post.
1511
					 * @param array $tag Array containing information about the tag.
1512
					 */
1513
					return apply_filters( 'jetpack_relatedposts_post_tag_context', $post_tag_context, $tag );
1514
				}
1515
			}
1516
		}
1517
1518
		$comment_count = get_comments_number( $post_id );
1519
		if ( $comment_count > 0 ) {