@@ -25,6 +25,7 @@ class Cookie
2525 protected $ path ;
2626 protected $ secure ;
2727 protected $ httpOnly ;
28+ private $ raw ;
2829
2930 /**
3031 * Constructor.
@@ -36,10 +37,11 @@ class Cookie
3637 * @param string $domain The domain that the cookie is available to
3738 * @param bool $secure Whether the cookie should only be transmitted over a secure HTTPS connection from the client
3839 * @param bool $httpOnly Whether the cookie will be made accessible only through the HTTP protocol
40+ * @param bool $raw Whether the cookie value should be sent with no url encoding
3941 *
4042 * @throws \InvalidArgumentException
4143 */
42- public function __construct ($ name , $ value = null , $ expire = 0 , $ path = '/ ' , $ domain = null , $ secure = false , $ httpOnly = true )
44+ public function __construct ($ name , $ value = null , $ expire = 0 , $ path = '/ ' , $ domain = null , $ secure = false , $ httpOnly = true , $ raw = false )
4345 {
4446 // from PHP source code
4547 if (preg_match ("/[=,; \t\r\n\013\014]/ " , $ name )) {
@@ -68,6 +70,7 @@ public function __construct($name, $value = null, $expire = 0, $path = '/', $dom
6870 $ this ->path = empty ($ path ) ? '/ ' : $ path ;
6971 $ this ->secure = (bool ) $ secure ;
7072 $ this ->httpOnly = (bool ) $ httpOnly ;
73+ $ this ->raw = (bool ) $ raw ;
7174 }
7275
7376 /**
@@ -187,4 +190,14 @@ public function isCleared()
187190 {
188191 return $ this ->expire < time ();
189192 }
193+
194+ /**
195+ * Checks if the cookie value should be sent with no url encoding.
196+ *
197+ * @return bool
198+ */
199+ public function isRaw ()
200+ {
201+ return $ this ->raw ;
202+ }
190203}
0 commit comments