Code Duplication    Length = 15-15 lines in 2 locations

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

@@ 380-394 (lines=15) @@
377
		 *
378
		 * @to-do: instead of looping manually (that's a lot of if and loops), search recursively instead.
379
		 */
380
		foreach ( $blocks as $block ) {
381
			if ( ! self::is_nested_block( $block ) || 'core/media-text' === $block['blockName'] ) {
382
				$images = self::get_images_from_block( $images, $block, $html_info, $width, $height );
383
			} else {
384
				foreach ( $block['innerBlocks'] as $inner_block ) {
385
					if ( ! self::is_nested_block( $inner_block ) ) {
386
						$images = self::get_images_from_block( $images, $inner_block, $html_info, $width, $height );
387
					} else {
388
						foreach ( $inner_block['innerBlocks'] as $inner_inner_block ) {
389
							$images = self::get_images_from_block( $images, $inner_inner_block, $html_info, $width, $height );
390
						}
391
					}
392
				}
393
			}
394
		}
395
396
		/**
397
		 * Returning a filtered array because get_attachment_data returns false

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

@@ 376-390 (lines=15) @@
373
		 *
374
		 * @to-do: instead of looping manually (that's a lot of if and loops), search recursively instead.
375
		 */
376
		foreach ( $blocks as $block ) {
377
			if ( ! self::is_nested_block( $block ) || 'core/media-text' === $block['blockName'] ) {
378
				$images = self::get_images_from_block( $images, $block, $html_info, $width, $height );
379
			} else {
380
				foreach ( $block['innerBlocks'] as $inner_block ) {
381
					if ( ! self::is_nested_block( $inner_block ) ) {
382
						$images = self::get_images_from_block( $images, $inner_block, $html_info, $width, $height );
383
					} else {
384
						foreach ( $inner_block['innerBlocks'] as $inner_inner_block ) {
385
							$images = self::get_images_from_block( $images, $inner_inner_block, $html_info, $width, $height );
386
						}
387
					}
388
				}
389
			}
390
		}
391
392
		/**
393
		 * Returning a filtered array because get_attachment_data returns false