Code Duplication    Length = 15-16 lines in 2 locations

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

@@ 148-163 (lines=16) @@
145
	}
146
147
	/** SCRIPTS **/
148
	public function filter_inline_scripts( $src, $handle ) {
149
		global $wp_scripts;
150
151
		if ( is_admin() || ! isset( $wp_scripts->registered[$handle] ) ) {
152
			return $src;
153
		}
154
155
		$script = $wp_scripts->registered[$handle];
156
157
		// reset src to empty - can't return empty string though because then it skips rendering the tag
158
		if ( $this->should_inline_script( $script ) ) {
159
			return '#';
160
		}
161
162
		return $src;
163
	}
164
165
	public function print_inline_scripts( $tag, $handle, $src ) {
166
		global $wp_scripts;
@@ 235-249 (lines=15) @@
232
	}
233
234
	/** STYLES **/
235
	public function filter_inline_styles( $src, $handle ) {
236
		global $wp_scripts;
237
238
		if ( is_admin() || ! isset( $wp_scripts->registered[$handle] ) ) {
239
			return $src;
240
		}
241
242
		$style = $wp_scripts->registered[$handle];
243
244
		if ( $this->should_inline_style( $style ) ) {
245
			return '#';
246
		}
247
248
		return $src;
249
	}
250
251
	public function print_inline_styles( $tag, $handle, $href, $media ) {
252
		global $wp_styles;