Code Duplication    Length = 21-21 lines in 2 locations

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

@@ 1637-1657 (lines=21) @@
1634
	 */
1635
	protected function _generate_related_post_context( $post_id ) {
1636
		$categories = get_the_category( $post_id );
1637
		if ( is_array( $categories ) ) {
1638
			foreach ( $categories as $category ) {
1639
				if ( 'uncategorized' != $category->slug && '' != trim( $category->name ) ) {
1640
					$post_cat_context = sprintf(
1641
						esc_html_x( 'In "%s"', 'in {category/tag name}', 'jetpack' ),
1642
						$category->name
1643
					);
1644
					/**
1645
					 * Filter the "In Category" line displayed in the post context below each Related Post.
1646
					 *
1647
					 * @module related-posts
1648
					 *
1649
					 * @since 3.2.0
1650
					 *
1651
					 * @param string $post_cat_context "In Category" line displayed in the post context below each Related Post.
1652
					 * @param array $category Array containing information about the category.
1653
					 */
1654
					return apply_filters( 'jetpack_relatedposts_post_category_context', $post_cat_context, $category );
1655
				}
1656
			}
1657
		}
1658
1659
		$tags = get_the_terms( $post_id, 'post_tag' );
1660
		if ( is_array( $tags ) ) {
@@ 1660-1680 (lines=21) @@
1657
		}
1658
1659
		$tags = get_the_terms( $post_id, 'post_tag' );
1660
		if ( is_array( $tags ) ) {
1661
			foreach ( $tags as $tag ) {
1662
				if ( '' != trim( $tag->name ) ) {
1663
					$post_tag_context = sprintf(
1664
						_x( 'In "%s"', 'in {category/tag name}', 'jetpack' ),
1665
						$tag->name
1666
					);
1667
					/**
1668
					 * Filter the "In Tag" line displayed in the post context below each Related Post.
1669
					 *
1670
					 * @module related-posts
1671
					 *
1672
					 * @since 3.2.0
1673
					 *
1674
					 * @param string $post_tag_context "In Tag" line displayed in the post context below each Related Post.
1675
					 * @param array $tag Array containing information about the tag.
1676
					 */
1677
					return apply_filters( 'jetpack_relatedposts_post_tag_context', $post_tag_context, $tag );
1678
				}
1679
			}
1680
		}
1681
1682
		$comment_count = get_comments_number( $post_id );
1683
		if ( $comment_count > 0 ) {