1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the ONGR package. |
5
|
|
|
* |
6
|
|
|
* (c) NFQ Technologies UAB <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace ONGR\CookiesBundle\Cookie\Model; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* Field, getters and setters boilerplate for CookieInterface. |
16
|
|
|
* |
17
|
|
|
* @see CookieInterface |
18
|
|
|
*/ |
19
|
|
|
trait CookieFieldsTrait |
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* @var string Name of the cookie. |
23
|
|
|
*/ |
24
|
|
|
protected $name; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @var string |
28
|
|
|
*/ |
29
|
|
|
protected $domain = ''; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @var int |
33
|
|
|
*/ |
34
|
|
|
protected $expiresTime = 0; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @var string |
38
|
|
|
*/ |
39
|
|
|
protected $path = '/'; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @var bool |
43
|
|
|
*/ |
44
|
|
|
protected $isHttpOnly = true; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @var bool |
48
|
|
|
*/ |
49
|
|
|
protected $isSecure = false; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @var array Array of default cookie properties, when no cookie is found in the response. |
53
|
|
|
*/ |
54
|
|
|
protected $defaults = []; |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* {@inheritdoc} |
58
|
|
|
*/ |
59
|
|
|
public function getName() |
60
|
|
|
{ |
61
|
|
|
return $this->name; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @return string |
66
|
|
|
*/ |
67
|
|
|
public function getDomain() |
68
|
|
|
{ |
69
|
|
|
return $this->domain; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @param string $domain |
74
|
|
|
*/ |
75
|
|
|
public function setDomain($domain) |
76
|
|
|
{ |
77
|
|
|
$this->domain = $domain; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* @return int |
82
|
|
|
*/ |
83
|
|
|
public function getExpiresTime() |
84
|
|
|
{ |
85
|
|
|
return $this->expiresTime; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* @param int $expiresTime |
90
|
|
|
*/ |
91
|
|
|
public function setExpiresTime($expiresTime) |
92
|
|
|
{ |
93
|
|
|
$this->expiresTime = $expiresTime; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @return string |
98
|
|
|
*/ |
99
|
|
|
public function getPath() |
100
|
|
|
{ |
101
|
|
|
return $this->path; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* @param string $path |
106
|
|
|
*/ |
107
|
|
|
public function setPath($path) |
108
|
|
|
{ |
109
|
|
|
$this->path = $path; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* @return bool |
114
|
|
|
*/ |
115
|
|
|
public function isHttpOnly() |
116
|
|
|
{ |
117
|
|
|
return $this->isHttpOnly; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* @param bool $isHttpOnly |
122
|
|
|
*/ |
123
|
|
|
public function setIsHttpOnly($isHttpOnly) |
124
|
|
|
{ |
125
|
|
|
$this->isHttpOnly = $isHttpOnly; |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* @return bool |
130
|
|
|
*/ |
131
|
|
|
public function isSecure() |
132
|
|
|
{ |
133
|
|
|
return $this->isSecure; |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* @param bool $isSecure |
138
|
|
|
*/ |
139
|
|
|
public function setIsSecure($isSecure) |
140
|
|
|
{ |
141
|
|
|
$this->isSecure = $isSecure; |
142
|
|
|
} |
143
|
|
|
|
144
|
|
|
/** |
145
|
|
|
* @return array |
146
|
|
|
*/ |
147
|
|
|
public function getDefaults() |
148
|
|
|
{ |
149
|
|
|
return $this->defaults; |
150
|
|
|
} |
151
|
|
|
|
152
|
|
|
/** |
153
|
|
|
* @param array $defaults |
154
|
|
|
*/ |
155
|
|
|
public function setDefaults($defaults) |
156
|
|
|
{ |
157
|
|
|
$this->defaults = $defaults; |
158
|
|
|
} |
159
|
|
|
} |
160
|
|
|
|