Code Duplication    Length = 6-7 lines in 2 locations

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

@@ 451-456 (lines=6) @@
448
449
	private function script_has_deps( $handle ) {
450
		global $wp_scripts;
451
				foreach ( $wp_scripts->to_do as $other_script_handle ) {
452
						$other_script = $wp_scripts->registered[ $other_script_handle ];
453
						if ( in_array( $handle, $other_script->deps ) ) {
454
				return true;
455
						}
456
				}
457
458
		return false;
459
	}
@@ 468-474 (lines=7) @@
465
		$should_defer_script = $script->args === 0;
466
467
		// only make scripts deferred if nothing depends on them
468
		foreach ( $wp_scripts->to_do as $other_script_handle ) {
469
			$other_script = $wp_scripts->registered[ $other_script_handle ];
470
			if ( in_array( $script->handle, $other_script->deps ) ) {
471
				$should_defer_script = false;
472
				break;
473
			}
474
		}
475
476
		$should_defer_script = $should_defer_script || ( isset( $script->extra['jetpack-defer'] ) && $script->extra['jetpack-defer'] );
477
		return $this->defer_scripts && apply_filters( 'jetpack_perf_defer_script', $should_defer_script, $script->handle, $script->src );