Code Duplication    Length = 21-21 lines in 2 locations

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

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