Code Duplication    Length = 3-4 lines in 3 locations

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

@@ 27-29 (lines=3) @@
24
25
			$plugin = self::get_plugin_id_by_slug( $slug );
26
			$error_code = 'install_error';
27
			if ( ! $plugin ) {
28
				$error = $this->log[ $slug ]['error'] = __( 'There was an error installing your plugin', 'jetpack' );
29
			}
30
31
			if ( ! $this->bulk && ! $result ) {
32
				$error_code = $upgrader->skin->get_main_error_code();

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

@@ 104-107 (lines=4) @@
101
102
	protected function deactivate() {
103
		foreach ( $this->plugins as $plugin ) {
104
			if ( ! Jetpack::is_plugin_active( $plugin ) ) {
105
				$error = $this->log[ $plugin ]['error'] = __( 'The Plugin is already deactivated.', 'jetpack' );
106
				continue;
107
			}
108
109
			deactivate_plugins( $plugin, false, $this->network_wide );
110
@@ 116-119 (lines=4) @@
113
				$success &= ! is_plugin_active_for_network( $plugin );
114
			}
115
116
			if ( ! $success ) {
117
				$error = $this->log[ $plugin ]['error'] = __( 'There was an error deactivating your plugin', 'jetpack' );
118
				continue;
119
			}
120
			$this->log[ $plugin ][] = __( 'Plugin deactivated.', 'jetpack' );
121
		}
122
		if ( ! $this->bulk && isset( $error ) ) {