You are here

public function SetCookie::__construct in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php \GuzzleHttp\Cookie\SetCookie::__construct()

Parameters

array $data Array of cookie data provided by a Cookie parser:

File

vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php, line 73

Class

SetCookie
Set-Cookie object

Namespace

GuzzleHttp\Cookie

Code

public function __construct(array $data = []) {
  $this->data = array_replace(self::$defaults, $data);

  // Extract the Expires value and turn it into a UNIX timestamp if needed
  if (!$this
    ->getExpires() && $this
    ->getMaxAge()) {

    // Calculate the Expires date
    $this
      ->setExpires(time() + $this
      ->getMaxAge());
  }
  elseif ($this
    ->getExpires() && !is_numeric($this
    ->getExpires())) {
    $this
      ->setExpires($this
      ->getExpires());
  }
}