Code Duplication    Length = 21-21 lines in 2 locations

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

@@ 1563-1583 (lines=21) @@
1560
	 */
1561
	protected function _generate_related_post_context( $post_id ) {
1562
		$categories = get_the_category( $post_id );
1563
		if ( is_array( $categories ) ) {
1564
			foreach ( $categories as $category ) {
1565
				if ( 'uncategorized' != $category->slug && '' != trim( $category->name ) ) {
1566
					$post_cat_context = sprintf(
1567
						esc_html_x( 'In "%s"', 'in {category/tag name}', 'jetpack' ),
1568
						$category->name
1569
					);
1570
					/**
1571
					 * Filter the "In Category" line displayed in the post context below each Related Post.
1572
					 *
1573
					 * @module related-posts
1574
					 *
1575
					 * @since 3.2.0
1576
					 *
1577
					 * @param string $post_cat_context "In Category" line displayed in the post context below each Related Post.
1578
					 * @param array $category Array containing information about the category.
1579
					 */
1580
					return apply_filters( 'jetpack_relatedposts_post_category_context', $post_cat_context, $category );
1581
				}
1582
			}
1583
		}
1584
1585
		$tags = get_the_terms( $post_id, 'post_tag' );
1586
		if ( is_array( $tags ) ) {
@@ 1586-1606 (lines=21) @@
1583
		}
1584
1585
		$tags = get_the_terms( $post_id, 'post_tag' );
1586
		if ( is_array( $tags ) ) {
1587
			foreach ( $tags as $tag ) {
1588
				if ( '' != trim( $tag->name ) ) {
1589
					$post_tag_context = sprintf(
1590
						_x( 'In "%s"', 'in {category/tag name}', 'jetpack' ),
1591
						$tag->name
1592
					);
1593
					/**
1594
					 * Filter the "In Tag" line displayed in the post context below each Related Post.
1595
					 *
1596
					 * @module related-posts
1597
					 *
1598
					 * @since 3.2.0
1599
					 *
1600
					 * @param string $post_tag_context "In Tag" line displayed in the post context below each Related Post.
1601
					 * @param array $tag Array containing information about the tag.
1602
					 */
1603
					return apply_filters( 'jetpack_relatedposts_post_tag_context', $post_tag_context, $tag );
1604
				}
1605
			}
1606
		}
1607
1608
		$comment_count = get_comments_number( $post_id );
1609
		if ( $comment_count > 0 ) {