Creates cookie from raw header string.
public static fromString ( string $cookie, boolean $decode = false ) : static | ||
$cookie | string | |
$decode | boolean | |
return | static |
public function testFromString() { $cookie = Cookie::fromString('foo=bar; expires=Fri, 20-May-2011 15:25:52 GMT; path=/; domain=.myfoodomain.com; secure; httponly'); $this->assertEquals(new Cookie('foo', 'bar', strtotime('Fri, 20-May-2011 15:25:52 GMT'), '/', '.myfoodomain.com', true, true, true), $cookie); $cookie = Cookie::fromString('foo=bar', true); $this->assertEquals(new Cookie('foo', 'bar'), $cookie); }