Code Duplication    Length = 15-16 lines in 2 locations

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

@@ 335-350 (lines=16) @@
332
	}
333
334
	/** SCRIPTS **/
335
	public function filter_inline_scripts( $src, $handle ) {
336
		global $wp_scripts;
337
338
		if ( is_admin() || ! isset( $wp_scripts->registered[$handle] ) ) {
339
			return $src;
340
		}
341
342
		$script = $wp_scripts->registered[$handle];
343
344
		// reset src to empty - can't return empty string though because then it skips rendering the tag
345
		if ( $this->should_inline_script( $script ) ) {
346
			return '#';
347
		}
348
349
		return $src;
350
	}
351
352
	public function print_inline_scripts( $tag, $handle, $src ) {
353
		global $wp_scripts;
@@ 438-452 (lines=15) @@
435
	}
436
437
	/** STYLES **/
438
	public function filter_inline_styles( $src, $handle ) {
439
		global $wp_scripts;
440
441
		if ( is_admin() || ! isset( $wp_scripts->registered[$handle] ) ) {
442
			return $src;
443
		}
444
445
		$style = $wp_scripts->registered[$handle];
446
447
		if ( $this->should_inline_style( $style ) ) {
448
			return '#';
449
		}
450
451
		return $src;
452
	}
453
454
	public function print_inline_styles( $tag, $handle, $href, $media ) {
455
		global $wp_styles;