Code Duplication    Length = 21-21 lines in 2 locations

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

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