Code Duplication    Length = 6-7 lines in 2 locations

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

@@ 400-405 (lines=6) @@
397
398
	private function script_has_deps( $handle ) {
399
		global $wp_scripts;
400
                foreach ( $wp_scripts->to_do as $other_script_handle ) {
401
                        $other_script = $wp_scripts->registered[ $other_script_handle ];
402
                        if ( in_array( $handle, $other_script->deps ) ) {
403
				return true;
404
                        }
405
                }
406
407
		return false;
408
	}
@@ 417-423 (lines=7) @@
414
		$should_defer_script = $script->args === 0;
415
416
		// only make scripts deferred if nothing depends on them
417
		foreach ( $wp_scripts->to_do as $other_script_handle ) {
418
			$other_script = $wp_scripts->registered[ $other_script_handle ];
419
			if ( in_array( $script->handle, $other_script->deps ) ) {
420
				$should_defer_script = false;
421
				break;
422
			}
423
		}
424
425
		$should_defer_script = $should_defer_script || ( isset( $script->extra['jetpack-defer'] ) && $script->extra['jetpack-defer'] );
426
		return $this->defer_scripts && apply_filters( 'jetpack_perf_defer_script', $should_defer_script, $script->handle, $script->src );