fixed typos
This commit is contained in:
parent
e578dfdbec
commit
1b9645b098
|
@ -65,14 +65,14 @@ class Cookie
|
|||
$cookie .= '; expires='.substr(\DateTime::createFromFormat('U', $this->expires, new \DateTimeZone('UTC'))->format(static::DATE_FORMAT), 0, -5);
|
||||
}
|
||||
|
||||
if ('/' !== $this->path) {
|
||||
$cookie .= '; path='.$this->path;
|
||||
}
|
||||
|
||||
if ('' !== $this->domain) {
|
||||
$cookie .= '; domain='.$this->domain;
|
||||
}
|
||||
|
||||
if ('/' !== $this->path) {
|
||||
$cookie .= '; path='.$this->path;
|
||||
}
|
||||
|
||||
if ($this->secure) {
|
||||
$cookie .= '; secure';
|
||||
}
|
||||
|
|
|
@ -204,7 +204,7 @@ class HeaderBag
|
|||
} else {
|
||||
$expires = strtotime($expires);
|
||||
if (false === $expires || -1 == $expires) {
|
||||
throw new \InvalidArgumentException(sprintf('The "expires" cookie parameter is not valid.', $expire));
|
||||
throw new \InvalidArgumentException(sprintf('The "expires" cookie parameter is not valid.', $expires));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -213,14 +213,12 @@ class HeaderBag
|
|||
$cookie .= '; expires='.substr(\DateTime::createFromFormat('U', $expires, new \DateTimeZone('UTC'))->format('D, d-M-Y H:i:s T'), 0, -5);
|
||||
}
|
||||
|
||||
$cookie .= '; domain='.$domain;
|
||||
|
||||
if ('/' !== $path) {
|
||||
$cookie .= '; path='.$path;
|
||||
}
|
||||
|
||||
if ('' !== $domain) {
|
||||
$cookie .= '; domain='.$domain;
|
||||
}
|
||||
|
||||
if ($secure) {
|
||||
$cookie .= '; secure';
|
||||
}
|
||||
|
|
|
@ -32,14 +32,14 @@ class CookieTest extends \PHPUnit_Framework_TestCase
|
|||
array('foo=bar; domain=google.com'),
|
||||
array('foo=bar; secure'),
|
||||
array('foo=bar; httponly'),
|
||||
array('foo=bar; path=/foo; domain=google.com; secure; httponly'),
|
||||
array('foo=bar; domain=google.com; path=/foo; secure; httponly'),
|
||||
);
|
||||
}
|
||||
|
||||
public function testFromStringWithUrl()
|
||||
{
|
||||
$this->assertEquals('foo=bar; domain=www.example.com', (string) Cookie::FromString('foo=bar', 'http://www.example.com/'));
|
||||
$this->assertEquals('foo=bar; path=/foo; domain=www.example.com', (string) Cookie::FromString('foo=bar', 'http://www.example.com/foo/bar'));
|
||||
$this->assertEquals('foo=bar; domain=www.example.com; path=/foo', (string) Cookie::FromString('foo=bar', 'http://www.example.com/foo/bar'));
|
||||
}
|
||||
|
||||
public function testFromStringThrowsAnExceptionIfCookieIsNotValid()
|
||||
|
|
Reference in New Issue