Code Duplication    Length = 6-7 lines in 2 locations

_inc/lib/core-api/class.jetpack-core-api-module-endpoints.php 1 location

@@ 247-252 (lines=6) @@
244
			}
245
		}
246
247
		if ( empty( $failed ) ) {
248
			return rest_ensure_response( array(
249
				'code' 	  => 'success',
250
				'message' => esc_html__( 'All modules activated.', 'jetpack' ),
251
			) );
252
		}
253
254
		$error = '';
255

_inc/lib/class.core-rest-api-endpoints.php 1 location

@@ 1229-1235 (lines=7) @@
1226
		}
1227
1228
		// If all Jumpstart modules were activated
1229
		if ( empty( $result['failed_modules'] ) ) {
1230
			return rest_ensure_response( array(
1231
				'code' 	  => 'success',
1232
				'message' => esc_html__( 'Jumpstart done.', 'jetpack' ),
1233
				'data'    => $result,
1234
			) );
1235
		}
1236
1237
		return new WP_Error( 'jumpstart_failed', esc_html( sprintf( _n( 'Jumpstart failed activating this module: %s.', 'Jumpstart failed activating these modules: %s.', count( $result['failed_modules'] ), 'jetpack' ), join( ', ', $result['failed_modules'] ) ) ), array( 'status' => 400 ) );
1238
	}