Code Duplication    Length = 21-21 lines in 2 locations

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

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