Code Duplication    Length = 22-22 lines in 2 locations

modules/amp/includes/embeds/class-amp-instagram-embed.php 1 location

@@ 58-79 (lines=22) @@
55
		return $this->render( array( 'url' => $url, 'instagram_id' =>  end( $matches ) ) );
56
	}
57
58
	public function render( $args ) {
59
		$args = wp_parse_args( $args, array(
60
			'url' => false,
61
			'instagram_id' => false,
62
		) );
63
64
		if ( empty( $args['instagram_id'] ) ) {
65
			return AMP_HTML_Utils::build_tag( 'a', array( 'href' => esc_url( $args['url'] ), 'class' => 'amp-wp-embed-fallback' ), esc_html( $args['url'] ) );
66
		}
67
68
		$this->did_convert_elements = true;
69
70
		return AMP_HTML_Utils::build_tag(
71
			'amp-instagram',
72
			array(
73
				'data-shortcode' => $args['instagram_id'],
74
				'layout' => 'responsive',
75
				'width' => $this->args['width'],
76
				'height' => $this->args['height'],
77
			)
78
		);
79
	}
80
81
	private function get_instagram_id_from_url( $url ) {
82
		$found = preg_match( self::URL_PATTERN, $url, $matches );

modules/amp/includes/embeds/class-amp-vine-embed.php 1 location

@@ 34-55 (lines=22) @@
31
		return $this->render( array( 'url' => $url, 'vine_id' =>  end( $matches ) ) );
32
	}
33
34
	public function render( $args ) {
35
		$args = wp_parse_args( $args, array(
36
			'url' => false,
37
			'vine_id' => false,
38
		) );
39
40
		if ( empty( $args['vine_id'] ) ) {
41
			return AMP_HTML_Utils::build_tag( 'a', array( 'href' => esc_url( $args['url'] ), 'class' => 'amp-wp-embed-fallback' ), esc_html( $args['url'] ) );
42
		}
43
44
		$this->did_convert_elements = true;
45
46
		return AMP_HTML_Utils::build_tag(
47
			'amp-vine',
48
			array(
49
				'data-vineid' => $args['vine_id'],
50
				'layout' => 'responsive',
51
				'width' => $this->args['width'],
52
				'height' => $this->args['height'],
53
			)
54
		);
55
	}
56
}
57