Code Duplication    Length = 24-24 lines in 2 locations

projects/packages/post-images/src/class-post-images.php 1 location

@@ 321-344 (lines=24) @@
318
319
		}
320
321
		if ( empty( $images ) && ( defined( 'IS_WPCOM' ) && \IS_WPCOM ) ) {
322
			$meta_thumbnail = get_post_meta( $post_id, '_jetpack_post_thumbnail', true );
323
			if ( ! empty( $meta_thumbnail ) ) {
324
				if ( ! isset( $meta_thumbnail['width'] ) || $meta_thumbnail['width'] < $width ) {
325
					return $images;
326
				}
327
328
				if ( ! isset( $meta_thumbnail['height'] ) || $meta_thumbnail['height'] < $height ) {
329
					return $images;
330
				}
331
332
				$images = array(
333
					array( // Other methods below all return an array of arrays.
334
						'type'       => 'image',
335
						'from'       => 'thumbnail',
336
						'src'        => $meta_thumbnail['URL'],
337
						'src_width'  => $meta_thumbnail['width'],
338
						'src_height' => $meta_thumbnail['height'],
339
						'href'       => $meta_thumbnail['URL'],
340
						'alt_text'   => self::get_alt_text( $thumb ),
341
					),
342
				);
343
			}
344
		}
345
346
		return $images;
347
	}

projects/plugins/jetpack/class.jetpack-post-images.php 1 location

@@ 314-337 (lines=24) @@
311
312
		}
313
314
		if ( empty( $images ) && ( defined( 'IS_WPCOM' ) && IS_WPCOM ) ) {
315
			$meta_thumbnail = get_post_meta( $post_id, '_jetpack_post_thumbnail', true );
316
			if ( ! empty( $meta_thumbnail ) ) {
317
				if ( ! isset( $meta_thumbnail['width'] ) || $meta_thumbnail['width'] < $width ) {
318
					return $images;
319
				}
320
321
				if ( ! isset( $meta_thumbnail['height'] ) || $meta_thumbnail['height'] < $height ) {
322
					return $images;
323
				}
324
325
				$images = array(
326
					array( // Other methods below all return an array of arrays
327
						'type'       => 'image',
328
						'from'       => 'thumbnail',
329
						'src'        => $meta_thumbnail['URL'],
330
						'src_width'  => $meta_thumbnail['width'],
331
						'src_height' => $meta_thumbnail['height'],
332
						'href'       => $meta_thumbnail['URL'],
333
						'alt_text'   => self::get_alt_text( $thumb ),
334
					),
335
				);
336
			}
337
		}
338
339
		return $images;
340
	}