浏览代码

[HttpFoundation] added Response::setPublic() and changed setPrivate() to not take any argument

Fabien Potencier 14 年之前
父节点
当前提交
f6ddeeb36b
共有 1 个文件被更改,包括 14 次插入6 次删除
  1. 14 6
      src/Symfony/Component/HttpFoundation/Response.php

+ 14 - 6
src/Symfony/Component/HttpFoundation/Response.php

@@ -277,17 +277,25 @@ class Response
     }
 
     /**
-     * Marks the response "private".
+     * Marks the response as "private".
      *
      * It makes the response ineligible for serving other clients.
+     */
+    public function setPrivate()
+    {
+        $this->headers->getCacheControl()->setPublic(false);
+        $this->headers->getCacheControl()->setPrivate(true);
+    }
+
+    /**
+     * Marks the response as "public".
      *
-     * @param Boolean $value Whether to set the response to be private or public.
+     * It makes the response eligible for serving other clients.
      */
-    public function setPrivate($value)
+    public function setPublic()
     {
-        $value = (Boolean) $value;
-        $this->headers->getCacheControl()->setPublic(!$value);
-        $this->headers->getCacheControl()->setPrivate($value);
+        $this->headers->getCacheControl()->setPublic(true);
+        $this->headers->getCacheControl()->setPrivate(false);
     }
 
     /**