Code Duplication    Length = 15-18 lines in 2 locations

projects/plugins/jetpack/class.json-api-endpoints.php 1 location

@@ 1389-1403 (lines=15) @@
1386
				 * @param string $media_id Attachment ID.
1387
				 */
1388
				$sizes = apply_filters( 'rest_api_thumbnail_sizes', $metadata['sizes'], $media_item->ID );
1389
				if ( is_array( $sizes ) ) {
1390
					foreach ( $sizes as $size => $size_details ) {
1391
						$response['thumbnails'][ $size ] = dirname( $response['URL'] ) . '/' . $size_details['file'];
1392
					}
1393
					/**
1394
					 * Filter the thumbnail URLs for attachment files.
1395
					 *
1396
					 * @module json-api
1397
					 *
1398
					 * @since 7.1.0
1399
					 *
1400
					 * @param array $metadata['sizes'] Array with thumbnail sizes as keys and URLs as values.
1401
					 */
1402
					$response['thumbnails'] = apply_filters( 'rest_api_thumbnail_size_urls', $response['thumbnails'] );
1403
				}
1404
			}
1405
1406
			if ( isset( $metadata['image_meta'] ) ) {

projects/plugins/jetpack/sal/class.json-api-post-base.php 1 location

@@ 590-607 (lines=18) @@
587
				$response['width'] = $metadata['width'];
588
			}
589
590
			if ( isset( $metadata['sizes'] ) ) {
591
				/**
592
				 * Filter the thumbnail sizes available for each attachment ID.
593
				 *
594
				 * @module json-api
595
				 *
596
				 * @since 3.9.0
597
				 *
598
				 * @param array $metadata['sizes'] Array of thumbnail sizes available for a given attachment ID.
599
				 * @param string $media_id Attachment ID.
600
				 */
601
				$sizes = apply_filters( 'rest_api_thumbnail_sizes', $metadata['sizes'], $media_id );
602
				if ( is_array( $sizes ) ) {
603
					foreach ( $sizes as $size => $size_details ) {
604
						$response['thumbnails'][ $size ] = dirname( $response['URL'] ) . '/' . $size_details['file'];
605
					}
606
				}
607
			}
608
609
			if ( isset( $metadata['image_meta'] ) ) {
610
				$response['exif'] = $metadata['image_meta'];