/** * Data provider with cookies and their expected string representation. * * @return array */ public function cookiesAndTheirStringRepresentations() { $expiredCookie = new Cookie('foo', 'bar'); $expiredCookie->expire(); return array(array(new Cookie('foo', 'bar'), 'foo=bar; Path=/; HttpOnly'), array(new Cookie('MyFoo25', 'bar'), 'MyFoo25=bar; Path=/; HttpOnly'), array(new Cookie('MyFoo25', TRUE), 'MyFoo25=1; Path=/; HttpOnly'), array(new Cookie('MyFoo25', FALSE), 'MyFoo25=0; Path=/; HttpOnly'), array(new Cookie('foo', 'bar', 0), 'foo=bar; Path=/; HttpOnly'), array(new Cookie('MyFoo25'), 'MyFoo25=; Path=/; HttpOnly'), array(new Cookie('foo', 'It\'s raining cats and dogs.'), 'foo=It%27s+raining+cats+and+dogs.; Path=/; HttpOnly'), array(new Cookie('foo', 'Some characters, like "double quotes" must be escaped.'), 'foo=Some+characters%2C+like+%22double+quotes%22+must+be+escaped.; Path=/; HttpOnly'), array(new Cookie('foo', 'bar', 1345108546), 'foo=bar; Expires=Thu, 16-Aug-2012 09:15:46 GMT; Path=/; HttpOnly'), array(new Cookie('foo', 'bar', \DateTime::createFromFormat('U', 1345108546)), 'foo=bar; Expires=Thu, 16-Aug-2012 09:15:46 GMT; Path=/; HttpOnly'), array(new Cookie('foo', 'bar', 0, NULL, 'flow3.typo3.org'), 'foo=bar; Domain=flow3.typo3.org; Path=/; HttpOnly'), array(new Cookie('foo', 'bar', 0, NULL, 'flow3.typo3.org', '/about'), 'foo=bar; Domain=flow3.typo3.org; Path=/about; HttpOnly'), array(new Cookie('foo', 'bar', 0, NULL, 'typo3.org', '/', TRUE), 'foo=bar; Domain=typo3.org; Path=/; Secure; HttpOnly'), array(new Cookie('foo', 'bar', 0, NULL, 'typo3.org', '/', TRUE, FALSE), 'foo=bar; Domain=typo3.org; Path=/; Secure'), array($expiredCookie, 'foo=bar; Expires=Thu, 27-May-1976 12:00:00 GMT; Path=/; HttpOnly')); }
/** * Sets a cookie * * @param \TYPO3\FLOW3\Http\Cookie $cookie * @return void * @api */ public function setCookie(Cookie $cookie) { $this->cookies[$cookie->getName()] = $cookie; }