Code Duplication    Length = 12-12 lines in 2 locations

modules/photon-cdn.php 2 locations

@@ 85-96 (lines=12) @@
82
			return false;
83
		}
84
85
		foreach ( $wp_scripts->registered as $handle => $thing ) {
86
			if ( wp_startswith( $thing->src, self::CDN ) ) {
87
				continue;
88
			}
89
			if ( wp_startswith( $thing->src, $plugin_directory_url ) ) {
90
				$local_path = substr( $thing->src, strlen( $plugin_directory_url ) );
91
				if ( in_array( $local_path, $assets ) ) {
92
					$wp_scripts->registered[ $handle ]->src = sprintf(self::CDN . 'p/%1$s/%2$s/%3$s', $plugin_slug, $current_version, $local_path );
93
					$wp_scripts->registered[ $handle ]->ver = null;
94
				}
95
			}
96
		}
97
		foreach ( $wp_styles->registered as $handle => $thing ) {
98
			if ( wp_startswith( $thing->src, self::CDN ) ) {
99
				continue;
@@ 97-108 (lines=12) @@
94
				}
95
			}
96
		}
97
		foreach ( $wp_styles->registered as $handle => $thing ) {
98
			if ( wp_startswith( $thing->src, self::CDN ) ) {
99
				continue;
100
			}
101
			if ( wp_startswith( $thing->src, $plugin_directory_url ) ) {
102
				$local_path = substr( $thing->src, strlen( $plugin_directory_url ) );
103
				if ( in_array( $local_path, $assets ) ) {
104
					$wp_styles->registered[ $handle ]->src = sprintf(self::CDN . 'p/%1$s/%2$s/%3$s', $plugin_slug, $current_version, $local_path );
105
					$wp_styles->registered[ $handle ]->ver = null;
106
				}
107
			}
108
		}
109
	}
110
111
	/**