This repository has been archived on 2025-01-19. You can view files and clone it, but cannot push or open issues or pull requests.
drupalcampbristol/vendor/chi-teck/drupal-code-generator/templates/d8/service/response-policy.twig
2018-11-23 12:29:20 +00:00

24 lines
501 B
Twig

<?php
namespace Drupal\{{ machine_name }}\PageCache;
use Drupal\Core\PageCache\ResponsePolicyInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
/**
* A policy disallowing caching requests with certain cookies.
*/
class {{ class }} implements ResponsePolicyInterface {
/**
* {@inheritdoc}
*/
public function check(Response $response, Request $request) {
if ($request->cookies->get('foo')) {
return self::DENY;
}
}
}