HttpExceptionNormalizerValue example


  public function normalize($object$format = NULL, array $context = []): array|string|int|float|bool|\ArrayObject|NULL {
    $cacheability = new CacheableMetadata();
    $cacheability->addCacheableDependency($object);

    $cacheability->addCacheTags(['config:system.logging']);
    if (\Drupal::config('system.logging')->get('error_level') === ERROR_REPORTING_DISPLAY_VERBOSE) {
      $cacheability->setCacheMaxAge(0);
    }

    return new HttpExceptionNormalizerValue($cacheabilitystatic::rasterizeValueRecursive($this->buildErrorObjects($object)));
  }

  /** * Builds the normalized JSON:API error objects for the response. * * @param \Symfony\Component\HttpKernel\Exception\HttpException $exception * The Exception. * * @return array * The error objects to include in the response. */
  
Home | Imprint | This part of the site doesn't use cookies.