Same name and namespace in other branches
  1. 8.9.x core/lib/Drupal/Core/Routing/CacheableSecuredRedirectResponse.php \Drupal\Core\Routing\CacheableSecuredRedirectResponse
  2. 9 core/lib/Drupal/Core/Routing/CacheableSecuredRedirectResponse.php \Drupal\Core\Routing\CacheableSecuredRedirectResponse

Provides a common base class for cacheable safe redirects.

Hierarchy

Expanded class hierarchy of CacheableSecuredRedirectResponse

File

core/lib/Drupal/Core/Routing/CacheableSecuredRedirectResponse.php, line 13

Namespace

Drupal\Core\Routing
View source
abstract class CacheableSecuredRedirectResponse extends SecuredRedirectResponse implements CacheableResponseInterface {
  use CacheableResponseTrait;

  /**
   * {@inheritdoc}
   */
  protected function fromResponse(RedirectResponse $response) {
    parent::fromResponse($response);
    $metadata = $this
      ->getCacheableMetadata();
    if ($response instanceof CacheableResponseInterface) {
      $metadata
        ->addCacheableDependency($response
        ->getCacheableMetadata());
    }
    else {
      $metadata
        ->setCacheMaxAge(0);
    }
  }

}

Members