Code Duplication    Length = 8-11 lines in 2 locations

modules/pwa/class.jetpack-pwa-service-worker.php 1 location

@@ 186-193 (lines=8) @@
183
		// resolve asset dependencies and capture URLs
184
		global $wp_scripts;
185
		$wp_scripts->all_deps( $wp_scripts->queue, true );
186
		foreach( $wp_scripts->to_do as $handle ) {
187
			$registration = $wp_scripts->registered[$handle];
188
			$url = apply_filters( 'script_loader_src', $registration->src, $handle );
189
			if ( $registration->ver ) {
190
				$url = add_query_arg( 'ver', $registration->ver, $url );
191
			}
192
			$asset_urls[] = $url;
193
		}
194
195
		global $wp_styles;
196
		$wp_styles->all_deps( $wp_styles->queue, true );

modules/perf/class.jetpack-perf-optimize-assets.php 1 location

@@ 163-173 (lines=11) @@
160
161
		// fetch all deps for head
162
		$wp_scripts->all_deps( $wp_scripts->queue, true, 1 );
163
		foreach( $wp_scripts->to_do as $handle ) {
164
			$registration = $wp_scripts->registered[$handle];
165
			if ( $registration->args !== NULL ) {
166
				// skip, this asset has an explicit location
167
				continue;
168
			}
169
170
			$asset_group = apply_filters( 'jetpack_perf_asset_group', 1, $handle );
171
			$registration->args = $asset_group;
172
			$wp_scripts->groups[$handle] = $asset_group;
173
		}
174
	}
175
176
	// scripts that run after CSS <link>s in the header block waiting for the CSS to load