Code Duplication    Length = 12-12 lines in 2 locations

modules/photon-cdn.php 2 locations

@@ 70-81 (lines=12) @@
67
			return false;
68
		}
69
70
		foreach ( $wp_scripts->registered as $handle => $thing ) {
71
			if ( wp_startswith( $thing->src, self::CDN ) ) {
72
				continue;
73
			}
74
			if ( wp_startswith( $thing->src, $plugin_directory_url ) ) {
75
				$local_path = substr( $thing->src, strlen( $plugin_directory_url ) );
76
				if ( in_array( $local_path, $assets ) ) {
77
					$wp_scripts->registered[ $handle ]->src = sprintf(self::CDN . 'p/%1$s/%2$s/%3$s', $plugin_slug, $current_version, $local_path );
78
					$wp_scripts->registered[ $handle ]->ver = null;
79
				}
80
			}
81
		}
82
		foreach ( $wp_styles->registered as $handle => $thing ) {
83
			if ( wp_startswith( $thing->src, self::CDN ) ) {
84
				continue;
@@ 82-93 (lines=12) @@
79
				}
80
			}
81
		}
82
		foreach ( $wp_styles->registered as $handle => $thing ) {
83
			if ( wp_startswith( $thing->src, self::CDN ) ) {
84
				continue;
85
			}
86
			if ( wp_startswith( $thing->src, $plugin_directory_url ) ) {
87
				$local_path = substr( $thing->src, strlen( $plugin_directory_url ) );
88
				if ( in_array( $local_path, $assets ) ) {
89
					$wp_styles->registered[ $handle ]->src = sprintf(self::CDN . 'p/%1$s/%2$s/%3$s', $plugin_slug, $current_version, $local_path );
90
					$wp_styles->registered[ $handle ]->ver = null;
91
				}
92
			}
93
		}
94
	}
95
96
	/**