Code Duplication    Length = 6-7 lines in 2 locations

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

@@ 223-228 (lines=6) @@
220
			}
221
		}
222
223
		if ( empty( $failed ) ) {
224
			return rest_ensure_response( array(
225
				'code' 	  => 'success',
226
				'message' => esc_html__( 'All modules activated.', 'jetpack' ),
227
			) );
228
		}
229
230
		$error = '';
231

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

@@ 806-812 (lines=7) @@
803
		}
804
805
		// If all Jumpstart modules were activated
806
		if ( empty( $result['failed_modules'] ) ) {
807
			return rest_ensure_response( array(
808
				'code' 	  => 'success',
809
				'message' => esc_html__( 'Jumpstart done.', 'jetpack' ),
810
				'data'    => $result,
811
			) );
812
		}
813
814
		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 ) );
815
	}