You are here

class Cookie in Zircon Profile 8.0

Same name in this branch
  1. 8.0 vendor/symfony/http-foundation/Cookie.php \Symfony\Component\HttpFoundation\Cookie
  2. 8.0 vendor/symfony/browser-kit/Cookie.php \Symfony\Component\BrowserKit\Cookie
  3. 8.0 vendor/jcalderonzumba/gastonjs/src/Cookie.php \Zumba\GastonJS\Cookie
  4. 8.0 core/modules/user/src/Authentication/Provider/Cookie.php \Drupal\user\Authentication\Provider\Cookie
Same name and namespace in other branches
  1. 8 vendor/jcalderonzumba/gastonjs/src/Cookie.php \Zumba\GastonJS\Cookie

Class Cookie @package Zumba\GastonJS

Hierarchy

Expanded class hierarchy of Cookie

2 files declare their use of Cookie
BrowserCookieTrait.php in vendor/jcalderonzumba/gastonjs/src/Browser/BrowserCookieTrait.php
CookieTrait.php in vendor/jcalderonzumba/mink-phantomjs-driver/src/CookieTrait.php
7 string references to 'Cookie'
ClientTest::testUsesCookies in vendor/fabpot/goutte/Goutte/Tests/ClientTest.php
ClientTest::testUsesCookiesWithCustomPort in vendor/fabpot/goutte/Goutte/Tests/ClientTest.php
CookieJar::withCookieHeader in vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php
Create a request with added cookie headers.
FinishResponseSubscriber::setResponseCacheable in core/lib/Drupal/Core/EventSubscriber/FinishResponseSubscriber.php
Add Cache-Control and Expires headers to a cacheable response.
HttpCache::__construct in vendor/symfony/http-kernel/HttpCache/HttpCache.php
Constructor.

... See full list

File

vendor/jcalderonzumba/gastonjs/src/Cookie.php, line 9

Namespace

Zumba\GastonJS
View source
class Cookie {

  /** @var  array */
  protected $attributes;

  /**
   * @param $attributes
   */
  public function __construct($attributes) {
    $this->attributes = $attributes;
  }

  /**
   * Returns the cookie name
   * @return string
   */
  public function getName() {
    return $this->attributes['name'];
  }

  /**
   * Returns the cookie value
   * @return string
   */
  public function getValue() {
    return urldecode($this->attributes['value']);
  }

  /**
   * Returns the cookie domain
   * @return string
   */
  public function getDomain() {
    return $this->attributes['domain'];
  }

  /**
   * Returns the path were the cookie is valid
   * @return string
   */
  public function getPath() {
    return $this->attributes['path'];
  }

  /**
   * Is a secure cookie?
   * @return bool
   */
  public function isSecure() {
    return isset($this->attributes['secure']);
  }

  /**
   * Is http only cookie?
   * @return bool
   */
  public function isHttpOnly() {
    return isset($this->attributes['httponly']);
  }

  /**
   * Returns cookie expiration time
   * @return mixed
   */
  public function getExpirationTime() {

    //TODO: return a \DateTime object
    if (isset($this->attributes['expiry'])) {
      return $this->attributes['expiry'];
    }
    return null;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Cookie::$attributes protected property @var array
Cookie::getDomain public function Returns the cookie domain
Cookie::getExpirationTime public function Returns cookie expiration time
Cookie::getName public function Returns the cookie name
Cookie::getPath public function Returns the path were the cookie is valid
Cookie::getValue public function Returns the cookie value
Cookie::isHttpOnly public function Is http only cookie?
Cookie::isSecure public function Is a secure cookie?
Cookie::__construct public function