CacheableSecuredRedirectResponse.php in Drupal 10
File
core/lib/Drupal/Core/Routing/CacheableSecuredRedirectResponse.php
View source
<?php
namespace Drupal\Core\Routing;
use Drupal\Component\HttpFoundation\SecuredRedirectResponse;
use Drupal\Core\Cache\CacheableResponseInterface;
use Drupal\Core\Cache\CacheableResponseTrait;
use Symfony\Component\HttpFoundation\RedirectResponse;
abstract class CacheableSecuredRedirectResponse extends SecuredRedirectResponse implements CacheableResponseInterface {
use CacheableResponseTrait;
protected function fromResponse(RedirectResponse $response) {
parent::fromResponse($response);
$metadata = $this
->getCacheableMetadata();
if ($response instanceof CacheableResponseInterface) {
$metadata
->addCacheableDependency($response
->getCacheableMetadata());
}
else {
$metadata
->setCacheMaxAge(0);
}
}
}