ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
CookieWrapper.php
Go to the documentation of this file.
1 <?php
2 
3 namespace ILIAS\HTTP\Cookies;
4 
6 
17 class CookieWrapper implements Cookie
18 {
19 
25  private $cookie;
26 
27 
33  public function __construct(SetCookie $cookie)
34  {
35  $this->cookie = $cookie;
36  }
37 
38 
42  public function getName()
43  {
44  return $this->cookie->getName();
45  }
46 
47 
51  public function getValue()
52  {
53  return $this->cookie->getValue();
54  }
55 
56 
60  public function getExpires()
61  {
62  return $this->cookie->getExpires();
63  }
64 
65 
69  public function getMaxAge()
70  {
71  return $this->cookie->getMaxAge();
72  }
73 
74 
78  public function getPath()
79  {
80  return $this->cookie->getPath();
81  }
82 
83 
87  public function getDomain()
88  {
89  return $this->cookie->getDomain();
90  }
91 
92 
96  public function getSecure()
97  {
98  return $this->cookie->getSecure();
99  }
100 
101 
105  public function getHttpOnly()
106  {
107  return $this->cookie->getHttpOnly();
108  }
109 
110 
114  public function withValue($value = null)
115  {
116  $clone = clone $this;
117  $clone->cookie = $this->cookie->withValue($value);
118 
119  return $clone;
120  }
121 
122 
126  public function withExpires($expires = null)
127  {
128  $clone = clone $this;
129  $clone->cookie = $this->cookie->withExpires($expires);
130 
131  return $clone;
132  }
133 
134 
138  public function rememberForLongTime()
139  {
140  $clone = clone $this;
141  $clone->cookie = $this->cookie->rememberForever();
142 
143  return $clone;
144  }
145 
146 
150  public function expire()
151  {
152  $clone = clone $this;
153  $clone->cookie = $this->cookie->expire();
154 
155  return $clone;
156  }
157 
158 
162  public function withMaxAge($maxAge = null)
163  {
164  $clone = clone $this;
165  $clone->cookie = $this->cookie->withMaxAge($maxAge);
166 
167  return $clone;
168  }
169 
170 
174  public function withPath($path = null)
175  {
176  $clone = clone $this;
177  $clone->cookie = $this->cookie->withPath($path);
178 
179  return $clone;
180  }
181 
182 
186  public function withDomain($domain = null)
187  {
188  $clone = clone $this;
189  $clone->cookie = $this->cookie->withDomain($domain);
190 
191  return $clone;
192  }
193 
194 
198  public function withSecure($secure = null)
199  {
200  $clone = clone $this;
201  $clone->cookie = $this->cookie->withSecure($secure);
202 
203  return $clone;
204  }
205 
206 
210  public function withHttpOnly($httpOnly = null)
211  {
212  $clone = clone $this;
213  $clone->cookie = $this->cookie->withHttpOnly($httpOnly);
214 
215  return $clone;
216  }
217 
218 
222  public function __toString()
223  {
224  return $this->cookie->__toString();
225  }
226 
227 
235  public function getImplementation()
236  {
237  return $this->cookie;
238  }
239 }
Class CookieJarWrapperTest.
Definition: Cookie.php:3
getImplementation()
Returns the underlying implementation.
$cookie
Underlying implementation.
if(!array_key_exists('domain', $_REQUEST)) $domain
Definition: resume.php:8
__construct(SetCookie $cookie)
CookieFacade constructor.