Code Duplication    Length = 21-21 lines in 2 locations

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

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