Code Duplication    Length = 21-21 lines in 2 locations

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

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