Code Duplication    Length = 6-7 lines in 2 locations

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

@@ 410-415 (lines=6) @@
407
408
	private function script_has_deps( $handle ) {
409
		global $wp_scripts;
410
				foreach ( $wp_scripts->to_do as $other_script_handle ) {
411
						$other_script = $wp_scripts->registered[ $other_script_handle ];
412
						if ( in_array( $handle, $other_script->deps ) ) {
413
				return true;
414
						}
415
				}
416
417
		return false;
418
	}
@@ 427-433 (lines=7) @@
424
		$should_defer_script = $script->args === 0;
425
426
		// only make scripts deferred if nothing depends on them
427
		foreach ( $wp_scripts->to_do as $other_script_handle ) {
428
			$other_script = $wp_scripts->registered[ $other_script_handle ];
429
			if ( in_array( $script->handle, $other_script->deps ) ) {
430
				$should_defer_script = false;
431
				break;
432
			}
433
		}
434
435
		$should_defer_script = $should_defer_script || ( isset( $script->extra['jetpack-defer'] ) && $script->extra['jetpack-defer'] );
436
		return $this->defer_scripts && apply_filters( 'jetpack_perf_defer_script', $should_defer_script, $script->handle, $script->src );