From cf0687af860de12097dab41d4f6c7e0ac0165696 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 4 Jan 2017 17:28:57 +0100 Subject: [PATCH] Rename isRequestSafe to isRequestCacheable --- EventListener/AbstractRuleSubscriber.php | 2 +- EventListener/CacheControlSubscriber.php | 2 +- EventListener/TagSubscriber.php | 2 +- Tests/Functional/Fixtures/Controller/TagController.php | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/EventListener/AbstractRuleSubscriber.php b/EventListener/AbstractRuleSubscriber.php index 29fe5270..f67af662 100644 --- a/EventListener/AbstractRuleSubscriber.php +++ b/EventListener/AbstractRuleSubscriber.php @@ -62,7 +62,7 @@ protected function matchRule(Request $request, Response $response) * * @return bool True if the request is safe and headers can be set */ - protected function isRequestSafe(Request $request) + protected function isRequestCacheable(Request $request) { return method_exists($request, 'isMethodCacheable') ? $request->isMethodCacheable() : $request->isMethodSafe(); } diff --git a/EventListener/CacheControlSubscriber.php b/EventListener/CacheControlSubscriber.php index cf979501..e13eaca2 100644 --- a/EventListener/CacheControlSubscriber.php +++ b/EventListener/CacheControlSubscriber.php @@ -102,7 +102,7 @@ public function onKernelResponse(FilterResponseEvent $event) } // do not change cache directives on unsafe requests. - if ($this->skip || !$this->isRequestSafe($request)) { + if ($this->skip || !$this->isRequestCacheable($request)) { return; } diff --git a/EventListener/TagSubscriber.php b/EventListener/TagSubscriber.php index 34f0d433..21f6a090 100644 --- a/EventListener/TagSubscriber.php +++ b/EventListener/TagSubscriber.php @@ -79,7 +79,7 @@ public function onKernelResponse(FilterResponseEvent $event) } } - if ($this->isRequestSafe($request)) { + if ($this->isRequestCacheable($request)) { $this->tagHandler->addTags($tags); if (HttpKernelInterface::MASTER_REQUEST === $event->getRequestType()) { // For safe requests (GET and HEAD), set cache tags on response diff --git a/Tests/Functional/Fixtures/Controller/TagController.php b/Tests/Functional/Fixtures/Controller/TagController.php index a8fb4fa4..2f3eb2d5 100644 --- a/Tests/Functional/Fixtures/Controller/TagController.php +++ b/Tests/Functional/Fixtures/Controller/TagController.php @@ -23,9 +23,9 @@ class TagController extends Controller * * @param Request $request * - * @return bool True if the request is safe + * @return bool True if the request is cacheable */ - private function isRequestSafe(Request $request) + private function isRequestCacheable(Request $request) { return method_exists($request, 'isMethodCacheable') ? $request->isMethodCacheable() : $request->isMethodSafe(); } @@ -44,7 +44,7 @@ public function listAction() */ public function itemAction(Request $request, $id) { - if (!$this->isRequestSafe($request)) { + if (!$this->isRequestCacheable($request)) { $this->container->get('fos_http_cache.handler.tag_handler')->invalidateTags(array('all-items')); }