Code Duplication    Length = 12-12 lines in 2 locations

modules/photon-cdn.php 2 locations

@@ 156-167 (lines=12) @@
153
			return false;
154
		}
155
156
		foreach ( $wp_scripts->registered as $handle => $thing ) {
157
			if ( wp_startswith( $thing->src, self::CDN ) ) {
158
				continue;
159
			}
160
			if ( wp_startswith( $thing->src, $plugin_directory_url ) ) {
161
				$local_path = substr( $thing->src, strlen( $plugin_directory_url ) );
162
				if ( in_array( $local_path, $assets, true ) ) {
163
					$wp_scripts->registered[ $handle ]->src = sprintf( self::CDN . 'p/%1$s/%2$s/%3$s', $plugin_slug, $current_version, $local_path );
164
					$wp_scripts->registered[ $handle ]->ver = null;
165
				}
166
			}
167
		}
168
		foreach ( $wp_styles->registered as $handle => $thing ) {
169
			if ( wp_startswith( $thing->src, self::CDN ) ) {
170
				continue;
@@ 168-179 (lines=12) @@
165
				}
166
			}
167
		}
168
		foreach ( $wp_styles->registered as $handle => $thing ) {
169
			if ( wp_startswith( $thing->src, self::CDN ) ) {
170
				continue;
171
			}
172
			if ( wp_startswith( $thing->src, $plugin_directory_url ) ) {
173
				$local_path = substr( $thing->src, strlen( $plugin_directory_url ) );
174
				if ( in_array( $local_path, $assets, true ) ) {
175
					$wp_styles->registered[ $handle ]->src = sprintf( self::CDN . 'p/%1$s/%2$s/%3$s', $plugin_slug, $current_version, $local_path );
176
					$wp_styles->registered[ $handle ]->ver = null;
177
				}
178
			}
179
		}
180
	}
181
182
	/**