Code Duplication    Length = 12-12 lines in 2 locations

modules/photon-cdn.php 2 locations

@@ 116-127 (lines=12) @@
113
			return false;
114
		}
115
116
		foreach ( $wp_scripts->registered as $handle => $thing ) {
117
			if ( wp_startswith( $thing->src, self::CDN ) ) {
118
				continue;
119
			}
120
			if ( wp_startswith( $thing->src, $plugin_directory_url ) ) {
121
				$local_path = substr( $thing->src, strlen( $plugin_directory_url ) );
122
				if ( in_array( $local_path, $assets, true ) ) {
123
					$wp_scripts->registered[ $handle ]->src = sprintf( self::CDN . 'p/%1$s/%2$s/%3$s', $plugin_slug, $current_version, $local_path );
124
					$wp_scripts->registered[ $handle ]->ver = null;
125
				}
126
			}
127
		}
128
		foreach ( $wp_styles->registered as $handle => $thing ) {
129
			if ( wp_startswith( $thing->src, self::CDN ) ) {
130
				continue;
@@ 128-139 (lines=12) @@
125
				}
126
			}
127
		}
128
		foreach ( $wp_styles->registered as $handle => $thing ) {
129
			if ( wp_startswith( $thing->src, self::CDN ) ) {
130
				continue;
131
			}
132
			if ( wp_startswith( $thing->src, $plugin_directory_url ) ) {
133
				$local_path = substr( $thing->src, strlen( $plugin_directory_url ) );
134
				if ( in_array( $local_path, $assets, true ) ) {
135
					$wp_styles->registered[ $handle ]->src = sprintf( self::CDN . 'p/%1$s/%2$s/%3$s', $plugin_slug, $current_version, $local_path );
136
					$wp_styles->registered[ $handle ]->ver = null;
137
				}
138
			}
139
		}
140
	}
141
142
	/**