Code Duplication    Length = 12-12 lines in 2 locations

modules/photon-cdn.php 2 locations

@@ 120-131 (lines=12) @@
117
			return false;
118
		}
119
120
		foreach ( $wp_scripts->registered as $handle => $thing ) {
121
			if ( wp_startswith( $thing->src, self::CDN ) ) {
122
				continue;
123
			}
124
			if ( wp_startswith( $thing->src, $plugin_directory_url ) ) {
125
				$local_path = substr( $thing->src, strlen( $plugin_directory_url ) );
126
				if ( in_array( $local_path, $assets, true ) ) {
127
					$wp_scripts->registered[ $handle ]->src = sprintf( self::CDN . 'p/%1$s/%2$s/%3$s', $plugin_slug, $current_version, $local_path );
128
					$wp_scripts->registered[ $handle ]->ver = null;
129
				}
130
			}
131
		}
132
		foreach ( $wp_styles->registered as $handle => $thing ) {
133
			if ( wp_startswith( $thing->src, self::CDN ) ) {
134
				continue;
@@ 132-143 (lines=12) @@
129
				}
130
			}
131
		}
132
		foreach ( $wp_styles->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_styles->registered[ $handle ]->src = sprintf( self::CDN . 'p/%1$s/%2$s/%3$s', $plugin_slug, $current_version, $local_path );
140
					$wp_styles->registered[ $handle ]->ver = null;
141
				}
142
			}
143
		}
144
	}
145
146
	/**