blob: 17208cff2f505c72c0fd54c04f33e3b2c59ebcd0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
|
<?php
/**
* THttpRequest, THttpCookie, THttpCookieCollection, TUri class file
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.pradosoft.com/
* @copyright Copyright © 2005-2014 PradoSoft
* @license http://www.pradosoft.com/license/
* @package Prado\Web
*/
namespace Prado\Web;
/**
* THttpCookie class.
*
* A THttpCookie instance stores a single cookie, including the cookie name, value,
* domain, path, expire, and secure.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @package Prado\Web
* @since 3.0
*/
class THttpCookie extends TComponent
{
/**
* @var string domain of the cookie
*/
private $_domain='';
/**
* @var string name of the cookie
*/
private $_name;
/**
* @var string value of the cookie
*/
private $_value='';
/**
* @var integer expire of the cookie
*/
private $_expire=0;
/**
* @var string path of the cookie
*/
private $_path='/';
/**
* @var boolean whether cookie should be sent via secure connection
*/
private $_secure=false;
/**
* @var boolean if true the cookie value will be unavailable to JavaScript
*/
private $_httpOnly=false;
/**
* Constructor.
* @param string name of this cookie
* @param string value of this cookie
*/
public function __construct($name,$value)
{
$this->_name=$name;
$this->_value=$value;
}
/**
* @return string the domain to associate the cookie with
*/
public function getDomain()
{
return $this->_domain;
}
/**
* @param string the domain to associate the cookie with
*/
public function setDomain($value)
{
$this->_domain=$value;
}
/**
* @return integer the time the cookie expires. This is a Unix timestamp so is in number of seconds since the epoch.
*/
public function getExpire()
{
return $this->_expire;
}
/**
* @param integer the time the cookie expires. This is a Unix timestamp so is in number of seconds since the epoch.
*/
public function setExpire($value)
{
$this->_expire=TPropertyValue::ensureInteger($value);
}
/**
* @return boolean if true the cookie value will be unavailable to JavaScript
*/
public function getHttpOnly()
{
return $this->_httpOnly;
}
/**
* @param boolean $value if true the cookie value will be unavailable to JavaScript
*/
public function setHttpOnly($value)
{
$this->_httpOnly = TPropertyValue::ensureBoolean($value);
}
/**
* @return string the name of the cookie
*/
public function getName()
{
return $this->_name;
}
/**
* @param string the name of the cookie
*/
public function setName($value)
{
$this->_name=$value;
}
/**
* @return string the value of the cookie
*/
public function getValue()
{
return $this->_value;
}
/**
* @param string the value of the cookie
*/
public function setValue($value)
{
$this->_value=$value;
}
/**
* @return string the path on the server in which the cookie will be available on, default is '/'
*/
public function getPath()
{
return $this->_path;
}
/**
* @param string the path on the server in which the cookie will be available on
*/
public function setPath($value)
{
$this->_path=$value;
}
/**
* @return boolean whether the cookie should only be transmitted over a secure HTTPS connection
*/
public function getSecure()
{
return $this->_secure;
}
/**
* @param boolean ether the cookie should only be transmitted over a secure HTTPS connection
*/
public function setSecure($value)
{
$this->_secure=TPropertyValue::ensureBoolean($value);
}
}
|