Code Duplication    Length = 11-13 lines in 2 locations

json-endpoints/jetpack/class.jetpack-json-api-plugins-endpoint.php 1 location

@@ 283-293 (lines=11) @@
280
	}
281
282
283
	protected function validate_plugin( $plugin ) {
284
		if ( ! isset( $plugin) || empty( $plugin ) ) {
285
			return new WP_Error( 'missing_plugin', __( 'You are required to specify a plugin to activate.', 'jetpack' ), 400 );
286
		}
287
288
		if ( is_wp_error( $error = validate_plugin( $plugin ) ) ) {
289
			return new WP_Error( 'unknown_plugin', $error->get_error_messages() , 404 );
290
		}
291
292
		return true;
293
	}
294
295
	protected function get_plugin_updates( $plugin_file ) {
296
		$plugin_updates = get_plugin_updates();

_inc/lib/class-jetpack-podcast-helper.php 1 location

@@ 107-119 (lines=13) @@
104
	 * @param string $feed        The RSS feed URL to load.
105
	 * @return SimplePie|WP_Error The RSS object or error.
106
	 */
107
	private static function load_feed( $feed ) {
108
		$rss = fetch_feed( esc_url_raw( $feed ) );
109
110
		if ( is_wp_error( $rss ) ) {
111
			return new WP_Error( 'invalid_url', __( 'Your podcast couldn\'t be embedded. Please double check your URL.', 'jetpack' ) );
112
		}
113
114
		if ( ! $rss->get_item_quantity() ) {
115
			return new WP_Error( 'no_tracks', __( 'Podcast audio RSS feed has no tracks.', 'jetpack' ) );
116
		}
117
118
		return $rss;
119
	}
120
121
	/**
122
	 * Prepares Episode data to be used by the Podcast Player block.