code: public static function httpErrorStatus($errors, int $default = SymfonyResponse::HTTP_BAD_REQUEST): int
      {
          if ($errors instanceof ErrorInterface) {
              $errors = [$errors];
          }
  
          $statuses = collect($errors)->reject(function (ErrorInterface $error) {
              return is_null($error->getStatus());
          })->map(function (ErrorInterface $error) {
              return (int) $error->getStatus();
          })->unique();
  
          if (2 > count($statuses)) {
              return $statuses->first() ?: $default;
          }
  
          $only4xx = $statuses->every(function (int $status) {
              return 400 <= $status && 499 >= $status;
          });
  
          return $only4xx ? SymfonyResponse::HTTP_BAD_REQUEST : SymfonyResponse::HTTP_INTERNAL_SERVER_ERROR;
      }
docs: Get the most applicable HTTP status code.
  
  When a server encounters multiple problems for a single request, the most generally applicable HTTP error
  code SHOULD be used in the response. For instance, 400 Bad Request might be appropriate for multiple
  4xx errors or 500 Internal Server Error might be appropriate for multiple 5xx errors.
  
  @param iterable|ErrorInterface $errors
  @param int $default
  @return int
  @see https://jsonapi.org/format/#errors