Code Duplication    Length = 4-6 lines in 4 locations

projects/plugins/jetpack/json-endpoints/jetpack/class.jetpack-json-api-plugins-modify-endpoint.php 2 locations

@@ 274-277 (lines=4) @@
271
				continue;
272
			}
273
274
			if ( ! Jetpack::is_plugin_active( $plugin ) ) {
275
				$error = $this->log[$plugin]['error'] = __( 'The Plugin is already deactivated.', 'jetpack' );
276
				continue;
277
			}
278
279
			deactivate_plugins( $plugin, false, $this->network_wide );
280
@@ 286-289 (lines=4) @@
283
				$success &= ! is_plugin_active_for_network( $plugin );
284
			}
285
286
			if ( ! $success ) {
287
				$error = $this->log[$plugin]['error'] = __( 'There was an error deactivating your plugin', 'jetpack' );
288
				continue;
289
			}
290
			$this->log[$plugin][] = __( 'Plugin deactivated.', 'jetpack' );
291
		}
292
		if ( ! $this->bulk && isset( $error ) ) {

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

@@ 60-63 (lines=4) @@
57
58
		foreach ( $this->plugins as $plugin ) {
59
60
			if ( Jetpack::is_plugin_active( $plugin ) ) {
61
				$error = $this->log[ $plugin ][] = __( 'You cannot delete a plugin while it is active on the main site.', 'jetpack' );
62
				continue;
63
			}
64
65
			$result = delete_plugins( array( $plugin ) );
66
			if ( is_wp_error( $result ) ) {

projects/plugins/jetpack/json-endpoints/jetpack/class.jetpack-json-api-plugins-modify-v1-2-endpoint.php 1 location

@@ 201-206 (lines=6) @@
198
				$success &= ! is_plugin_active_for_network( $plugin );
199
			}
200
201
			if ( ! $success ) {
202
				$error = __( 'There was an error deactivating your plugin', 'jetpack' );
203
204
				$this->log[ $plugin ]['error'] = $error;
205
				continue;
206
			}
207
			$this->log[ $plugin ][] = __( 'Plugin deactivated.', 'jetpack' );
208
		}
209
		if ( ! $this->bulk && isset( $error ) ) {