Code Duplication    Length = 6-7 lines in 2 locations

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

@@ 240-245 (lines=6) @@
237
			}
238
		}
239
240
		if ( empty( $failed ) ) {
241
			return rest_ensure_response( array(
242
				'code' 	  => 'success',
243
				'message' => esc_html__( 'All modules activated.', 'jetpack' ),
244
			) );
245
		}
246
247
		$error = '';
248

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

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