Code Duplication    Length = 12-12 lines in 2 locations

modules/photon-cdn.php 2 locations

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