Skip to content

Commit cf0687a

Browse files
committed
Rename isRequestSafe to isRequestCacheable
1 parent ca76fde commit cf0687a

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

EventListener/AbstractRuleSubscriber.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ protected function matchRule(Request $request, Response $response)
6262
*
6363
* @return bool True if the request is safe and headers can be set
6464
*/
65-
protected function isRequestSafe(Request $request)
65+
protected function isRequestCacheable(Request $request)
6666
{
6767
return method_exists($request, 'isMethodCacheable') ? $request->isMethodCacheable() : $request->isMethodSafe();
6868
}

EventListener/CacheControlSubscriber.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public function onKernelResponse(FilterResponseEvent $event)
102102
}
103103

104104
// do not change cache directives on unsafe requests.
105-
if ($this->skip || !$this->isRequestSafe($request)) {
105+
if ($this->skip || !$this->isRequestCacheable($request)) {
106106
return;
107107
}
108108

EventListener/TagSubscriber.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function onKernelResponse(FilterResponseEvent $event)
7979
}
8080
}
8181

82-
if ($this->isRequestSafe($request)) {
82+
if ($this->isRequestCacheable($request)) {
8383
$this->tagHandler->addTags($tags);
8484
if (HttpKernelInterface::MASTER_REQUEST === $event->getRequestType()) {
8585
// For safe requests (GET and HEAD), set cache tags on response

Tests/Functional/Fixtures/Controller/TagController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ class TagController extends Controller
2323
*
2424
* @param Request $request
2525
*
26-
* @return bool True if the request is safe
26+
* @return bool True if the request is cacheable
2727
*/
28-
private function isRequestSafe(Request $request)
28+
private function isRequestCacheable(Request $request)
2929
{
3030
return method_exists($request, 'isMethodCacheable') ? $request->isMethodCacheable() : $request->isMethodSafe();
3131
}
@@ -44,7 +44,7 @@ public function listAction()
4444
*/
4545
public function itemAction(Request $request, $id)
4646
{
47-
if (!$this->isRequestSafe($request)) {
47+
if (!$this->isRequestCacheable($request)) {
4848
$this->container->get('fos_http_cache.handler.tag_handler')->invalidateTags(array('all-items'));
4949
}
5050

0 commit comments

Comments
 (0)