Skip to content

Commit

Permalink
Rename isRequestSafe to isRequestCacheable
Browse files Browse the repository at this point in the history
  • Loading branch information
j0k3r committed Jan 4, 2017
1 parent ca76fde commit cf0687a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion EventListener/AbstractRuleSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion EventListener/CacheControlSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion EventListener/TagSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions Tests/Functional/Fixtures/Controller/TagController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand All @@ -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'));
}

Expand Down

0 comments on commit cf0687a

Please sign in to comment.