Code Duplication    Length = 20-20 lines in 2 locations

class.jetpack-gutenberg.php 2 locations

@@ 42-61 (lines=20) @@
39
		 *
40
		 * @param bool false Whether to load Gutenberg blocks from CDN
41
		 */
42
		if ( apply_filters( 'jetpack_gutenberg_cdn', false ) ) {
43
			$cdn_base    = 'https://s0.wp.com/wp-content/mu-plugins/jetpack/_inc/blocks';
44
			$view_script = "$cdn_base/view.js";
45
			$view_style  = "$cdn_base/view$rtl.css";
46
47
			/**
48
			 * Filter to modify cache busting for Gutenberg block assets loaded from CDN
49
			 *
50
			 * @since 6.5.0
51
			 *
52
			 * @param string
53
			 */
54
			$version = apply_filters( 'jetpack_gutenberg_cdn_cache_buster', sprintf( '%s-%s', gmdate( 'd-m-Y' ), JETPACK__VERSION ) );
55
		} else {
56
			$view_script = plugins_url( '_inc/blocks/view.js', JETPACK__PLUGIN_FILE );
57
			$view_style  = plugins_url( "_inc/blocks/view$rtl.css", JETPACK__PLUGIN_FILE );
58
			$version     = Jetpack::is_development_version() && file_exists( JETPACK__PLUGIN_DIR . '_inc/blocks/view.js' )
59
				? filemtime( JETPACK__PLUGIN_DIR . '_inc/blocks/view.js' )
60
				: JETPACK__VERSION;
61
		}
62
63
		wp_enqueue_script(
64
			'jetpack-blocks-view',
@@ 90-109 (lines=20) @@
87
		$rtl = is_rtl() ? '.rtl' : '';
88
89
		/** This filter is already documented above */
90
		if ( apply_filters( 'jetpack_gutenberg_cdn', false ) ) {
91
			$cdn_base      = 'https://s0.wp.com/wp-content/mu-plugins/jetpack/_inc/blocks';
92
			$editor_script = "$cdn_base/editor.js";
93
			$editor_style  = "$cdn_base/editor$rtl.css";
94
95
			/** This filter is already documented above */
96
			$version = apply_filters( 'jetpack_gutenberg_cdn_cache_buster', sprintf( '%s-%s', gmdate( 'd-m-Y' ), JETPACK__VERSION ) );
97
		} else {
98
			$editor_script = plugins_url( '_inc/blocks/editor.js', JETPACK__PLUGIN_FILE );
99
			$editor_style  = plugins_url( "_inc/blocks/editor$rtl.css", JETPACK__PLUGIN_FILE );
100
			$version       = Jetpack::is_development_version() && file_exists( JETPACK__PLUGIN_DIR . '_inc/blocks/editor.js' )
101
				? filemtime( JETPACK__PLUGIN_DIR . '_inc/blocks/editor.js' )
102
				: JETPACK__VERSION;
103
		}
104
105
		wp_enqueue_script(
106
			'jetpack-blocks-editor',
107
			$editor_script,
108
			array(
109
				'lodash',
110
				'wp-api-fetch',
111
				'wp-blocks',
112
				'wp-components',