Code Duplication    Length = 4-4 lines in 6 locations

sal/class.json-api-post-base.php 2 locations

@@ 589-592 (lines=4) @@
586
587
		if ( in_array( $ext, array( 'jpg', 'jpeg', 'png', 'gif' ) ) ) {
588
			$metadata = wp_get_attachment_metadata( $media_item->ID );
589
			if ( isset( $metadata['height'], $metadata['width'] ) ) {
590
				$response['height'] = $metadata['height'];
591
				$response['width'] = $metadata['width'];
592
			}
593
594
			if ( isset( $metadata['sizes'] ) ) {
595
				/**
@@ 626-629 (lines=4) @@
623
624
		if ( in_array( $ext, array( 'ogv', 'mp4', 'mov', 'wmv', 'avi', 'mpg', '3gp', '3g2', 'm4v' ) ) ) {
625
			$metadata = wp_get_attachment_metadata( $media_item->ID );
626
			if ( isset( $metadata['height'], $metadata['width'] ) ) {
627
				$response['height'] = $metadata['height'];
628
				$response['width']  = $metadata['width'];
629
			}
630
631
			if ( isset( $metadata['length'] ) ) {
632
				$response['length'] = $metadata['length'];

3rd-party/class.jetpack-amp-support.php 1 location

@@ 192-195 (lines=4) @@
189
				)
190
			);
191
192
			if ( false !== $dimensions[ $image['src'] ] ) {
193
				$image['src_width']  = $dimensions['width'];
194
				$image['src_height'] = $dimensions['height'];
195
			}
196
		}
197
198
		$metadata['image'] = array(

functions.opengraph.php 1 location

@@ 330-333 (lines=4) @@
327
			if ( $post_images && ! is_wp_error( $post_images ) ) {
328
				foreach ( (array) $post_images as $post_image ) {
329
					$image['src'] = $post_image['src'];
330
					if ( isset( $post_image['src_width'], $post_image['src_height'] ) ) {
331
						$image['width']  = $post_image['src_width'];
332
						$image['height'] = $post_image['src_height'];
333
					}
334
					if ( ! empty( $post_image['alt_text'] ) ) {
335
						$image['alt_text'] = $post_image['alt_text'];
336
					}

class.json-api-endpoints.php 2 locations

@@ 1335-1338 (lines=4) @@
1332
1333
		if ( in_array( $ext, array( 'jpg', 'jpeg', 'png', 'gif' ) ) ) {
1334
			$metadata = wp_get_attachment_metadata( $media_item->ID );
1335
			if ( isset( $metadata['height'], $metadata['width'] ) ) {
1336
				$response['height'] = $metadata['height'];
1337
				$response['width']  = $metadata['width'];
1338
			}
1339
1340
			if ( isset( $metadata['sizes'] ) ) {
1341
				/**
@@ 1393-1396 (lines=4) @@
1390
		if ( $is_video ) {
1391
			$metadata = wp_get_attachment_metadata( $media_item->ID );
1392
1393
			if ( isset( $metadata['height'], $metadata['width'] ) ) {
1394
				$response['height'] = $metadata['height'];
1395
				$response['width']  = $metadata['width'];
1396
			}
1397
1398
			if ( isset( $metadata['length'] ) ) {
1399
				$response['length'] = $metadata['length'];