isSecure() public method

Checks whether the cookie should only be transmitted over a secure HTTPS connection from the client.
public isSecure ( ) : boolean
return boolean
 /**
  * Set the given cookie in the headers.
  *
  * @param  \Symfony\Component\HttpFoundation\Cookie  $cookie
  * @return void
  */
 protected function setCookie($cookie)
 {
     if (headers_sent()) {
         return;
     }
     setcookie($cookie->getName(), $cookie->getValue(), $cookie->getExpiresTime(), $cookie->getPath(), $cookie->getDomain(), $cookie->isSecure(), $cookie->isHttpOnly());
 }
Beispiel #2
0
 public function testIsSecure()
 {
     $cookie = new Cookie('foo', 'bar', 3600, '/', '.myfoodomain.com', true);
     $this->assertTrue($cookie->isSecure(), '->isSecure() returns whether the cookie is transmitted over HTTPS');
 }
 /**
  * Duplicate a cookie with a new value.
  *
  * @param  \Symfony\Component\HttpFoundation\Cookie  $c
  * @param  mixed  $value
  * @return \Symfony\Component\HttpFoundation\Cookie
  */
 protected function duplicate(Cookie $c, $value)
 {
     return new Cookie($c->getName(), $value, $c->getExpiresTime(), $c->getPath(), $c->getDomain(), $c->isSecure(), $c->isHttpOnly());
 }
Beispiel #4
0
 /**
  * Create a new cookie from the current (template) cookie with a new value.
  *
  * @param $value
  * @return Cookie
  */
 private function createCookieWithValue($value)
 {
     return new Cookie($this->cookieSettings->getName(), $value, $this->cookieSettings->getExpiresTime(), $this->cookieSettings->getPath(), $this->cookieSettings->getDomain(), $this->cookieSettings->isSecure(), $this->cookieSettings->isHttpOnly());
 }
 /**
  * Duplicate a cookie with a new name.
  *
  * @param  \Symfony\Component\HttpFoundation\Cookie  $cookie
  * @param  mixed  $name
  * @return \Symfony\Component\HttpFoundation\Cookie
  */
 private function rename(Cookie $c, $name)
 {
     return new Cookie($name, $c->getValue(), $c->getExpiresTime(), $c->getPath(), $c->getDomain(), $c->isSecure(), $c->isHttpOnly());
 }