Code Duplication    Length = 15-16 lines in 2 locations

modules/perf/class.jetpack-perf-optimize-assets.php 2 locations

@@ 182-197 (lines=16) @@
179
	}
180
181
	/** SCRIPTS **/
182
	public function filter_inline_scripts( $src, $handle ) {
183
		global $wp_scripts;
184
185
		if ( is_admin() || ! isset( $wp_scripts->registered[$handle] ) ) {
186
			return $src;
187
		}
188
189
		$script = $wp_scripts->registered[$handle];
190
191
		// reset src to empty - can't return empty string though because then it skips rendering the tag
192
		if ( $this->should_inline_script( $script ) ) {
193
			return '#';
194
		}
195
196
		return $src;
197
	}
198
199
	public function print_inline_scripts( $tag, $handle, $src ) {
200
		global $wp_scripts;
@@ 270-284 (lines=15) @@
267
	}
268
269
	/** STYLES **/
270
	public function filter_inline_styles( $src, $handle ) {
271
		global $wp_scripts;
272
273
		if ( is_admin() || ! isset( $wp_scripts->registered[$handle] ) ) {
274
			return $src;
275
		}
276
277
		$style = $wp_scripts->registered[$handle];
278
279
		if ( $this->should_inline_style( $style ) ) {
280
			return '#';
281
		}
282
283
		return $src;
284
	}
285
286
	public function print_inline_styles( $tag, $handle, $href, $media ) {
287
		global $wp_styles;