Code Duplication    Length = 21-21 lines in 2 locations

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

@@ 1344-1364 (lines=21) @@
1341
	 */
1342
	protected function _generate_related_post_context( $post_id ) {
1343
		$categories = get_the_category( $post_id );
1344
		if ( is_array( $categories ) ) {
1345
			foreach ( $categories as $category ) {
1346
				if ( 'uncategorized' != $category->slug && '' != trim( $category->name ) ) {
1347
					$post_cat_context = sprintf(
1348
						_x( 'In "%s"', 'in {category/tag name}', 'jetpack' ),
1349
						$category->name
1350
					);
1351
					/**
1352
					 * Filter the "In Category" line displayed in the post context below each Related Post.
1353
					 *
1354
					 * @module related-posts
1355
					 *
1356
					 * @since 3.2.0
1357
					 *
1358
					 * @param string $post_cat_context "In Category" line displayed in the post context below each Related Post.
1359
					 * @param array $category Array containing information about the category.
1360
					 */
1361
					return apply_filters( 'jetpack_relatedposts_post_category_context', $post_cat_context, $category );
1362
				}
1363
			}
1364
		}
1365
1366
		$tags = get_the_terms( $post_id, 'post_tag' );
1367
		if ( is_array( $tags ) ) {
@@ 1367-1387 (lines=21) @@
1364
		}
1365
1366
		$tags = get_the_terms( $post_id, 'post_tag' );
1367
		if ( is_array( $tags ) ) {
1368
			foreach ( $tags as $tag ) {
1369
				if ( '' != trim( $tag->name ) ) {
1370
					$post_tag_context = sprintf(
1371
						_x( 'In "%s"', 'in {category/tag name}', 'jetpack' ),
1372
						$tag->name
1373
					);
1374
					/**
1375
					 * Filter the "In Tag" line displayed in the post context below each Related Post.
1376
					 *
1377
					 * @module related-posts
1378
					 *
1379
					 * @since 3.2.0
1380
					 *
1381
					 * @param string $post_tag_context "In Tag" line displayed in the post context below each Related Post.
1382
					 * @param array $tag Array containing information about the tag.
1383
					 */
1384
					return apply_filters( 'jetpack_relatedposts_post_tag_context', $post_tag_context, $tag );
1385
				}
1386
			}
1387
		}
1388
1389
		$comment_count = get_comments_number( $post_id );
1390
		if ( $comment_count > 0 ) {