Code Duplication    Length = 15-16 lines in 2 locations

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

@@ 381-396 (lines=16) @@
378
	}
379
380
	/** SCRIPTS **/
381
	public function filter_inline_scripts( $src, $handle ) {
382
		global $wp_scripts;
383
384
		if ( is_admin() || ! isset( $wp_scripts->registered[$handle] ) ) {
385
			return $src;
386
		}
387
388
		$script = $wp_scripts->registered[$handle];
389
390
		// reset src to empty - can't return empty string though because then it skips rendering the tag
391
		if ( $this->should_inline_script( $script ) ) {
392
			return '#';
393
		}
394
395
		return $src;
396
	}
397
398
	public function print_inline_scripts( $tag, $handle, $src ) {
399
		global $wp_scripts;
@@ 489-503 (lines=15) @@
486
	}
487
488
	/** STYLES **/
489
	public function filter_inline_styles( $src, $handle ) {
490
		global $wp_scripts;
491
492
		if ( is_admin() || ! isset( $wp_scripts->registered[$handle] ) ) {
493
			return $src;
494
		}
495
496
		$style = $wp_scripts->registered[$handle];
497
498
		if ( $this->should_inline_style( $style ) ) {
499
			return '#';
500
		}
501
502
		return $src;
503
	}
504
505
	public function print_inline_styles( $tag, $handle, $href, $media ) {
506
		global $wp_styles;