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

@@ 1447-1453 (lines=7) @@
1444
		}
1445
1446
		// If all Jumpstart modules were activated
1447
		if ( empty( $result['failed_modules'] ) ) {
1448
			return rest_ensure_response( array(
1449
				'code' 	  => 'success',
1450
				'message' => esc_html__( 'Jumpstart done.', 'jetpack' ),
1451
				'data'    => $result,
1452
			) );
1453
		}
1454
1455
		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 ) );
1456
	}