Code Duplication    Length = 12-12 lines in 2 locations

modules/photon-cdn.php 2 locations

@@ 139-150 (lines=12) @@
136
			return false;
137
		}
138
139
		foreach ( $wp_scripts->registered as $handle => $thing ) {
140
			if ( wp_startswith( $thing->src, self::CDN ) ) {
141
				continue;
142
			}
143
			if ( wp_startswith( $thing->src, $plugin_directory_url ) ) {
144
				$local_path = substr( $thing->src, strlen( $plugin_directory_url ) );
145
				if ( in_array( $local_path, $assets, true ) ) {
146
					$wp_scripts->registered[ $handle ]->src = sprintf( self::CDN . 'p/%1$s/%2$s/%3$s', $plugin_slug, $current_version, $local_path );
147
					$wp_scripts->registered[ $handle ]->ver = null;
148
				}
149
			}
150
		}
151
		foreach ( $wp_styles->registered as $handle => $thing ) {
152
			if ( wp_startswith( $thing->src, self::CDN ) ) {
153
				continue;
@@ 151-162 (lines=12) @@
148
				}
149
			}
150
		}
151
		foreach ( $wp_styles->registered as $handle => $thing ) {
152
			if ( wp_startswith( $thing->src, self::CDN ) ) {
153
				continue;
154
			}
155
			if ( wp_startswith( $thing->src, $plugin_directory_url ) ) {
156
				$local_path = substr( $thing->src, strlen( $plugin_directory_url ) );
157
				if ( in_array( $local_path, $assets, true ) ) {
158
					$wp_styles->registered[ $handle ]->src = sprintf( self::CDN . 'p/%1$s/%2$s/%3$s', $plugin_slug, $current_version, $local_path );
159
					$wp_styles->registered[ $handle ]->ver = null;
160
				}
161
			}
162
		}
163
	}
164
165
	/**