1 | <?php |
||
18 | class Cookie extends \yii\base\BaseObject |
||
19 | { |
||
20 | /** |
||
21 | * @var string name of the cookie |
||
22 | */ |
||
23 | public $name; |
||
24 | /** |
||
25 | * @var string value of the cookie |
||
26 | */ |
||
27 | public $value = ''; |
||
28 | /** |
||
29 | * @var string domain of the cookie |
||
30 | */ |
||
31 | public $domain = ''; |
||
32 | /** |
||
33 | * @var int the timestamp at which the cookie expires. This is the server timestamp. |
||
34 | * Defaults to 0, meaning "until the browser is closed". |
||
35 | */ |
||
36 | public $expire = 0; |
||
37 | /** |
||
38 | * @var string the path on the server in which the cookie will be available on. The default is '/'. |
||
39 | */ |
||
40 | public $path = '/'; |
||
41 | /** |
||
42 | * @var bool whether cookie should be sent via secure connection |
||
43 | */ |
||
44 | public $secure = false; |
||
45 | /** |
||
46 | * @var bool whether the cookie should be accessible only through the HTTP protocol. |
||
47 | * By setting this property to true, the cookie will not be accessible by scripting languages, |
||
48 | * such as JavaScript, which can effectively help to reduce identity theft through XSS attacks. |
||
49 | */ |
||
50 | public $httpOnly = true; |
||
51 | |||
52 | |||
53 | /** |
||
54 | * Magic method to turn a cookie object into a string without having to explicitly access [[value]]. |
||
55 | * |
||
56 | * ```php |
||
57 | * if (isset($request->cookies['name'])) { |
||
58 | * $value = (string) $request->cookies['name']; |
||
59 | * } |
||
60 | * ``` |
||
61 | * |
||
62 | * @return string The value of the cookie. If the value property is null, an empty string will be returned. |
||
63 | */ |
||
64 | public function __toString() |
||
68 | } |
||
69 |