Code Duplication    Length = 6-7 lines in 2 locations

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

@@ 215-220 (lines=6) @@
212
			}
213
		}
214
215
		if ( empty( $failed ) ) {
216
			return rest_ensure_response( array(
217
				'code' 	  => 'success',
218
				'message' => esc_html__( 'All modules activated.', 'jetpack' ),
219
			) );
220
		}
221
222
		$error = '';
223

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

@@ 948-954 (lines=7) @@
945
		}
946
947
		// If all Jumpstart modules were activated
948
		if ( empty( $result['failed_modules'] ) ) {
949
			return rest_ensure_response( array(
950
				'code' 	  => 'success',
951
				'message' => esc_html__( 'Jumpstart done.', 'jetpack' ),
952
				'data'    => $result,
953
			) );
954
		}
955
956
		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 ) );
957
	}