Code Duplication    Length = 7-9 lines in 4 locations

projects/packages/post-images/src/class-post-images.php 2 locations

@@ 680-688 (lines=9) @@
677
		if ( ! $media && $args['from_attachment'] ) {
678
			$media = self::from_attachment( $post_id, $args['width'], $args['height'] );
679
		}
680
		if ( ! $media && $args['from_blocks'] ) {
681
			if ( empty( $args['html_content'] ) ) {
682
				// Use the post_id, which will load the content.
683
				$media = self::from_blocks( $post_id, $args['width'], $args['height'] );
684
			} else {
685
				// If html_content is provided, use that.
686
				$media = self::from_blocks( $args['html_content'], $args['width'], $args['height'] );
687
			}
688
		}
689
		if ( ! $media && $args['from_html'] ) {
690
			if ( empty( $args['html_content'] ) ) {
691
				// Use the post_id, which will load the content.
@@ 689-697 (lines=9) @@
686
				$media = self::from_blocks( $args['html_content'], $args['width'], $args['height'] );
687
			}
688
		}
689
		if ( ! $media && $args['from_html'] ) {
690
			if ( empty( $args['html_content'] ) ) {
691
				// Use the post_id, which will load the content.
692
				$media = self::from_html( $post_id, $args['width'], $args['height'] );
693
			} else {
694
				// If html_content is provided, use that.
695
				$media = self::from_html( $args['html_content'], $args['width'], $args['height'] );
696
			}
697
		}
698
699
		if ( ! $media && $args['fallback_to_avatars'] ) {
700
			$media = self::from_blavatar( $post_id, $args['avatar_size'] );

projects/plugins/jetpack/class.jetpack-post-images.php 2 locations

@@ 691-697 (lines=7) @@
688
		if ( ! $media && $args['from_attachment'] ) {
689
			$media = self::from_attachment( $post_id, $args['width'], $args['height'] );
690
		}
691
		if ( ! $media && $args['from_blocks'] ) {
692
			if ( empty( $args['html_content'] ) ) {
693
				$media = self::from_blocks( $post_id, $args['width'], $args['height'] ); // Use the post_id, which will load the content
694
			} else {
695
				$media = self::from_blocks( $args['html_content'], $args['width'], $args['height'] ); // If html_content is provided, use that
696
			}
697
		}
698
		if ( ! $media && $args['from_html'] ) {
699
			if ( empty( $args['html_content'] ) ) {
700
				$media = self::from_html( $post_id, $args['width'], $args['height'] ); // Use the post_id, which will load the content
@@ 698-704 (lines=7) @@
695
				$media = self::from_blocks( $args['html_content'], $args['width'], $args['height'] ); // If html_content is provided, use that
696
			}
697
		}
698
		if ( ! $media && $args['from_html'] ) {
699
			if ( empty( $args['html_content'] ) ) {
700
				$media = self::from_html( $post_id, $args['width'], $args['height'] ); // Use the post_id, which will load the content
701
			} else {
702
				$media = self::from_html( $args['html_content'], $args['width'], $args['height'] ); // If html_content is provided, use that
703
			}
704
		}
705
706
		if ( ! $media && $args['fallback_to_avatars'] ) {
707
			$media = self::from_blavatar( $post_id, $args['avatar_size'] );